[GS] GameInfo nil value - Trying to get Gedemon's HSD working in GS

JWizzleWaggle

Chieftain
Joined
Oct 25, 2016
Messages
15
Hey all!

I've been a lurker for literally more than a decade, but Civ mods are a big part of why I went into software engineering for my career. I loved Rhye's Civ 4 overhaul, and I've been eagerly waiting for a similar mod for civ6. Gedemon's got their big project, but as far as I can tell, historical spawn dates aren't a priority. So I'm going to try my hand at it. All this to say: I'm a good dev, but very much a beginner in civ 6 modding.

Lua's giving me a hard time with populating the GameInfo.HistoricalSpawnDates when I copy over the scripts into my own project, even though my project config is identical to the original I'm forking off. Apparently that's still nil when I'm calling it.

I'm kinda pulling out my hair. How do I debug this? Is there a place with some documentation on what GameInfo is, what its properties are, and how to populate/debug it?

TL;DR
A function under GameInfo is nil even though I'm populating it through the In-Game actions.
What is the best way to debug this?
 
GameInfo contains all the tables created (and later populated) when the game is launched and copied in a database in the game's cache folder (in "My Documents\My Games\Sid Meier's Civilization VI") for debugging, if GameInfo.HistoricalSpawnDates is nil when you try to access it from Lua, it means that the HistoricalSpawnDates table was not created.

In my mod it's done in a small sql file called Table.sql, check that this file is listed in the modinfo, check for errors in the database.log (also found in the game's folders under "My Documents"), and check modding.log for what's loaded at the time of the error in database.log (you can refer to timestamps from both log)
 
I also recommend using SQLiteStudio for viewing your values, it's a useful tool that helps you find thing such as available GameEffects (that aren't present in any of the XML anymore) as well as viewing the values for your custom tables, it's a great debgugging tool as well.
 
Okay... this is super helpful!
Follow up question:
@Gedemon you've got GameConfiguration.CurrentTurnYear set on each turn end, is that mapped to a datatable?

If so, which one?

If not, where is that value stored?
 
GameConfiguration (Get/Set) is what I was using to save/load persistent data with the game's file at the time I made the mod.

There are more appropriate functions available now (and working in all contexts), as used in the various official scenarios.

Now, having a quick look at my old code, I see that it has been broken by one of the previous game's patch that separated LuaEvents between contexts.

see https://forums.civfanatics.com/thre...ering-storm-patch.642080/page-3#post-15396706

So at the top of InGameHSD.lua add
Code:
LuaEvents = ExposedMembers.LuaEvents

and at the top of ScriptHSD.lua add
Code:
ExposedMembers.LuaEvents = LuaEvents

that should allow both scripts to communicate again.
 
Awesome. That did it.

I'm gonna start working on accounting for loyalty, golden ages, etc.
And I saw they have something setup in the ui docs already for progress bars, so that shouldn't be super difficult to implement.

@Gedemon I'll push this all to my fork of your repo as I go.

Thanks!!
 
Back
Top Bottom