How to use ChatGPT to control AI in FREECIV / FCIV.NET?

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: GitHub - fciv-net/fciv-net: the 3D version of the Freeciv strategy game

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.
  • Use ChatGPT to generate in-game messages.
  • Control the game using ChatGPT messages.
  • ???
  • Profit.

1 Like

Hey champ, and welcome to the forum, sounds fun!

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. :laughing:

1 Like

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.

1 Like