Repository navigation
Conversation
…working. ALife object ids were 16-bit, so a game could not create more than 65535 entities. They are now 32-bit, with 65535 kept as the invalid and parentless id and the live range capped so a bad id cannot index off the client map. Script-facing names are unchanged. New saves record the wider ids with a new alife version for registry keys and spawn version 130 for memory, helicopter, and related refs. Older saves still read those fields as 16-bit. Spawn version 129 keeps the ids that were already widened. Readers stop at the end of a client blob so a corrupt count cannot walk off the buffer. Death, trade, holder, grenade, and bullet initiator packets carry the full id on both sides. The multiplayer kill feed stays 16-bit.
|
Vanilla scripts and 3rd party mods use 65534 and 65535 magic values in loops or for checking invalid ID. This change will break them and make them ignore newly created items with IDs past 16 bits. I also don't want to maintain AI code of this scope, so i close this |
Fair enough. It is more of a proof of concept at this stage since the change is quite large. If nothing else it showcases the amount of changes that is required to do this migration. I do want to note that 65535 is treated as a magic value in my change as well. I did miss 65534 however so I did a commit to add that. Thanks :-) |
…working.
ALife object ids were 16-bit, so a game could not create more than 65535 entities. They are now 32-bit, with 65535 kept as the invalid and parentless id and the live range capped so a bad id cannot index off the client map. Script-facing names are unchanged.
New saves record the wider ids with a new alife version for registry keys and spawn version 130 for memory, helicopter, and related refs. Older saves still read those fields as 16-bit. Spawn version 129 keeps the ids that were already widened. Readers stop at the end of a client blob so a corrupt count cannot walk off the buffer.
Death, trade, holder, grenade, and bullet initiator packets carry the full id on both sides. The multiplayer kill feed stays 16-bit.
I have tested on my own GAMMA 0.9.5 save game and it is stable and works on saves created with 16-bit objectId. However it will not create save files compatible with old version since it is now writing 32-bit values.
I have tested spawning items until I break the old limit and the game continues working. The job of testing that it is 100% stable and works throughout a whole run is a bit daunting to me. Thus, accepting this change does come with plenty of testing added to the backlog due to its size but I want to present it to you anyway since this kind of limitations makes me more a bit anxious when we start more than halfway to the limit upon starting a new play through (even with the re-usage mechanic).
The change set is very large due to how heavily integrated the old objectId is in the source.
Note that I used AI assist (Grok 4.7 Extra High) to produce this change. I had to do extensive testing to get the code to a state where I could detect no more issues so it was not a "one prompt" solution fire and forget.