Openrct2: Vehicle speed underflows when going backward only in openRCT2

Created on 21 Dec 2018  路  6Comments  路  Source: OpenRCT2/OpenRCT2

OS: Windows 10
Version: 0.2.1
Commit/Build: c457d1

When going forward there is a minimum speed of 1 km/h in all versions of the game. However, when going backward there is a minimum speed of 0 km/h in classic and vanilla, but in OpenRCT2 it will underflow to the minimum forward speed. Here are two examples:

Vanilla/Classic: https://www.youtube.com/watch?v=No22AJ7thXE

OpenRCT2: https://www.youtube.com/watch?v=HjKEKkZI3ZA

This has been in openrct2 since at least late 2016, which is when I first encountered it. For a long time I thought it a thing in vanilla as well but today someone found out it is not.

bug

All 6 comments

This first project of openrct2 maded in 2014 not 2016

This will be due to replacing some arithmetic shifts with divides

I would like to take a look at this any ideas where to start looking in the code?

@bdupree5 it will be very difficult to find where the problem is. Its to do with how the acceleration works at slow values. The code is very messy for this. vehicle.cpp is where the code resides.

Ill take your word for it. I don't really want to deal with messy code lol

I believe I found a fix for this. The negative velocity goes up from e.g. -6000 at an acceleration of 1 until it hits -4096, then the "magical implicit forward creeping boosters" kick in to speed up the train to +32k (~1km/h) even though they shouldn't while the train is moving backwards. I can send a simple PR next week that will keep the negative speed at -4095 (about 12.5% of the forward creeping speed) that should probably mirror the RCT2 behavior.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrtnptrs picture mrtnptrs  路  3Comments

Xaroth picture Xaroth  路  3Comments

Ryder17z picture Ryder17z  路  3Comments

Wirlie picture Wirlie  路  3Comments

Nubbie picture Nubbie  路  3Comments