New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ships with max speed overflow to near-zero speed #8177
Comments
Ships Redfish has a Ideal and a Cheat speed. The ship work fine as long its going at an angle soon as it go in straight line hits 80 the ship just stops. can hit Stop and go it go until hits 80 again but only not at an angle tried it on 3 or so version including the newest 10.1 still same issue thanks. |
Okay so yes, the redFISH NewGRF has a setting to make ships faster, and the fastest ship (Mount Blaze Fast Ferry) has a specified speed of 128 km/h. This apparently causes an overflow somewhere, and causes it to move absurdly slow. That sounds like a real bug in OpenTTD. |
I believe this is as specified. Ship speed (prop 0B) is a byte property, measured in half km/h-ish, so the maximum representable value is 127km/h-ish. This is a known limition, as complained about by ekranoplan coders here. Road vehicles originally had the same limitation, but a new prop15 was added to allow higher maximum speeds. This has never been done for ships, presumably because very fast ships are rare. This may be a bug in NML if the grf specifies a constant speed above 127km/h and no warnings are given. |
The specified speed in the item-block is 60.0mph, but there is a callback that adjust the speed. I don't think NML supports unit-conversion in callbacks, but even if it does that is not used. RedFish returns 256 as speed value from the callback. OpenTTD stores that correctly in vcache.cached_max_speed. ShipAccelerate later casts this uint16 back to a byte when actually moving the ship. At max speed a ship moves exactly 1 unit per tick. To allow higher max speeds, ShipController would have to be called multiple times per tick. @hewimp On how to create your own NewGRF: start with https://www.tt-wiki.net/wiki/NMLTutorial, ask questions on https://www.tt-forums.net/viewforum.php?f=68. |
So either OpenTTD should be changed so this speed works, or OpenTTD should be changed so it reports a warning about the GRF being buggy. |
Version of OpenTTD
1.10.1 (and possibly others)
Expected result
Ships travel at specified speed.
Actual result
Ships with maximum possible speed (128 km/h) end up traveling incredibly slow.
Steps to reproduce
Start a game with the NewGRF redFISH 0.4, configure it to have ship speed "Cheating".
Set the game year past 2012, where the ship model Mount Blaze Fast Ferry should be available.
Build a Mount Blaze Fast Ferry and a Matsushima Hydrofoil and assign them to the same route.
Observe that the Fast Ferry appears to not move at all at normal game speed, and on fast-forward only moves one pixel every several days.
The text was updated successfully, but these errors were encountered: