GalCiv IV: Supernova Dev Journal #24 - AIs Drinking Coffee on Planets

Published on Monday, August 28, 2023 By Brad Wardell In GalCiv IV Dev Journals

Generally speaking, in GalCiv games there has been three types of players:

The first player is the relatively new or casual player who finds the AI ridiculously hard and will post "The AI is cheating" (the AI doesn't cheat unless you make the settings super high).  They say this because the AI is able to expand fairly quickly because it is quite good at scouting (the AI tends to build a lot more scouts than players) and finding planets. It has no idea where the planets are.

The second player plays the game fairly normally and is eventually able to win at levels up to and including the "Bright" difficulty where the AI is given a bit of help in the form of a slight money boost.  These are people who tend to like the game the most because they see the AI playing fairly intelligently and each game is quite different.

The last player is the player who has figured out all the tricks with their Civ setup.  They know which traits to pick and will make their custom civilization pretty amazing.  They also know every weakness the AI has and can exploit that.  These players can crush the AI even on Godlike.

Now, for the first type of player, we are doing more to slow down the AI on expanding on lower difficulty levels.  They can't, for instance, rush starship construction.

For this discussion, it's the second and third type of player we want to discuss.  And for that, we have to get into the sausage factory that is how terrible the AI is at managing planets. 

WHY is the AI so bad at managing planets?  The answer has been because of performance.  Turn times.  We've always had to really be careful on how sophisticated we make the AI's planet work (like we can't let it look ahead because that's an N^2 algorithm). 

We've stuck with the same basic AI algorithms for planet stuff since GalCiv II.  

BUT not anymore.  It's 2023 and there's enough CPU power (and we've gotten enough time back thanks to other optimizations we're working on) that we could totally rewrite it.  This will show up in 1.8.

Let's take a look at the old AI.  Here is earth after 130 turns.

You will see a lot of obvious issues here (and we're not even counting the bad citizen setup which we'll have to get into later).

Look in particular at the terrible Shipyard production. 

Now let's look at the new AI:

So what has changed?

A few things.

  1. The AI is now quite good at destroying an existing district or low performing improvement and putting a new one on it.
  2. The AI is quite good at terraforming.
  3. The AI is now good at measuring not what the native qualities of a region on a planet are but also the effects of the other buildings (a very expensive operation).  So the AI will happily ignore a +1 to wealth if  the civilization needs food or if it's going to get a big research bonus by putting something there.
  4. The AI is now much more intelligent about when to upgrade its districts. 

Thus, in this example:

  • Shipyard production jumps from 37 to 90.  
  • Manufacturing levels have gone from level 1 to level 3
  • The AI has destroyed some districts to for in high end buildings (look at all the unbuilt special improvements in the top right in the top right)
  • The AI is willing to build housing and food as its needs require it.
  • Look at the the placement of the Starport? That's a level 5 Starport versus not building one at all because it didn't want to destroy any existing tiles to build it.
  • It built a prison and a recycling center because the planet needed to reduce crime and pollution.

The knock on effects of this remain to be seen.  But this will be available shortly.

 

______________________________________________________


Galactic Civilizations IV: Supernova Dev Journals