Scenario and Modding?

Joined
Feb 3, 2011
Messages
608
Hello

I have never tried making a scenario before, so I am confused about something.

When I working on a mod, whenever I change something significant - like add a new building or remove a unit, the previous save game is no longer compatible, so I have to start a new game.

So If am making a scenario - like placing pre-made cities, improvements, units, but still modding the game at the same time - I understand that scenario file will get ruined every time I change something significant?
I could complete the mod first and then make a scenario, but what I need to tune something later?
How do you handle this?

Thanks!
 
As far as I know, scenario files are fine with incremental changes to existing buildings, units etc. You may run into issues if you remove something that is still referenced in a scenario files, which depending on the circumstances may lead to either a crash or an error message on startup. But if your goal is to add more content as you work on the mod that should remain compatible with an existing scenario file.
 
While I haven't worked much with scenario files, I would say they are much more resistant to xml changes. Let's take a look at the format.

Code:
BeginTeam                        
   Tech=TECH_MINING                        
   Tech=TECH_MYSTICISM                        
   Tech=TECH_FISHING
It's fairly simple. It's text based. The game needs an index, meaning on load it reads TECH_MINING, then it looks up the index for that string, saves that index and moves on. If the index changed between creation and load, then it won't even know it and just use the new index.

Savegames on the other hand saves the index, meaning it just saves a number. If you save 14, quit, add a new item to the top of the list and then load, it will load 14, but what you wanted it to be is now 15, hence you load what was 13. The savegame now loaded garbage data. Even worse it saves lists of various things. For instance if it saves a list of killed units. We use a mod with 100 units in xml, meaning it saves 100 numbers of 4 bytes each or 400 bytes. On load it loads 101 because that's what in xml on load and it reads 404 bytes. Because it reads a different number of bytes than it wrote, the number of bytes in the savegame and what it expects to read suddenly no longer matches and the savegame becomes unreadable.

There have been multiple attempts at dealing with this issue (one of them by yours truly in Medieval Conquest) and while it can be done, it's a major DLL modding task. Even worse it has to be written for one mod specifically, meaning if one mod can do it, moving the code to anther mod is not a major gain compared to writing it all over.

If you want to read more about savegame format and debate about how to implement a savegame format, which can survive xml changes, We the People debated it here.
 
Back
Top Bottom