Post news RSS AI! AI, Everywhere!

During the last month a lot of work went into AI development, performance optimizing scripts and the usual feature improvements and bug-fixing.

Posted by on

AI! AI, Everywhere!

The last month a lot of work went into AI development, performance optimizing scripts and the usual feature improvements and bug-fixing. Since this game is a lot about detective investigation the game revolves a lot around dynamic interaction with characters and the environment. This requires a powerful conversation system and powerful AI. The AI does not just stand around waiting for the player to blow them in the face nor does it act as stupid cannon fodder. The AI system features now the required basic functionality.

Game AI usually consists of a behaviour tree or state machine. This works for simple AI but is rigid and error prone for complex AI. In this project player and non-player actors are handled with as much shared code as possible (if player can do so can CPU; if CPU can do so can player). To achieve this the game uses a 3-stage AI behaviour:

  • Actions: Actions button pressing or using button panels. The same for all actors (player and non-player) and thus scripted only once.
  • Behaviour: Where player triggers actions by his inputs the AI triggers them using behaviours. The work of past month focused on this part. Behaviour is context dependent. Context is the current task/mission of actors.
  • Agenda: Simulates the actor motives (master plan). The player faces an artificial game master (Criminal Master) which controls actor agendas and thus their behaviour. The player has to use his detective skills to figure out these (hidden) agendas to solve the case. This will be worked on next.

All this is explained and showed in videos below.

Actor Locomotion and Collision Avoidance

Drag[en]gine provides path calculation for AI using the Navigation System (static obstacles). Collision avoidance (or steering) of dynamic obstacles along the path is job of the scripts since this is very game specific. The improved collision avoidance deals with two typical scenarios: Move Around and Wait Behind.

Collision Avoidance

A typical solution is using physical approach where actors and obstacles are magnets repelling each other. This solution works but movement looks like what it is: two repelling magnets. This is unnatural and not matching the game goals. To solve this problem collision avoidance is implemented similar to real humans avoiding collisions. Approaching an obstacle they change direction once not repel like magnets. Actors test collision along their moving direction in regular intervals (1-2s). If a future collision is detected a deviation angle is calculated winging the obstacle. This deviation is applied for 1-2s then the actor heads again for his intended goal. The closer the actor is to the obstacle the larger is the deviation angle. Combined with testing at larger intervals leads to a pleasant avoiding behaviour. Waiting behind obstacles is required if actors pass through narrow spaces like doors. Instead of winging actors adjust their speed if the obstacle is slower. Actors detect nearby walls so if they choose the wall side of the obstacle but don't fit through they pick the other side. Navigation space cost functions are used to pick cheaper movement costs. This keeps actors inside virtual corridors avoiding unfavourable terrain while avoid collisions. The video below gives an impression on how this looks like in action.

Actor Notifications

AI has to react to dynamic changes in the world and react intelligent to static world. To achieve this goal AI supports notifications. Objects can send notifications to actors with localized hints which it can respect or ignore. This is used for a couple of situations:

  • Actor approaching a dangerous place like road crossing during red lights. Makes actor wait before continue walking. Usable for all situations actors have to wait for something to happen before going on.
  • Actor approaching closed door he has to open by pressing a button. Makes building maps quick to build since world elements are "intelligent".
  • Actors noticing nearby objects inspecting them (so think twice where you hide).
  • Actor moves close to stairs and is notified he could use a nearby elevator instead or other alternate routes.

All this provides a world with rich and smart actors especially during (potentially dangerous) missions.

Actor Generation

The game defines a small set of unique characters to begin with. The majority of actors are generated from XML templates (modders can rejoice). You can modify appearance (random texture sets), starting inventory (random props), animations (all animators ever used) and more. As you progress with your investigation the game (CM) converts elected generated characters to important actors tying them into the story. So actors passing by can later become important making each investigation unique.

Actor Behavior

The goal is to create a living world the player investigates. Interacting with actors in different situations and locations alters flow and outcome. The right place and time is as important as asking the right questions. These AI have been implemented so far (more to follow).

  • CityLife. Actors casually navigating the city outside mission scenarios. Goal markers are placed throughout the city for actors to choose from. Goals are attached to Locations telling actors what behaviour to use and what props they can interact with. CityLife populates the city streets with life and makes it harder to know who is important or just a bystander.
  • Train. Actors planing to ride a train or other kind of vehicle (waiting, boarding, riding and leaving). Expect missions like tailing suspicious actors or trying to loose actors tailing you.
  • Elevator. Similar to train behaviour allowing actors to use elevators.
  • Office. Actors moving inside offices/buildings. The basic actor-at-work behaviour. You often find actors at their work places.

This is the initial version. Behaviours can interrupt and branch in a tree way to produce lively behaviour easily. Mission related actor AI is coming next. Expect a living world around you to dive into. The video below shows everything mentioned so far in action.


Besides AI I've also started working on a game engine related topic. I think you can guess what it's all about from the image below. Readers of the previous news post (and wiki) might recognize something ;)


Preparations have been also done for a special unique feature of this game. I'm not going to talk about it now since this would spoil the fun so look forward to it! But I'm sure you are going to like it (especially follow indie-devs and modders).

To see more of this project taking shape support it with your Vote!

Indie of the Year Awards


What also happened for those interested in details (as text file to not bloat the news post)

Helping Hands

This project is still in need of helping hands on the content production side. If you are a model artist (skilled in world props, buildings or humanoids) or texture artist you are welcome to get in contact with me. If you have other skills and want to help don't be shy and send me a PM too.

vfn4i83 - - 692 comments

Amazing work. Looking forward to see this living world.

Reply Good karma Bad karma+2 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.