Openrct2: RCTC parks can have more than 10000 sprites

Created on 29 Sep 2017  路  21Comments  路  Source: OpenRCT2/OpenRCT2

A user has provided a save with (supposedly) 14441 guests from RCTC. Sure enough, trying to load it up in OpenRCT2 results in the error message "Tried getting sprite 14293".

Download is here: https://www.dropbox.com/s/w09jqcnxml7i5cz/Forest%20Frontierstest_big.sv6?dl=0

I don't know _how_ they do it.

information

Most helpful comment

Oooh, I think I found it!

There are 6 chunks in a saved game. Chunk 6 was longer than our hardcoded value: our value is 3048816, the file said 4328816. The difference is 1280000 bytes. An rct_sprite is 256 bytes. Divide the first by the second and you get 5000.

So I tried modifying MAX_SPRITES and RCT2_MAX_SPRITES to 15000 and adjusted the hardcoded length. And now it loads!

forest frontiers 2017-10-30 14-48-04

Another thing that stood me out:

  • RCTC-CV-NormalSprites (which loads without modification) has classic flag 0x7.
  • RCTC-HighSprite has classic flag 0xF.

So we can distinguish between the two.

All 21 comments

What happens when you try loading it in vanilla?

I'd have to try that when I'm back home.

Does RCTC still use .sv6? Well if so then they have extended the format. You will probably find the chunk formats are more or less the same to be compatible but they have reserved more sprite entries.

Given this limit is not due to how many bits are needed for indexing, it can be easily increased.

Given this limit is not due to how many bits are needed for indexing, it can be easily increased.

Could you explain this further? I thought there was a fixed limit?

I think there is a chunk just for sprites, so you could allow extra data in that chunk and it wouldn't cause any problem for chunks after to be read. Alternatively they may add additional chunks to the file.

Sprite index is a 16-bit uint, so the theoretical limit is 65355.

    // SC6[5]
    rct_map_element map_elements[0x30000];

    // SC6[6]
    uint32 next_free_map_element_pointer_index;
    rct_sprite sprites[RCT2_MAX_SPRITES];
    uint16 sprite_lists_head[6];
    uint16 sprite_lists_count[6];
    rct_string_id park_name;
    uint8 pad_013573D6[2];
    uint32 park_name_args;

Doesn't look like that to me.

Does the sv6 have more chunks than we read?

How can I check that?

You could write a program that just lists all the chunk headers.

Can I not just modify the OpenRCT2 source? And how would I list the chunk headers?

You can use SawyerChunkReader and read ReadChunk. That gives you back a chunk object with information and data which you can write out to stdout.

Let's assume we find out what's this about. Let's also assume, for sake of compatibility, we make changes that would allow loading those new sv6 files (which probably shouldn't be called sv6). Right now we only export into true sv6, with 10000 objects limit. Obviously, we won't be able to export sv6 with 14441 objects in it, so that begs a question: how far do we go to support the new sv6?

Do we allow exporting it as a new format, effectively raising limits?

How do we communicate the park is no longer saveable as true sv6? Will there be a in-game warning?

Opening in vanilla gives me a "file contains invalid data" error.

which probably shouldn't be called sv6

One _could_ argue that it's up to CS to determine if a file is sv6 or not.

If we decide to allow opening/saving these sv6-ish files, we could choose to only allow this when the 'classic flag' is set (and set it ourselves when exporting).

I'm not sure if we should stick with the current roadmap - all of this wouldn't be much of a problem if we used our own format (or were close to using it).

I have submitted this thread: https://www.reddit.com/r/rct/comments/7376s0/discussion_sv6_format_compatibility_in_light_of/ to discuss issues regarding sv6 format.

What are the requirements for this new format. Can it only work in OpenRCT2 with RCTC as base game or does it work with the original RCT2 as base game as well, if so, does it require RCT1?

My first suggestion would be to just use the save file version for whatever version is installed, or the version that the save file you opened is in. But if there's no compatibility between the installs then users cannot share these files without causing a lot of confusion. If they are compatible then it is fine and I think that would be the best solution.

If not it would probably be best to keep the old version since it is the most compatible of both. Preferably with the option for users with RCTC to change their file to the RCTC way of doing things.

It does not have anything to do with the origin of the game assets.
The thing here is that RCTC exports files that have more sprites than SV6 would normally allow, thus violating the spec.

Hey guys, I was the one who wasted my time experimenting with this. It's worth noting that the ride limit is still 255. The "per-ride station limit" is still 4. I believe that only the sprite limit was raised. Honestly, I don't know why they would raise the limit for a game that was originally intended to run on mobile devices.

https://i.imgur.com/tJDH8gZ.png

Save: https://www.dropbox.com/s/rx32e1z9wpvq902/Forest%20Frontierstest_big-2.sv6?dl=0

I can confirm that you can not load a saved game from RCT:C after it has gone above the sprite threshold, even if it's below the sprite limit that should theoretically work in OpenRCT2. However, if you convert the save with RCTC at 9,601 guests and load it in OpenRCT2 it will work, presumably due to not going over the sprite threshold.

One last thing to note is that saves that do go above the original sprite limit are bigger.

Saves for testing:
ORCT2 Max Limit (Not converted) - https://www.dropbox.com/s/6bakpr69z1if9tu/FF%20test2-originalopenrct2.sv6?dl=0
RCTC Converted Save with 9,601 guests (ORCT2 Limit): https://www.dropbox.com/s/y8vka1zdpyki7w9/FF%20test2-RCTC-CV-NormalSprite.sv6?dl=0
RCTC Converted Save with higher than 9,601 guests (9,629): https://www.dropbox.com/s/fh08ynscrzpn8lj/FF%20test2-RCTCHighSprite.sv6?dl=0
RCTC Converted save with 9,202 guests: https://www.dropbox.com/s/pps7tbsiwyg649v/FF%20test2-RCTCNormalSprite.sv6?dl=0

Hope this proves useful!

HighSprite seems to contain a longer 6th chunk. It does not contain an extra one.

Oooh, I think I found it!

There are 6 chunks in a saved game. Chunk 6 was longer than our hardcoded value: our value is 3048816, the file said 4328816. The difference is 1280000 bytes. An rct_sprite is 256 bytes. Divide the first by the second and you get 5000.

So I tried modifying MAX_SPRITES and RCT2_MAX_SPRITES to 15000 and adjusted the hardcoded length. And now it loads!

forest frontiers 2017-10-30 14-48-04

Another thing that stood me out:

  • RCTC-CV-NormalSprites (which loads without modification) has classic flag 0x7.
  • RCTC-HighSprite has classic flag 0xF.

So we can distinguish between the two.

Was this page helpful?
0 / 5 - 0 ratings