Jump to content
OpenRCT2
KKLD

Car Length of rides

Recommended Posts

I was replaying the good old RCT scenarios in ORCT2 and I got reminded about this. How come it is possible for the exact same ride in RCT to have 8 cars per train whereas it is only possible to have 7 in ORCT2 (and RCT2)? I have attached images below. I think it would come in handy if we could remove those limits and have an "unlimited" amount of trains and car per train, like we can have unlimited lift speed. Is it possible and am I just missing something, or is it just not possible?
I remember that with 8cars per trainer we could edit all rides to bypass such limits.

SCR1.png

ORCT2.png

  • Like 1

Share this post


Link to post
Share on other sites

As far as I know it was never possible to have more than 7 cars on any vehicle. This is probably because only 3 bits are used for the number, but I am only guessing here, so I might be wrong.

Share this post


Link to post
Share on other sites

I suppose it wasn't stored as 3 bits in RCT since it is possible to have 8 cars per train as shown in my screenshot (unless it wasn't zero-indexed?). I know for a fact that the number of trains can go up to 31 (at least), so it could be likely that it is the same case with cars, but this is purely me speculating. Speaking of speculation, I wonder if it is possible to change this very easily like changing just the number in the code, but my instincts tell me no because then it probably would have been done were it so easy to do. Maybe I am just naive, I must admit that I don't know how to code, unfortunately.

Share this post


Link to post
Share on other sites
8 hours ago, Broxzier said:

As far as I know it was never possible to have more than 7 cars on any vehicle. This is probably because only 3 bits are used for the number, but I am only guessing here, so I might be wrong.

I'm not so sure about that. Floorless twister train can have 8 cars and Hyper-Twister (wide) can have 9 cars (10 if you include lead car without passengers).

Share this post


Link to post
Share on other sites
9 hours ago, Broxzier said:

As far as I know it was never possible to have more than 7 cars on any vehicle. This is probably because only 3 bits are used for the number, but I am only guessing here, so I might be wrong.

That's the reason the "8-Cars" trainer got it's name. It had a cheat option to re-enable 8 cars on trains. This function also made it possible to have 1 car trains on lim coasters and such wich normaly require 3 or more.

Share this post


Link to post
Share on other sites

The limit is definitely not 8 cars, even without hacks. The articulated wooden coaster trains support up to 12, for a start. I've tested trains with up to 30 cars, and I wasn't able to get higher than that without crashing the game, but I'm still not 100% sure this is the absolute limit. There is no cheat to remove the limit as of yet but it's not impossible to implement one - I'm not sure where this "stored in 3 bits" is coming from because as far as I can tell, it's an 8 bit value.

  • Like 1

Share this post


Link to post
Share on other sites
14 hours ago, X7123M3-256 said:

The limit is definitely not 8 cars, even without hacks. The articulated wooden coaster trains support up to 12, for a start. I've tested trains with up to 30 cars, and I wasn't able to get higher than that without crashing the game, but I'm still not 100% sure this is the absolute limit. There is no cheat to remove the limit as of yet but it's not impossible to implement one - I'm not sure where this "stored in 3 bits" is coming from because as far as I can tell, it's an 8 bit value.

I tried your 30 cars, it works fine in the original RCT2. Unfortunately it crashes when you try to build it in ORCT2. However it works if I load a saved game with the ride in RCT2 and open it up in ORCT2 it works! But if you click on the ride the game instantly crashes. It's quite fun having a 30 car length ride :D 

Do you think it's possible for you (or anyone else) to make ORCT2 stop crashing, or even better add a cheat option to the menu to allow more trains and cars? (set 

Edited by KKLD

Share this post


Link to post
Share on other sites

It works fine for me in OpenRCT2 (I haven't even tested in vanilla), but make it one car longer and it crashes. I have not yet looked into why it crashes. It is definitely possible to implement a "remove train length limits" cheat, and I might look into doing that, along with an option to change the friction value used for the ride. The method I use for this at the moment involves making a new .DAT file, but the change need not be permanent - you can restore the original limit and the cars already on the circuit will not be shortened.

Share this post


Link to post
Share on other sites

The game takes into account 3 things when determining how long the trains can be, in this order:

  • The max train length set in the file
  • The total friction of all the cars on the track
  • The length of the station
  • The minimum train length

The relevant code is here. The key point is that the minimum train length is the last thing calculated, so if the minimum train length is set to 30 then the trains have to be at least that long, even though the game won't allow a station long enough to accomodate them. Strangely, looking through that code again I see that the min and max train lengths are packed into a single 8 bit value with 4 bits each, so I'm not quite sure why a value of 30 worked - has that changed since I did this?

Share this post


Link to post
Share on other sites

The only change to this part of code this year was labelling of some fields, so it has not been touched recently.

I still don't know how do you make 30/31 cars?

Share this post


Link to post
Share on other sites

I set the minimum and maximum train length field to 30. That's all there is to it. An interesting thing is that the game doesn't validate train lengths on load, so you can tweak the DAT, build a ride with absurdly long trains, then restore the original DAT and still load your park - as long as you don't close and reopen the ride, you keep your long trains. Same for friction values - I've thought about implementing it as a cheat to cut out the need to change DAT files entirely.

I retested the 30 car trains and they crash now, so something's changed, but possibly not in this part of the code. The 15 car versions still work, so I'm not sure what the new limit is but given that it's getting packed into a 4 bit value at one point I assume it's just coincidence that 30 cars worked before. I'll have to investigate a bit more to see what the root cause of the crash is.

Share this post


Link to post
Share on other sites

OK, I've loaded your 30-cars file and I'm sorry to say it relies on undefined behaviour – which will also likely be cause of your crash. I will have to create a change to limit that, from the initial look of things 16 is the hard limit.

Share this post


Link to post
Share on other sites

Not surprised 16 is the hard limit after actually looking at the code - I'm not sure why it worked before but now it just hangs the game and I have to kill it. There's no real use for trains this long anyway, so it's not a serious issue.

Share this post


Link to post
Share on other sites

I'm getting a merge conflict, which I think is because I have local changes (I was messing with the track code again). I've tried running git reset --hard and then pulling the latest version, but it still doesn't work. Is there a way to reset everything back to the current version of the code?

Edited by X7123M3-256

Share this post


Link to post
Share on other sites

Sure.

# assuming https://github.com/OpenRCT2/OpenRCT2/ is your origin
$ git checkout develop
$ git reset --hard origin/develop
# you can also fetch and checkout (in detached HEAD mode) that specific commit:
$ git fetch origin refs/pull/3179/head
$ git checkout FETCH_HEAD

 

Share this post


Link to post
Share on other sites
2 hours ago, janisozaur said:

I may have spoken too soon, as I have found a way to safely support (i.e. not crash or enter some infinite loop) such modified rides. Can you please check https://github.com/OpenRCT2/OpenRCT2/pull/3179

Unfortunately I don't know how to code, although I can't help but wonder why the initial limit was set to 16 and why changing it to 32 should fix it. The Log Flumes, Splash Boats, Car Ride and some other rides support 31 boats/cars. If it is an 8 bit value why not change it to 255/256 when you are at it? I feel like there is something obvious I am not getting xD

 

And talking about a cheat to enable longer cars; is the only thing required to disable these 4 checks? If that is the case, I suppose it is not among the most difficult and time consuming things to do. But as I said, I am not a developer so I might be wrong about all this.

3 hours ago, X7123M3-256 said:

The game takes into account 3 things when determining how long the trains can be, in this order:

  • The max train length set in the file
  • The total friction of all the cars on the track
  • The length of the station
  • The minimum train length

The relevant code is here. The key point is that the minimum train length is the last thing calculated, so if the minimum train length is set to 30 then the trains have to be at least that long, even though the game won't allow a station long enough to accomodate them. Strangely, looking through that code again I see that the min and max train lengths are packed into a single 8 bit value with 4 bits each, so I'm not quite sure why a value of 30 worked - has that changed since I did this?

 

Share this post


Link to post
Share on other sites
Just now, KKLD said:

I can't help but wonder why the initial limit was set to 16 and why changing it to 32 should fix it.

 

In the ride_entry struct, they're 8 bit values. But during the calculation of the max train length, those two values get copied into a single 8 bit variable, which gives 4 bits each for a maximum of 15. I think that's the issue here, but janisozaur is the better person to answer becasue he implemented the fix.

 

Just now, KKLD said:

The Log Flumes, Splash Boats, Car Ride and some other rides support 31 boats/cars.

 

The number of trains and the number of cars per train are not the same thing. All those rides are limited to individual cars.

 

Just now, KKLD said:

And talking about a cheat to enable longer cars; is the only thing required to disable these 4 checks?

As far as I can tell, yes. This doesn't look like a difficult thing to implement, but it's hard to be sure until I've tried it - I don't know the codebase as well as the developers do.

Share this post


Link to post
Share on other sites

Thanks for your replies :)

While we are add it, what about increasing the maximum amount of trains? Is this something that is convenient and would make sense?

And what about increasing the maximum station length to accommodate longer trains (and more trains)?

Share this post


Link to post
Share on other sites

Kkld it's actually much harder to increase the total number of trains than the number of cars. A train is a linked list of cars but a ride has a fixed array of trains. Linked lists can be as long as you like fixed arrays cannot. You can't increase the array size without breaking compatibility with sv6 saves.

  • Like 1

Share this post


Link to post
Share on other sites
30 minutes ago, X7123M3-256 said:

I've managed to get trains of 255 cars working

I just giggled a little looking at that picture hehe. May I ask how you did that?
I read your comment on Github as well and was wondering how you managed to go all the way up to 255 from 64 because you said 64 was the limit in the drop down menu.

I hope that I am at the right place to ask these kinds of questions that must seem quite trivial to you developers. I am trying my best to learn so I just signed up on Github, set everything up with Visual Studio and managed to change some things in ride.c that enabled me to have more cars and trains (varying amount per ride) on rides although with some minor problems that I won't bother you guys with :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...