Smoother realistic_acceleration

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

User avatar
sidew
Engineer
Engineer
Posts: 115
Joined: 31 Aug 2005 06:46
Location: Milan, Italy
Contact:

Post by sidew »

try:
svn://svn.openttd.org/tags/0.4.7

or Rrevision 4781

http://svn.openttd.org/cgi-bin/trac.cgi ... tags/0.4.7
Sidewinder

Italian Town names patch for OTTD (R5266) now in trunk since 0.4.8
For typo, errors or bug on OTTD italian translation, please PM me.
unofficial italian TTD/OpenTTD forum: http://wolf01.game-host.org/forum/index.php
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Nightly and Mini-IN versions of (TT-)original vehicle names and loco-speeds patches are here together.

P.S.: I've added the same patch for MiniIN r5720 which has the physics patch added, which off-sets some lines in /tables/engines.h.
It'll be added soon into MiniIN, as richk67 said. Thank you, Rich. ;)
Attachments
origveh_and_loco_hp_speed_r5477M.patch
diff
(17.97 KiB) Downloaded 354 times
origveh_and_loco_hp_speed_r5461.patch
diff
(17.97 KiB) Downloaded 339 times
origveh_and_loco_hp_speed_r5720_MiniIN.patch
diff
(18.61 KiB) Downloaded 381 times
Papegaaij
Engineer
Engineer
Posts: 34
Joined: 27 Oct 2004 22:49

Post by Papegaaij »

I'm trying to switch from a old nightly to the latest MiniIN without breaking my entire network. My network currently has about 800 trains running on a 512x512 map with a more-or-less realistic landscape. Minor changes in train handling can cause major problems on such a crowded network. The latest MiniIN contains the new realistic acceleration (V2.0) which causes my trains to run much slower. My network is designed for the old 'realistic_acceleration = true' which makes maglev trains accelerate quite fast. However there seems to be no way of reverting to this old behaviour.

I would really like to continue with this game, but also enjoy the new features of the MiniIN, however redesigning my entire network just to make it compatible with the new acceleration is just too much work (if it is even possible). Would it be possible to still include the old (not-so) realistic behaviour?
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Yes - the old real_acceleration is still in there, just go to Patches >> Vehicles and turn OFF the RA-T (Realistic acceleration for trains) - that ought to give you my old real_acceleration patch.

By the way - in future it is better to write the inquiries about MiniIN in MiniIN thread - General OpenTTD >> MiniIN, because I only made the "old" real_acceleration patch. Some other player has written the 2.0 realistic acceleration patch.
Papegaaij
Engineer
Engineer
Posts: 34
Joined: 27 Oct 2004 22:49

Post by Papegaaij »

Thanks. I've enabled the SRA-T option, which seems to be the closest to what it was in my old version. Trains still accelerate a little slower than they used to, but now it is something I can fix in my network :)
hertogjan
Director
Director
Posts: 560
Joined: 03 Jan 2006 20:45
Location: Netherlands

Post by hertogjan »

Papegaaij wrote:(...) Trains still accelerate a little slower than they used to, but now it is something I can fix in my network :)
I know what causes the trains to accelerate slower, and who is responsible for it. :mrgreen:
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Oh you do now, don't you?

BTW - is my patch still in (I haven't checked for a while) - please restore it into the old behaviour if possible. ;)
Papegaaij
Engineer
Engineer
Posts: 34
Joined: 27 Oct 2004 22:49

Post by Papegaaij »

Unfortunately the difference in behaviour is too big to update my network. I'm afraid I'm stuck with my nightly :( Even the smallest difference in acceleration distroys the working of all my major junctions. Isn't there any way to revert to the old behaviour?

I've just tested the difference: a fully loaded goods train (Chimaera with 12 cars) accelerates from 0 to 640km/h over a length of 33 squares with the old version. With the new version it reaches only 540km/h in 33 squares and it wasn't even able to reach 640 on my quite long (straight) test track. Maybe you can point me to the source files that have changed, so I can restore the old acceleration for maglev trains?
Papegaaij
Engineer
Engineer
Posts: 34
Joined: 27 Oct 2004 22:49

Post by Papegaaij »

Is it correct that this might be the change I'm looking for:

Code: Select all

} else {
  //"kickoff" acceleration
  force = (mass * 12) + resistance;
}
Which is in my version:

Code: Select all

} else {
  //"kickoff" acceleration
  force = (mass * 8) + resistance;
}
To me that seems as if the influence of the weight on the force has been increased. But as many lines have changed (the diff for train_cmd.c is 2367 lines) I'm not sure if this is the only thing that changed.
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 622
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Post by glx »

This part is only used to make the train start (at green signal or in stations).
Papegaaij
Engineer
Engineer
Posts: 34
Joined: 27 Oct 2004 22:49

Post by Papegaaij »

glx wrote:This part is only used to make the train start (at green signal or in stations).
I see it (only when speed=0). So it should only help a really tiny bit :(

From what I can see the code for the train acceleration changed quite a bit between the version that was removed in 5757 and added back in 6397. I've just tested the nightlies and it still has the old behaviour, so it is something with the MiniIN.

hertogjan, as you wrote the code, can you tell me where the change might be?
hertogjan
Director
Director
Posts: 560
Joined: 03 Jan 2006 20:45
Location: Netherlands

Post by hertogjan »

There is a conversion from km/h to mph*, which I removed since the whole game works internally in km/h, not mph. But I'm not sure how it was meant to work, since the realistic acceleration function (which still exists in trunk) is poorly coded, and on top of it, poorly documented. So it is very hard to figure out what is happening, or what should be happening; let alone: why it is happening.
That was one of the main reasons I wrote a realistic acceleration function myself.


*There should be something in the code that says

Code: Select all

int speed = v->cur_speed; //[mph]
(...)
speed *= 10;
speed /= 16;
(Note the comment on the first of those lines.)
I removed the last two lines of those. But if anyone can prove that this is a mistake, then those lines may be readded.
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Papegaaij wrote:Is it correct that this might be the change I'm looking for:

Code: Select all

} else {
  //"kickoff" acceleration
  force = (mass * 12) + resistance;
}
Which is in my version:

Code: Select all

} else {
  //"kickoff" acceleration
  force = (mass * 8) + resistance;
}
To me that seems as if the influence of the weight on the force has been increased. But as many lines have changed (the diff for train_cmd.c is 2367 lines) I'm not sure if this is the only thing that changed.
Yes, that is just what it says - a kick of - if that number * mass is low, the slower a train will "start to move" or "kick-off" - it'll be visible as a "jerk". :)
Papegaaij
Engineer
Engineer
Posts: 34
Joined: 27 Oct 2004 22:49

Post by Papegaaij »

hertogjan wrote:There is a conversion from km/h to mph*, which I removed since the whole game works internally in km/h, not mph.
..cut..
I removed the last two lines of those. But if anyone can prove that this is a mistake, then those lines may be readded.
I did see those lines. The lines seem to convert a km/h speed to mph (divide by 1.6). So I guess if v->cur_speed is in km/h then they are correct, if speed is supposed to be mph. However it's strange that this part of the code works with mph while the rest works with km/h. I'll try adding those lines back in and see what happens.
Papegaaij
Engineer
Engineer
Posts: 34
Joined: 27 Oct 2004 22:49

Post by Papegaaij »

Ok, that did it. Trains are running as they should again. Now I only need to change some orders due to differences between YAPF and NPF. Thanks!
hertogjan
Director
Director
Posts: 560
Joined: 03 Jan 2006 20:45
Location: Netherlands

Post by hertogjan »

Maybe I will post a patch this week with a new version of that function that "fixes" all the effects caused by code changes elsewhere, i.e. it should act as it was meant to act when it was written. But first I will have to investigate what changes may have affected it.
Papegaaij
Engineer
Engineer
Posts: 34
Joined: 27 Oct 2004 22:49

Post by Papegaaij »

That would be really great! With the conversion back in I still notice a small difference. Trains now reach 643km/h in stead of the 640 they should, but I'm not complaining about that :)
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Oh - don't worry 'bout 640/43 it's a purely unit-issue. :)
Not to mention - I did set it to 643 with my vehicle_names_powers_and_speeds patch, so it's like in the TTD. ;)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 42 guests