Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Thu Aug 24, 2017 2:59 am

All times are UTC




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Aug 10, 2017 5:21 am 
Offline
Engineer
Engineer

Joined: Fri Sep 30, 2016 4:15 am
Posts: 4
I am trying to make a train calculator in Excel, but my calculations are not working out in game. Specifically, trains seem to be able to handle more weight than the calculator suggests. I have checked game settings a million times to be sure everything matches. I've been using this page as a reference: https://wiki.openttd.org/Tractive_Effort Are these equations still accurate? Are they different for JGR patch pack? Are there other variables unlisted here?


Top
   
PostPosted: Thu Aug 10, 2017 7:49 am 
Offline
Tycoon
Tycoon

Joined: Wed Apr 27, 2005 7:09 am
Posts: 5072
brutesquad01 wrote:
I am trying to make a train calculator in Excel, but my calculations are not working out in game. [...]

That reference is based upon an ancient post by me:

http://www.tt-forums.net/viewtopic.php?p=751674#p751674

Calculations were based on TTDPatch mechanics.

There were numerous discussions about "realistic acceleration in OTTD", e.g.:

Trains accelerating too fast:
viewtopic.php?f=33&t=50739

Weird Train Acceleration in Nightlies:
viewtopic.php?f=31&t=51916

Both might be worth reading.

And there´s Peter´s calculator:
http://iis.fuzzle.org/

Disclaimer: I don´t know what the current status in trunk or JGR´s patch is.

regards
Michael

_________________
Image


Top
   
PostPosted: Thu Aug 10, 2017 2:35 pm 
Offline
Engineer
Engineer

Joined: Fri Sep 30, 2016 4:15 am
Posts: 4
Thanks for your reply, those are some interesting discussions. Unfortunately it looks like no one really knows how it works any more (if ever)?


Top
   
PostPosted: Fri Aug 11, 2017 4:41 am 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Sun Sep 09, 2007 5:03 am
Posts: 4447
Location: home
What do you mean, no one knows?
The source code is freely available, you can read up to the last bit how it works exactly (unlike in the real world, where mother nature does not give us that insight).

I don't know what you're doing, but approximating that code with some set of continuous equations is going to fail. You compute things differently from the real code, which introduces errors, ultimately resulting in different answers than the real simulation.
This is a normal phenomenon in modelling though, any model is an approximation, and will give errors.

If you model a real-life train with a set of equations, you also get errors. However, we have studied real-world motion since Newton, so we have a pretty good idea how to do that, ie we have good models for real-life trains. (They still have errors though, eg Einstein says you should take relativity into account, which mostly likely is never done.)

In your case, you're trying to catch the behaviour of a computer producing speed of a virtual train. There is no friction or air in a CPU, or steel running on steel, so any real-life train model does not apply. The computer uses iterative discrete mathematics. Modeling that as a set of continuous equations is a valid approach, but discrete mathematics don't quite work the same as floating point, so it may introduce large errors.

_________________
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.


Top
   
PostPosted: Sat Aug 12, 2017 6:08 am 
Offline
Engineer
Engineer

Joined: Fri Sep 30, 2016 4:15 am
Posts: 4
Alberth wrote:
What do you mean, no one knows?


I mean that I've asked not only here, but on reddit and other communities and the answers that I get back are old discussions with no definitive conclusion or old tools that give inaccurate results. No one has said "JGRPP works differently" or "here is the math that is used" or "the game also accounts for these variables." Yours is the most definitive answer I've got thus far, and it's little more than "it's in the code." So, if no one is able to answer my question, then I must conclude that no one knows. It's not a personal attack on the community or anyone in particular; maybe the person or people who knows how it works are no longer active in OpenTTD. That's fine if that's the case, not like anyone's getting paid for this.

Unfortunately, I'm not a programmer (or a mathematician, or physicist, or any sort of technically trained person), so I don't have a clue where to even begin to look in the source code for the information, or even which code to look at. I hadn't considered your point that an equation will not match the game code perfectly. What I have right now isn't even close enough to be considered an approximation, though, so I don't think that's the problem. Maybe I would be better off to record data from in-game testing and derive an approximation from that? I don't know, I've been figuring this all out on my own (including Excel), so I'm just trying to get some help.


Top
   
PostPosted: Sat Aug 12, 2017 6:50 am 
Offline
Engineer
Engineer

Joined: Wed Dec 18, 2013 12:32 pm
Posts: 67
brutesquad01 wrote:
Alberth wrote:
What do you mean, no one knows?
I don't have a clue where to even begin to look in the source code for the information, or even which code to look at.


Look here. TE is pretty much sum(part_weight*part_te)*10000 div 256. And last time I checked it did yield the same TE as in game. There are some nuances with this calculation though which I don't remember.


Top
   
PostPosted: Sat Aug 12, 2017 2:20 pm 
Offline
Engineer
Engineer

Joined: Fri Sep 30, 2016 4:15 am
Posts: 4
_dp_ wrote:
Look here. TE is pretty much sum(part_weight*part_te)*10000 div 256. And last time I checked it did yield the same TE as in game. There are some nuances with this calculation though which I don't remember.


Thank you! This looks like it has all the info I need, if I can decode it. That might take a while.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.