Ever wondered why some kingdoms expand while others do not, or how prices change over time? Or what happens if you buy all the food, or kill all the lords? I did... so I came up with an idea:
A mod that periodically snapshots the state of the world, and records those snapshots in the save (in such a way that doesn't require the mod to be present to load it). Then, whenever you feel like it, you can then dump all that recorded information to XML, and then process it to your heart's content: graph it, query it, upload it into a relational database and do OLAP etc. So you could e.g. compare prices on wheat in Rovalt against the same in other towns over time, and how it is affected by villages being looted, or bandit activity. Stuff like that.
Here's a screenshot demonstrating a prototype I whipped up:
Now, what is the "state of the world", exactly? That's where I need feedback! In theory, the dump can contain everything; but, obviously, some things are more useful than others - and all of them take up space! The prototype that I have right now dumps a lot of stats for all the settlements. Here's what it looks like once exported to XML:
Inside the save, data is stored much more efficiently than XML would allow, utilizing string tables and variable-length encoding for numbers. Still, it's a lot - as you can see from the screenshot, with this prototype, a single snapshot containing all the data you can see in the gist takes up around 100 kilobytes. So, about 8.5 megabytes of data for each year of the game, if snapshots are recorded daily. It'll be a lot more once I add kingdoms, clans, parties etc - especially parties. For this reason, I'll probably make some of it configurable - but I still need to implement the logic to save whatever needs to be saved.
So, if you are interested in something like this - what kind of data would you want in the snapshot?
Also, if you have any feedback on the structure of output XML, that would also be helpful. I'm definitely sticking to XML over JSON here because of the wealth of mature tools in that ecosystem: schemas, XSLT, XQuery etc; and it can be trivially converted to any other format if necessary. But the specific elements etc are open to amendments. As it is, it mostly follows the internal structure of the game.
A mod that periodically snapshots the state of the world, and records those snapshots in the save (in such a way that doesn't require the mod to be present to load it). Then, whenever you feel like it, you can then dump all that recorded information to XML, and then process it to your heart's content: graph it, query it, upload it into a relational database and do OLAP etc. So you could e.g. compare prices on wheat in Rovalt against the same in other towns over time, and how it is affected by villages being looted, or bandit activity. Stuff like that.
Here's a screenshot demonstrating a prototype I whipped up:
Now, what is the "state of the world", exactly? That's where I need feedback! In theory, the dump can contain everything; but, obviously, some things are more useful than others - and all of them take up space! The prototype that I have right now dumps a lot of stats for all the settlements. Here's what it looks like once exported to XML:
Inside the save, data is stored much more efficiently than XML would allow, utilizing string tables and variable-length encoding for numbers. Still, it's a lot - as you can see from the screenshot, with this prototype, a single snapshot containing all the data you can see in the gist takes up around 100 kilobytes. So, about 8.5 megabytes of data for each year of the game, if snapshots are recorded daily. It'll be a lot more once I add kingdoms, clans, parties etc - especially parties. For this reason, I'll probably make some of it configurable - but I still need to implement the logic to save whatever needs to be saved.
So, if you are interested in something like this - what kind of data would you want in the snapshot?
Also, if you have any feedback on the structure of output XML, that would also be helpful. I'm definitely sticking to XML over JSON here because of the wealth of mature tools in that ecosystem: schemas, XSLT, XQuery etc; and it can be trivially converted to any other format if necessary. But the specific elements etc are open to amendments. As it is, it mostly follows the internal structure of the game.