Welcome to Unknown Horizons

Aug 5, 2012

Combat AI Update


Category:Coding Summer of Code 
Posted by: kiryx

Hello everyone,

This time it's Kiryx - one of the Unknown Horizons Google Summer of Code students. I have the pleasure to present you the current state of our combat AI, which is the area I've been working on over the last few months. My main goal over that time was to bring some more challenge and fun to single-player mode by extending the current great AI (written by gscai over the last summer) to pick up and handle combat.

Introduction

Modeling reasoning is always a tricky task, and there's probably no "right" way to do it. It wasn't different this time - the general scheme on which combat AI bases its reasoning may not be the most straightforward, but it was made with the intention to ease the process of adding new knowledge to the whole concept later.

The emphasis on creating an easy to extend AI was a big priority; here's why:

Artificial intelligence in games rarely resembles academic approaches to solving problems by machines. The main difference is the absence of any self-learning abilities. Although it would be very easy to gather required samples of data for a training set, game AI very often relies only on knowledge passed by an AI programmer. Since we couldn't rely on self-learning here, every new feature in the project would have to be accompanied by hours of coding time to add/extend/fix AI in order for it to keep up with the changes. Allowing for easy extension of AI would make this task easier and faster.

General approach

If someone were to ask me to give out the most general idea that describes how combat is handled, it would be something like this:

  1. Scan the world for certain situations that fall close to combat/strategy/diplomacy.
  2. Respond to given situation by taking appropriate action

If I was additionally asked to implement it in under 500 lines of python code, I'd probably implement two kind of components here:

  1. Situation detectors
  2. Situation handlers

Former would evaluate as True or False. In case of a match (True) it would spawn a corresponding situation handler to a given world state. The situation handler's job would be to move ships, change diplomacy settings, attack other ships etc. Of course this is just an abstract idea behind what I tried to achieve, yet there are few components that share a very similar approach to what was mentioned above:

CombatManager and StrategyManager (Situation detectors) along with BehaviorManager (Situation Handler) - more on each component later, in the next part of my Combat AI update.

Cheers.

 
Add a comment for this news:
Comment Title:

Your Name:

Your Email Address:

Additional Comments: