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

New and improved TableSaverLoader for persisting Lua data through game exit/load

Discussion in 'Civ5 - Creation & Customization' started by Pazyryk, Jul 14, 2014.

  1. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    Version 0.14 is posted in TableSaverLoader's thread. I'm posting here since the thread update will likely slip by unnoticed (as will this post if I don't get a friendly bump ;)).

    For those that don't know, TableSaverLoader provides a way to persist Lua table data through game save/load.

    For existing users of TableSaverLoader, it's worth updating for the speed increase, which is quite substantial over older versions. For 1800 persisted data elements in Éa with ~100 changing each turn, TableSave takes 0.016 seconds on my computer. And you only pay that overhead at game save (unlike SaveUtils where you pay serialization overhead each time you change some data).

    The OP also describes how to (successfully) intercept game saves using Lua only, which has been an ongoing headache and the hardest part in using TableSaverLoader. Alternatively for dll modders, I've provided code for a GameEvents.GameSave hook that fires before the dll serializes Civ5SavedGameDatabase.db into the Civ5Save file.

    Feel free to ask general questions here, or specific installation questions in the mod's thread.
     
  2. ExpiredReign

    ExpiredReign Deity

    Joined:
    Jan 3, 2013
    Messages:
    2,450
    Gender:
    Male
    Location:
    Tasmania
    A friendly bump. :D
     
  3. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,127
    Location:
    Illinois, USA
  4. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    Great!

    I think some modders got scared away before due to the messiness of catching game saves. I didn't really know how to intercept autosaves (which normally happen in barb turn after unit moves) and I had you modding SaveGame.lua to deal with regular saves. But now I've figured out how to catch all saves successfully with Lua only and adding code in one place only - so it's much simpler now. (And if you are a dll modder, it's even easier with a GameSave event that I describe.)
     

Share This Page