Best settings for limiting AI aggressiveness

Can't beat the AI? Is it too tame? Discuss the best strategies!
Ozor Mox
Posts: 45
Joined: Wed Apr 02, 2014 12:15 pm

Best settings for limiting AI aggressiveness

Post by Ozor Mox »

The AI in Freeciv always seems to like being at war with at least half the world at all times, and it's rare for them to want to end a war.

Does anyone know what settings impact how much the AI wants to be at war with its neighbours?
Ozor Mox
Posts: 45
Joined: Wed Apr 02, 2014 12:15 pm

Re: Best settings for limiting AI aggressiveness

Post by Ozor Mox »

Hmm, after a bit of experimentation I think there might be some sort of new problem with the AI. I'm sure they used to get quite competitive with the spaceship towards the end, but out of curiosity I ran a few AI only games to see the results and they never make it to the end of the tech tree. Their research stalls while they remain at war with everyone (whatever size map, with loads of cities or not that many). Many were still on things like automobile and machine tools in 2100 AD, nowhere near the space race.

This is on normal difficulty. Maybe there's a problem where higher difficulties make them so aggressive they forget about research?

Anyone noticed this except me?
The Square Cow
Veteran
Posts: 53
Joined: Wed Nov 19, 2014 5:47 pm

Re: Best settings for limiting AI aggressiveness

Post by The Square Cow »

The Freeciv AI seems to have done this for as long as I can remember, which is before version 2.0. However, the AI does seem to be less aggressive with less players total -- like about five players. I tend to play with many AI players so my memory may be biased towards that situation.
The Square Cow
Veteran
Posts: 53
Joined: Wed Nov 19, 2014 5:47 pm

Re: Best settings for limiting AI aggressiveness

Post by The Square Cow »

If you make a new rule set, and then add a rule like this:

Code: Select all

; Make the AI more peacefull
[effect_ai_love]
name    = "Gain_AI_Love"
value   = 50
reqs    =
    { "type",   "name", "range"
    }
To the effects file, then the AI will tend towards peace and alliance more. You likely would want to set the value of "50" to something else depending on just how peaceful you want the AI to be.
FreeWilly
Posts: 17
Joined: Sat Dec 06, 2014 4:56 pm

Re: Best settings for limiting AI aggressiveness

Post by FreeWilly »

I confirm there is a problem, from human player's perspective. ;)

AI diplomacy and playing strength are at a state "broken" in my eyes. The current behaviour when you start AI level "Simple" is like you would expect it in "Unbeatable". This shouldn't be. Perhaps the developers don't have the single player in mind or they just found other things more pressing, I don't know. Beside constantly being at war with some hothead, I find the obvious (and shameful) advantages AI players enjoy at the core of the problem. They can only afford to be constantly at war with heavy advantages and armadas of invadors and units available.

Perhaps the most simple way to make a first step amendment is to offer a switch where AI players have to play by the rules, without advantages. They may continue to be hotheads, but they will get defeated. On the other side, a more intelligent Diplomacy model would work wonders and is desirable. I'm even thinking to start work on this, given fitting circumstance.
cazfi
Elite
Posts: 3069
Joined: Tue Jan 29, 2013 6:54 pm

Re: Best settings for limiting AI aggressiveness

Post by cazfi »

For those who consider current AI too hard, there might be some comfort from the fact that freeciv-2.6 introduces new AI difficulty level; "Handicapped". Just like AI in level "Cheating" gets extra bonuses not available by the usual rules of the game, "Handicapped" gets penalties.

In general the problem with freeciv AI is that there's not much difference between the difficulty levels. Novice AI might seem unbeatable, but once you learn to take advantage of its weak points, the hardest level AIs are not challenging enough for long. One thing that make it seem like a challenging opponent is that it plays with extreme risk (especially in versions before 2.5) -> it does not "waste" resources to defend until the threat is imminent, and even then lazily. Run all-AI game and watch as global observer how most of the cities are completely empty while all the forces are in the offensive.
Ozor Mox
Posts: 45
Joined: Wed Apr 02, 2014 12:15 pm

Re: Best settings for limiting AI aggressiveness

Post by Ozor Mox »

The Freeciv AI seems to have done this for as long as I can remember, which is before version 2.0. However, the AI does seem to be less aggressive with less players total -- like about five players. I tend to play with many AI players so my memory may be biased towards that situation.
I know the AI has always been pretty aggressive, but I was sure I'd seen them be quite competitive with building the spaceship in the past. I remember one good game where the world superpower (I was like third or something) built and launched a spaceship, and the other AIs all ganged up on them and took their capital, causing the spaceship to be destroyed. They ended up being completely wiped out. Perhaps it was because I was on a lower difficulty and with fewer civs, I wonder if the increased aggression on higher difficulties causes them to lose focus on technology.

I ran a few other AI only games for testing just out of curiosity (on normal difficulty, varying map sizes and number of civs), and every time one AI becomes the overwhelming superpower. They are the only one to reach the end of the tech tree, and sometimes they made limited attempts to build the spaceship, but it always ended in them destroying all other civs.
If you make a new rule set, and then add a rule like this:
Thanks so much for this The Square Cow, this sounds like exactly what I want to play around with. Is the value a percentage? Does it only affect AIs love towards humans? I'll have a look for some documentation in a minute.

Edit: Found it. Looks like it adds x points of love (presumably per turn) with the AIs, but it doesn't say if this is toward everyone or just humans. Anyone know? Otherwise I'll just have a play with the setting.
Perhaps the most simple way to make a first step amendment is to offer a switch where AI players have to play by the rules, without advantages.
As far as I know, the AI actually doesn't cheat on any difficulty level (except Cheating of course!), except that they can set their tax rate to anything and they can see the whole world.
One thing that make it seem like a challenging opponent is that it plays with extreme risk (especially in versions before 2.5)
This makes sense, and applies in some way to the commercial games as well. The aggressive AIs tend to perform better than the peaceful ones, and so this is a way to make the AI competitive. It would just be nice if so many games weren't a permanent war state.

I'd like to help improve the AI if I could, I've read through the code in advdiplomacy.c many times and I think I understand it pretty well, I just don't know where to start and what changes are desirable to the project!
Ozor Mox
Posts: 45
Joined: Wed Apr 02, 2014 12:15 pm

Re: Best settings for limiting AI aggressiveness

Post by Ozor Mox »

The Square Cow wrote:If you make a new rule set, and then add a rule like this:

Code: Select all

; Make the AI more peacefull
[effect_ai_love]
name    = "Gain_AI_Love"
value   = 50
reqs    =
    { "type",   "name", "range"
    }
To the effects file, then the AI will tend towards peace and alliance more. You likely would want to set the value of "50" to something else depending on just how peaceful you want the AI to be.
This ruleset change does exactly what I wanted, thanks very much The Square Cow! I ran an AI-only game with this set to 50 and the AI was much less aggressive, though still with wars breaking out here and there. Towards the end when three civilizations had reached future techs, two AIs then simultaneously built a spaceship and when one finished and launched it, all AIs declared war on them and tried to stop them! The spaceship arrived in 1852 so their tech went a lot faster. Also, I noticed their infrastructure was far more developed, presumably because they focused a lot more on non-military buildings and units.

All I have to do is tweak this value to get the behaviour I want, awesome! :D

Oh and in case anyone was wondering as I was, this value affects all AIs towards all other players (AI or human). I assume you could use a negative value if you wanted them to be more aggressive.
cazfi
Elite
Posts: 3069
Joined: Tue Jan 29, 2013 6:54 pm

Re: Best settings for limiting AI aggressiveness

Post by cazfi »

Ozor Mox wrote:
The Square Cow wrote:If you make a new rule set, and then add a rule like this:

Code: Select all

; Make the AI more peacefull
[effect_ai_love]
name    = "Gain_AI_Love"
value   = 50
reqs    =
    { "type",   "name", "range"
    }
Oh and in case anyone was wondering as I was, this value affects all AIs towards all other players (AI or human).
Yes, as you set no requirements at all for the effect. For example

Code: Select all

reqs =
 { "type", "name", "range"
   "AI", "Novice", "Player"
 }
would make only Novice AIs to gain the love.
Ozor Mox
Posts: 45
Joined: Wed Apr 02, 2014 12:15 pm

Re: Best settings for limiting AI aggressiveness

Post by Ozor Mox »

Yes, I saw this in the civ2civ3 ruleset:

Code: Select all

[effect_ai_love]
name    = "Gain_AI_Love"
value   = 10
reqs    =
    { "type", "name", "range"
      "AI", "Normal", "Player"
    }

[effect_ai_love_1]
name    = "Gain_AI_Love"
value   = 20
reqs    =
    { "type", "name", "range"
      "AI", "Hard", "Player"
    }

[effect_ai_love_2]
name    = "Gain_AI_Love"
value   = 30
reqs    =
    { "type", "name", "range"
      "AI", "Cheating", "Player"
    }
I take it this means that normal AIs will gain 10 extra love towards all other civs, hard will gain 20 and cheating will gain 30. Presumably this is to offset the increasing aggression as you move up the difficulty levels.

Looks like whoever made the civ2civ3 ruleset decided the AI needed to be toned down a bit to more closely resemble those games! :)
Post Reply