Hello! How to use ChatGPT to control the AI in Freeciv?
I am the developer of FCIV.NET the open source version of Freeciv in 3D using Three.js and supports up to 256 players, playable for free in the browser. The license is AGPL and the source code is here: https://github.com/fciv-net/fciv-net
The server is implemented in C and there is already a lot of code to implement the AI in the C server.
Some ideas:
Each AI player inside the game has a ChatGPT AI personality which controls the nation and generates messages to other players.
The ChatGPT can make strategic decisions for the AI players related to diplomacy, research technologies and warfare and defense.
I’ll suggest you start out by visiting the playground:
There you can play around with the API and get a feel for how things work, a good place to start would be pasting stuff from the in-game chat, and have one of the endpoints do sentiment analysis on that.
You could use that to have GPT write appropriate responses in the style of historic characters based on the players behavior.
Interesting! Following with interest. Did I mention I’m interested?
Seriously, though, thanks for sharing. I’ve been a Civ player for a long, long time.
I like! I wish i had more time at the moment, but feel free to ask if you have more specific questions or want some nudges on how to hook it up to your game.
I’d be interested in at least programming an API to allow LLM to “play the game itself”. This would sort of at least provide a relatively easy testing layer for eventually porting the “LLM’s play” to be included as an NPC option, but coding a middleware to “allow the LLM to play the game” would at least get things moving/working.
The reason I’m interested in this is because I’ve almost completed my system for automatic multi-turn LLM behavior, that I believe will lead to the LLM being able to accept input world state as a code base, users goal, etc., and then move through the process of spawning agents, building a new application/modifiying existing code to complete the project. In this case I’d imagine the simplest form would be to figure out how to API the existing gameplay code so that the new middle-ware app for the LLM to play could be designed to hit API endpoints. Of course it all being real-time (or is a turn based game?), it becomes a pretty interesting opportunity.
I think to move forward I’d need help understanding the existing gameplay and system, because I’ve never played this game/used it myself, and understanding the current state of the code base, if it is open source, and then figuring out how to conceptually blueprint the desired result.
Then, the idea would be that I could feed all that into my system, start the screen capture, and a few hours later share a very interesting result