One of the more intruiging lectures of the 2008 GDC was given by Soren Johnson (MobyGames info) ex- of Firaxis and now with Maxis on the “Spore” team. He was talking about how Civ 4 fit in the spectrum of game AI between two extremes… “Good AI” and “Fun AI”. Here’s some selections from my notes on the lecture. (Forgive the seeming lack of lucidity – I was typing like a madman!)
Also, this is a direct link to Soren’s Slides (.zip) on his blog – which is where the images in this post came from (click to enlarge).
â€śGoodâ€ť AI (Play to win)
Beat player at their own game
Essentially a human substitute
â€śFunâ€ť AI (Play to lose)
Algorithms are the content
Focus on the Playerâ€™s Experience
For example, Aggro in an MMO is fun AI.
With tanks, healers, DPS (damage per second) there is a formula for handling it… Trivial AI problem to â€śsolveâ€ť by the players.
Aggro determines who AI attacks, let enemy attack the tank, you heal the tankâ€¦ DPS the mobâ€¦
Everyone knows how it worksâ€¦ very predictable. Almost become commoditized with agro tools. Blizzard isnâ€™t trying to be clever â€“ they like that it is simple.
The question with AI design is, where are you trying to fit? Across the spectrum.
- Chess is â€śgoodâ€ť
- Starcraft is more towards â€śgoodâ€ť (no real diplomacy â€“ assumption is that they want to kill you.)
- Civ IV split the gap. Deep diplomacy but very symmetrical game design.
- Heroes of Might and Magic is more towards â€śfunâ€ť. Not as focused on the excellence.
- Desktop tower defense if pure “fun” AI.
Good side tends towards fixed rule sets. (e.g. Chess)
Fun side tends towards evolving rule sets.
What are the best environments?
Good AI tends towards Multi-player
Fun AI tends towards Single-player
Tactics available to AI?
Good AI will do everything available.
Fun AI will do limited tactics.
Good AI has objective measurements
Fun is subjective â€“ e.g. difficulty over performance
Good AI passes
Fun AI… this question is irrelevant.
The question is: â€śPlay to win or Play to lose?â€ť
With Civ IV, the AI does have limited options. There are a lot of options that they do not put on the table for the AI. Esp. with diplomacy. E.g. fighting a war… as a player, you can ask them for stuff if you promsie to quit war, then attack them over again. AI doesnâ€™t do that.
- Both fixed and evolving design
- Single Player
- Limited Options
- Objective Testing
- Fails Turing test but it isnâ€™t irrelevant.
Every player is differentâ€¦ some want things like challenge, sandbox, narrative.
For narrative, you want to aim for personality, for the AIs to maintain memory about you. It’s OK for them to fall for traps. They built that into the leaders in Civ 4.
With regard to the challenge, you “want player to win or at least understand WHY they lost.“
Need for difficulty levels:
Lets sandbox players off easy
Gives Challenge players a goal
Increases available tactics.
Where does cheating fit?
Completely Good AI does not.
Completely Fun AI n/a There is no concept of cheating (e.g. desktop tower defense)
In the middleâ€¦ yes?
The Noble level in Civ 4 is the â€śeven levelâ€ť with regard to production modifiers, etc.
But Noble has other cheatsâ€¦ e.g.
- Animal/Barbarian combat bonuses
- No Unit support
- Better Unit upgrades
- No Inflation
- No War Weariness
The AI needs more help in these areas.
For example, AI does not leave cities empty like a human wouldâ€¦ so unit support costs. Human army and AI army will never be the same size because they have to keep units in their citiesâ€¦ therefore cut the support costs for the AI since they need to have a larger army.
Cheats should NOT be linearâ€¦ certain you want to help more or less as you progress your diff. levels.
Cheats should never feel unfair! Examples from past Civs that players hated…
Civ 1, 2
Gang up on human (In Civ 1: If year > 1900 and human in lead, declare war on human)
Civ 3, 4
Human-blind diplomacy (Never checks â€śis human?â€ť)
Information cheats (they DO have info cheats â€“ most of them come down to limited dev. Resourcesâ€¦ e.g. fog of war is very expensive)
Information cheats can really backfire on you. E.g. Amphibious Assault Judo using empty port cities in Civ 3. (solved by determining random time for updating the assault target, ignore temporary data such as nearby units.)
Cheating is relative:
The Tech Trading Problemâ€¦
- AI must trade techs
- AI must trade fairly
- Human can sell techs cheaply
Only two of these can be trueâ€¦ Soâ€¦ should AI sell techs cheaply? Solution? Can AI pursue altruism?
When the AIs were trading often, it made for very even technology levels between all players rather than some groups ahead and others lagging. Everyone had everything.
Solution in Civ IV
AI can undersell by 33% butâ€¦
Tries to make up difference in gold
Only trades on random turn intervals
Uses same â€śRefuses Trade Withâ€ť logic as with human.
Arbitrary rules e.g. â€śI will never trade Iron Working with you.â€ť
What is the point of cheating?
Are we trying toâ€¦
- Write the â€śbestâ€ť AI?
- Beat the human?
- Be fair?
Designing for the AI?
Can AI handle the options in the gameplay?
OTOH, make sure not designing just for AI. Legitimate reason for design decision. (e.g. closed borders, enforceable peace treaties)
Traditional testing fails
Automated testing helps greatly
Need hard-core fans to analyze
1.5 year closed beta, peaked at 100 users, bi-weekly patches.
They used soft-coded AI:
No AI scripts
No enums (No â€śTempleâ€ť)
Less brittle code
Less predictable AI is not always a good thing.
Probabilistic Reasoning – Weights to factors, values to situation
Data-driven Mods – AI was stand-alone so that it was compiled into dll. CvGameCoreDLL.dll was 100% independent of engine.