Thursday, November 06, 2008

On Scourge AI and Widelands


A quick one today. Firstly, I forgot to mention Widelands yesterday. A new version, a release candidate for build13, is available for download. The changelog is immense, so it should be large improvement over build12 which, for me, felt a little unpolished. Some of the highlights of build13 are:

  • More stable multiplayer

  • FPS regulation for less CPU usage

  • Improved economy routing

  • Many new sounds

  • Many new graphics and animations especially for the Atlanteans

  • Balancing work for all tribes

Not to harp on too much about Scourge, but I find the recent AI updates fairly fascinating. Developer lordtoran describes the effect of the change to a decision matrix from the crude system that used to be in place before:

Creatures that can't reach a location behave a lot more intelligent now: For example, if a monster can't reach you because you are surrounded by other monsters, it will loiter a bit and then throw a damaging spell or heal someone. When one of your attackers falls, it will engage in melee if there is enough space. I find it quite fascinating how the creatures have a "life of their own" just by using a simple decision matrix.

That sounds better than a lot of commercial game AI - which in general is notoriously bad considering the resources that go into some titles.

1 comment:

Anonymous said...

Seeing how an average C++ coder like me, who had no experience in AI programming before, can implement something like that within a week, just shows off how commercial game companies neglect everything they can afford to, as long as their product sells.

For making a good game AI, you don't need genetic algorithms or neural nets. A well-tuned finite state machine with some amount of randomness will create an impression of "intelligence" just as well, especially in games where the amount of actions you can do is quite limited (read: most games).

After some research for the best approach, it wasn't really hard to implement the decision matrix in Scourge: It is basically a table with creature/enemy states being the rows and possible actions being the columns. The table cells contain weights determining how likely that action would be taken in that state.

When a creature is about to make a decision, it walks down the rows of the matrix, gathers all states that apply, and picks the highest weight (of each column) on the way. The result, an array of (number of actions) weights, is normalized and a dice is thrown against random entries until successful. The action corresponding to that entry is then executed.

Provide feedback:

Due to SPAM issues we have disabled public commenting here.

But feel free to join our forums or easily chat via IRC with us.