Remix.run Logo
Gagarin1917 6 hours ago

That’s so awesome, I had the exact same idea since LLMs came out because I’m a regular Civ player.

I thought about trying some kind of mod for Civ IV but never got around to it. FreeCiv does make more sense.

Very cool stuff.

verelo 5 hours ago | parent [-]

You can read the code, but my suggestion on how to do this is to just ingest the save game files. They're super easy to work with, especially now we have the magic of LLMs.

In my case i'm creating various json files that describe game state, players, diplomacy, attendance, etc. Then i just throw that at the LLM and give it the goal of writing a newspaper article about where the game is at. The json files are incremental, so i'm not reading all the past versions on every turn. At the end of the current turn it just appends the current turn data to the json file, and then does the generation. These files are also what power the frontend UI, so it's all super lightweight and fast.

To make the graphs, you need to know state at the end of the current turn as the save files don't retain any history. So i store the most recent save file from each turn in order to achieve this.

It's been a journey of reverse engineering this game, but that's kind of the joy of it all.