Querying the current gamestate

trevor_plays_civ

Chieftain
Joined
Jun 29, 2019
Messages
1
Hi all,

New to modding and the internals of the game in general. I've been looking through the SQLite tables to get a basic understanding.

How does Civ5 store the current gamestate?

For example, if I open a single player game, where does the game store the reference for the world that was just generated, the fact that I have a settler and warrior, and where those units are on the map?
Is it possible to query this information?

Thanks!
 
All needed data is stored in binary form in the save file for a saved game. This includes the game map.

You can hack the save file and read the binary data, and some people have in fact figured out how to do this for such things as extracting a game seed number for the map, but in order to query information like that outside of the game environment you would need to build your own software app that would open save files and grab the desired information from the binary data of the save file.

In order to query where a unit is when running the game you would have to use an lua function in the firetuner "execution console" to retrieve that information and drop it into the lua log, or you would need to run an lua "gameplay" script that would record desired information to the game's lua log. You would have to copy the lua log to another location as soon as you exit the game however, since when the game is started part of that startup from the main menu to "ingame" status is a wipe of the previous copy of the lua log.
 
Back
Top Bottom