Formatting may be lacking as a result. If this article is un-readable please report it so that we may fix it.
BigFoot, the man behind the AI code in Dawn Of War has posted a message in the Official DOW Forums
to help modders with their AI coding. Here's what he had to say:
[quote]Howdy! This is your friendly neighbourhood AI programmer. A little introduction: I was the one to write the AI for Dawn of War, and deggy recently asked if I had sometime to help out the modders.
So... with absolutely no guarantees, I'll try to answer some questions you may have. However, because of my schedule, I may not always have the time so the response time may vary greatly.
Now, answers to some common questions:
1) In general, why does the AI do what it does?
When you watch the AI, often there are things that seem counter-intuitive at first. For example, builders build non-defensive buildings in the front-line. These sorts of decisions were made because many strategies proved great on some maps, but terrible on other maps. I chose the strategies that would work for most maps, whether they're big, small, long, short, sparse, etc.
Therefore, when making improvements I needed to make sure they work on all types of maps, and many types of players (aggressive/defensive) to verify that it really is an improvement across the board.
2) Why do builders build non-defensive buildings in the front-line?
On large maps, a builder needs to go quite far to build listening posts. Having the builder walk back to the base proved crippling against more aggressive players since it slowed development too much.
3) Why does the AI slack off if it's my teammate on lower difficulty settings?
My rationale was that this would level the playing field, since the player was probably doing much better than the other AI's. However, it evidently is *too* crippling. To properly fix it, one would need to know which players are AI's and which are humans. However, this is not possible in the current code base, so a different fix would be to not use your opponents to figure out whether you're too strong.
The problem with doing a flat out crippling of the AI, however, is that it no longer adapts to the opponent. Currently, it will ramp up as the opponent becomes stronger, and stops building if the opponent gets weaker, which generally resulted in more exciting games.
4) How does the AI figure out to build a new base, and why does it sometimes not do so?
The entire AI is run be demand and prerequisites (except for certain specializations like in the MarineBuildBaseStrategy.ai, ChaosBuildBaseStrategy.ai, etc). Thus, if it determines that it needs a dreadnought, it will look at the prerequisites and start building them, and this includes a completely new base, if needed. There are many reasons why it might not do so, including lack of money, no builders, enemies where it wants to build, etc. However, the good news is that if you, for example, want the AI to race up to building an Avatar, simply increase the demand for the Avatar and the AI will build all the prerequisites for it.
These are more high level answers. I'll take a look at more specific questions in the future, but I hope this helps somewhat.
Good luck! I hope you guys improve my AI to new heights -- one of the reasons I exported so much to lua was so the AI could essentially be rewritten without making a full blown mod.
It's nice to see some of the Relic staff coming to help out the fans every now and again. Yes BigFoot i'm sure this will help the modders greatly! Thanks goes to Bigfoot for taking the time out to help us.