1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Querying the current gamestate

Discussion in 'Civ5 - Creation & Customization' started by trevor_plays_civ, Apr 21, 2020.

  1. trevor_plays_civ

    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!
     
  2. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,744
    Location:
    Illinois, USA
    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.
     

Share This Page