GearCity

GearCity

View Stats:
BanDHMO 14 Jul, 2018 @ 11:57am
Can modders add their own variables and/or access SQL tables in their logic?
Eric, now that I'm done salivating over your modding doc, I want to ask about something I didn't find in it.

Let's say I want to track something that the game currently does not track, such as how well-supplied each side of a world war is. Theoretically, could I:

1. Have my own variable or table that persists between turns and gets saved/loaded, which my logic can work against? e.g. AlliesEquipment and AxisEquipment.

2. Can I catch events when military contracts are being fulfilled by player or AI and accordingly increment those counters?

3. Show to the user, via notes or some other mechanism, messages at predetermined points of the war that depend on those variables? e.g. if in Jun 1940 Allies are significantly better equipped, the Dunkirk evacuation goes more smoothly, and if they significantly worse equipped, the human losses are staggering.
< >
Showing 1-3 of 3 comments
Eric.B  [developer] 14 Jul, 2018 @ 12:10pm 
Unfortunately no. All three of these would require access to the compiled code, which at this time is closed. I may, some years after release open this up. But for the time being, with so many games flooding the market, I have to keep it closed up for now.

If you wanted to invest a bit of effort into it, what you could do is write an external program to look at the auto-save files. I believe the game can be set to auto save every month (or at least every 3 months). Using that data you can generate the information you want and spit it out into an .html file in the reports. You can then modify the static header html to link to that report so you can access the information in the game.

You could take it one step further and alter the turnevents.xml file based on your results. The TurnEvents file is read each time and not stored in the DB. Hence you could change the outcome of the wars.

All that would require a knowledge of a programming language that can use SQLite, and a little bit of html/xml.

That being said, the mod system does not support this. As it would require editing core files.
Last edited by Eric.B; 14 Jul, 2018 @ 12:11pm
BanDHMO 14 Jul, 2018 @ 12:41pm 
Hmm, interesting idea with an external program. I doubt the answer is positive, but I'll ask: are there any kind of integration points for such a program that would allow it to be started/stopped with GC and to know which savegame GC is currently playing? Would GC wait for an external program to finish processing before doing its own work so they don't collide working on the same data?

Having written this, I'm guessing 99.999% probability is that the answer is no.

Oh, well. It was worth an ask. Probably, there would need to be a lot more built than what I described anyway to properly track a war, because contracts would need to be tied with how well-supplied a side is and how well-supplied the enemy is, etc. Before long we are talking many more integration points.

I guess I'll just stick with roleplaying creating the best designs for the war timeline and assume it helps cut the casualties.

I think you mentioned in another thread that hard-coded contracts are possible to mod in, though, right? Can a modder add contracts for specific types of vehicles with specific specs at specific dates in the war (as opposed to the randomly generated ones)? It could be cool to correlate contracts with big events in the war. Though I admit I haven't played throgh a war yet, so I don't know how much you've already done.
Eric.B  [developer] 14 Jul, 2018 @ 1:15pm 
Originally posted by BanDHMO:
Hmm, interesting idea with an external program. I doubt the answer is positive, but I'll ask: are there any kind of integration points for such a program that would allow it to be started/stopped with GC and to know which savegame GC is currently playing? Would GC wait for an external program to finish processing before doing its own work so they don't collide working on the same data?
I would write the external program to check the savegame folder for changed files. If the change timestamp is newer than a stored value for the last change, you then update the information.

You could probably do something with the Windows API to minimize GC when this is triggered. Thus pausing the game, but it's a bit of complexity. I would just play 3 months, wait for it to process, play three months, wait for it to process, etc.


Alternatively, you could just pull the data out of SQLite with a good viewer, and put it into a spreadsheet program like Excel or Libre Calc. Then do whatever calculations you need to do there.

I think you mentioned in another thread that hard-coded contracts are possible to mod in, though, right? Can a modder add contracts for specific types of vehicles with specific specs at specific dates in the war (as opposed to the randomly generated ones)? It could be cool to correlate contracts with big events in the war. Though I admit I haven't played throgh a war yet, so I don't know how much you've already done.
No, the external contracting data are variables for dynamic contract generator to use to generate contracts. There is no static contract generation system.
Last edited by Eric.B; 14 Jul, 2018 @ 1:16pm
< >
Showing 1-3 of 3 comments
Per page: 1530 50