Trains accelerating too fast

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
Uwe
Transport Coordinator
Transport Coordinator
Posts: 353
Joined: 09 Jul 2004 14:05
Location: Germany

Trains accelerating too fast

Post by Uwe »

Hi,

in a recent discussion over at the German forums it was found that the kinematic model in OpenTTD allowed trains to accelerate much better and faster than the realistic acceleration as implemented in TTDPatch. Since this has quite an impact on set design and gameplay, I toyed around a bit and compared the behaviour of trains in both games. Trains which struggled going across hills or barely reached their top speed in TTDPatch were running without any problems in OpenTTD - so there definitely is a huge and obvious difference. Then I looked at the OpenTTD source. To my limited understanding, the resistance computed for friction and air resistance etc. seems to be much too small. I therefore changed around some of the lines in the acceleration code to get a train behaviour similar to the one found in TTDPatch. The result is a very small patch, which should mainly be thought of as a base for further discussion, rather than a real solution. Being involved in graphics set developments, I'd like to see the acceleration be comparable in both TTDPatch and OpenTTD, making it a easier for set developers to balance the sets.

Regards,
Uwe
Attachments
sloweracceleration.zip
Small patch for slower train acceleration
(1.03 KiB) Downloaded 144 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Trains accelerating too fast

Post by Yexo »

Please upload patch files as .diff or .patch, not zipped. That makes it much easier to view them.
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Trains accelerating too fast

Post by Eddi »

i'm not entirely sure why you remove the drag area calculation from the non-maglev case, and only apply it to maglevs.
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3427
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: Trains accelerating too fast

Post by Emperor Jake »

You could have increased the slope steepness and cargo weight multiplier...

Although you likely knew about these and they didn't provide exactly what you wanted, I could see why you made a patch.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Trains accelerating too fast

Post by michael blunck »

As already mentioned, this topic has been discussed on the German tt-forums. And because Uwe did chose the DB Set´s BR92 as a "standard" for his tests, I´ve been posting its "performance table" there.

Might be of help now, to get the right numbers.

Image

Image

regards
Michael
Image
Uwe
Transport Coordinator
Transport Coordinator
Posts: 353
Joined: 09 Jul 2004 14:05
Location: Germany

Re: Trains accelerating too fast

Post by Uwe »

@Eddi: I tried to work out some approach that comes close to the behaviour of TTDPatch, and I personally am only interested in trains, not maglevs. I therefore only changed stuff for the non-maglev case. It's only a small hackish kind of solution ATM, for a proper development the thing needs to be approached in more depth.
@Emperor Jake: Of course I could have adjusted the game settings to suit my style of playing. But that is not the point, the problem is that with the same settings as used in TTDPatch (5% slopes), trains behave extremely different. And that is the reason why I changed some pieces in the code to see how a behaviour similar to the one in TTDPatch could be achieved.

mb posted the specs of an engine from the DBSetXL, and testing shows that in TTDPatch these specs are roughly matched by what the engine can haul in the game. In OpenTTD, the very same engine is much more powerful - or rather the resistance forces are much less, so that the engine can pull more load to a faster top speed (read: the engine can reach top speed with much heavier trains). In my opinion, it should be possible to have comparable behaviour in both games, otherwise set design becomes even more of the nightmare it already is.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Trains accelerating too fast

Post by michael blunck »

Emperor Jake wrote: You could have increased the slope steepness and cargo weight multiplier...
Uwe wrote: mb posted the specs of an engine from the DBSetXL, and testing shows that in TTDPatch these specs are roughly matched by what the engine can haul in the game.
May I point out that this is because of the way kinematics had been developed in TTDPatch, and not by sheer coincidence? First, Josef and me resuscitated long-forgotten physics basics, then some real data was gathered, and in the end Josef wrote the proper code for TTDPatch.

And no, this was not started as an ill-oriented "realistic" approach (people were complaining about trains racing uphill in original TTD), but simply to make different train sets comparable, in case their authors wanted to, i.e. by applying real numbers for weight, power and tractive effort.

regards
Michael
Image
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Trains accelerating too fast

Post by Terkhen »

Removing the call to GetAirDragArea adds another problem. The GroundVehicle::GetAcceleration function is shared by both trains and road vehicles. Therefore, not calling GetAirDragArea there reverts the air drag value of road vehicles to the one used by trains. Currently GetAirDragArea returns 120 for trains and 60 for road vehicles. To be consistent with your value (12) and to remove this issue, you could adapt GetAirDragArea to return 12 for trains (train.h) and 6 for road vehicles (roadveh.h).

Edit: The area value for road vehicles (half of the train area) was decided after some testing with high speed road vehicles. As long as the air drag area value allows a road vehicle to get to its maximum speed when using the default coefficient of air drag I don't mind changing it either.
Last edited by Terkhen on 30 Oct 2010 12:18, edited 2 times in total.
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: Trains accelerating too fast

Post by SirkoZ »

You should really make a switch in the above patch - TTPatch-compatible acceleration model, Uwe. ;-)

I've looked at the patch and it doesn't look too realistic - full of out-of-thin-air magic numbers.

That said - I'm completely satisfied with the current form of Realistic acceleration. It takes into account all the values new .GRF maker can provide, so the argument that different train-sets are not comparable is not valid.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Trains accelerating too fast

Post by michael blunck »

SirkoZ wrote:You should really make a switch in the above patch - TTPatch-compatible acceleration model, Uwe. ;-)

I've looked at the patch and it doesn't look too realistic - full of out-of-thin-air magic numbers.

That said - I'm completely satisfied with the current form of Realistic acceleration. It takes into account all the values new .GRF maker can provide, so the argument that different train-sets are not comparable is not valid.
You´re completely missing the point.

Problem is that (train) vehicles in OTTD are still acting quite "unrealistic", which is, firstly, not acceptable by "realism" players, and, secondly, causes problems both for players and grf authors when using them in both programs.

Uwe´s patch might need improvement, but that´s exactly the reason why he did post it here.

regards
Michael
Image
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1732
Joined: 30 Mar 2005 09:43

Re: Trains accelerating too fast

Post by peter1138 »

Reminds me of... http://iis.fuzzle.org/
He's like, some kind of OpenTTD developer.
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: Trains accelerating too fast

Post by Michi_cc »

Attached is a proposed patch that tunes the current OTTD realistic acceleration to make the acceleration "slower". Formulas and constants are conforming to real-life physics as far as the game allows. It doesn't try to imitate TTDPatch behaviour.

-- Michael Lutz
Attachments
accel.patch
git patch, use patch -p1
(7.74 KiB) Downloaded 108 times
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Trains accelerating too fast

Post by Terkhen »

I have been testing the performance of both implementations (using this patch). The difference between them and with current trunk is very small.

sloweracceleration: 99,46% of trunk time.
accel: 98,87% of trunk time.
Uwe
Transport Coordinator
Transport Coordinator
Posts: 353
Joined: 09 Jul 2004 14:05
Location: Germany

Re: Trains accelerating too fast

Post by Uwe »

I compared the patch by michi_cc with the behaviour of trains in TTDPatch, and it looks pretty convincing. I did a test with the BR 92 from DBSetXL (as posted by mb) and the behaviour looks pretty much the same in both the patch by michi_cc and TTDPatch. The only noticeable difference was that the train got stuck on an incline in TTDPatch, where it managed to get up with a crawling 9 km/h in OpenTTD - so it's pretty much the same. I also tested the BR 05 as fast express engine with a unrealistically long and heavy train, and it did not reach full speed in neither version. In fact, it was even a bit slower in OpenTTD. From my personal point of view, that's as comparable to TTDPatch's behaviour as I could want, since my main focus is a comparable acceleration in both variants of the game to make set creation and documentation easier.
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: Trains accelerating too fast

Post by Michi_cc »

The differences on slopes are expected as TTDPatch slopes are 5% and OTTD has 3% as default (but changeable via an advanced setting).

-- Michael Lutz
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Trains accelerating too fast

Post by michael blunck »

Michi_cc wrote:The differences on slopes are expected as TTDPatch slopes are 5% and OTTD has 3% as default (but changeable via an advanced setting).
I´d expect Uwe having been set the same slope value in his tests.

regards
Michael
Image
Uwe
Transport Coordinator
Transport Coordinator
Posts: 353
Joined: 09 Jul 2004 14:05
Location: Germany

Re: Trains accelerating too fast

Post by Uwe »

I just doublechecked on the slope setting, and it was at 5% to reflect the one used in TTDPatch. But as I already mentioned, the train almost stalls when going up that slope (barely reaching 10 km/h), which is fine by me.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Trains accelerating too fast

Post by Rubidium »

Given the the acceleration changes caused by this thread somewhat backfired; people complaining trains didn't reach their speed anymore, new changes to the acceleration are suggested. Please have a look at the discussion and binaries at http://www.tt-forums.net/viewtopic.php?p=921774#p921774 and tell us whether the trains are still acceleration slowly enough.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: ZaphodB and 42 guests