@SorFox, @Knighttime and I have been discussing the game's ID numbers for units recently. This is important for saving information about specific units in the state table. I had always assumed that the game might move around unit id numbers, and so saving them was unreliable (and so, not to be used for 'important' things). I never tested this.
Via lua, I created 2200 Roman warriors. I created a few Japanese legions to kill them, and printed the id numbers of all legions before the attack and after saving and loading the game. The game did not change the id number of the legions, despite such massive numbers of no longer needed unit spaces, so I would tentatively conclude that the game does not 'compact' unit id numbers when saving.
Short of recording a list of all the units in the game every turn and seeing if something changed 'unexpectedly', I'm not sure what other kind of experiment could be run. If anyone has any ideas, I'd be happy to hear them. The trouble is that if the game messes with the unit ID numbers, and someone uses them as if they are fixed (as long as the unit stays alive), it could lead events to fail in ways that are not easy to debug.
Via lua, I created 2200 Roman warriors. I created a few Japanese legions to kill them, and printed the id numbers of all legions before the attack and after saving and loading the game. The game did not change the id number of the legions, despite such massive numbers of no longer needed unit spaces, so I would tentatively conclude that the game does not 'compact' unit id numbers when saving.
Code:
for unit in civ.iterateUnits() do if unit.type == civ.getUnitType(5) then print(unit.id) end end
112
213
714
715
1216
1717
Short of recording a list of all the units in the game every turn and seeing if something changed 'unexpectedly', I'm not sure what other kind of experiment could be run. If anyone has any ideas, I'd be happy to hear them. The trouble is that if the game messes with the unit ID numbers, and someone uses them as if they are fixed (as long as the unit stays alive), it could lead events to fail in ways that are not easy to debug.