Adaptive AI Engine for RTS Games

Discussing the theory and practice

An AI Example; Basic Components and Design

Posted by Ogail on June 27, 2009

Chapter 2 – An AI Example; Basic Components and Design

An AI Example; Basic Components and Design

  • Aim:
    • Discussing common parts of AI Engine

  • Decision Making and Inference:
  • Inference: act of deriving logical conclusions from actual knowledge or primes to be true
  • The more things the game allows to AI character to do, the greater the response set, or state space of game
  • Decision making: using available inputs to come up with solutions. These differences are discussed below
  • Types of Solutions:
    • Strategic: long-term high level goals, that require many actions to accomplish
    • Tactical: short-term low level goals, that require many physical actions to accomplish
    • In real programming you should keep development of these types isolated
  • Agent Reactivity:
    • Definition (psychology): is a phenomenon that occurs when individuals alter their performance or behavior due to the awareness that they are being observed
    • Effect of scripted systems in the agent reactivity
    • Agent reactivity is suitable for example for arcade game style and twitch games
    • This point needs to be addressed under the type of game being created and game experience of it
  • System Realism:
    • To be considered realistic decisions and actions AI element come up with should be regarded as human
    • AI characters need to show human weaknesses to appear realistic
    • It’s all about balance and entertaining
    • Realism also could be defined as being real in game world (cheating!)
  • Genre:
    • At the genre level, keep in mind the following:
      • Input (or perception) types:
        • Consider any hieratical relationships between inputs
      • Output (or decision) types: (61)
        • Outputs could be analog, digital, series of events on a behavior
        • Output could involve entire character, merely parts of a character or multiple character
        • Output can be specific or high level
      • Overall structure of the decisions needed for the genre:
        • Complex games like Age of Empires requires many types of decisions to be made during the game. You have team-level strategy, unit tactics, array of pathfinding problems and even more esoteric things such as diplomacy
  • Content:
    • Special AI that results from the game novel or content
  • Platform:
    • Keep in mind that player will play under certain platform
    • If the game will be longer try not to repeat AI actions
    • Consoles
    • Handheld
  • Development Limitations:
    • Budget, manpower issues and schedule length….
    • The gameplay AI should be cyclical (phases of actions and then rest, then repeat)
    • State-based methods approach
  • Entertainment Limitations:
    • Game level balancing
    • Getting across emotion and intent (in TV music, camera position are used here what to use?)
      • Cartoonish character
  • Input Handlers and Perception:
  • AI perception can be defined as the things in the environment that you want the elements in your game to respond to
  • Central perception system can use additional data on input register:
    • Perception Type:
      • Various types of inputs as Boolean, integer….
      • They could also include static perception (i.e. basketball player skill)
    • Update Regularity:
      • Some perceptions need periodic update so keep this in mind to save calculations
    • Reaction Time:
      • Reaction time is the pause before an enemy acknowledges a change in the environment
      • Reaction time can be set regarding to the personality (quick if quick slow if slow)
    • Thresholds:
      • Min and Max values that the AI will respond to
      • Could be used in game AI as adding more view range to sniper
      • These values may change according to game events (flash grenade and guard)
    • Load Balancing:
      • Specifying time between updates in general
    • Computation Cost and Preconditions:
      • Design your system with any hieratically linked computation in mind, so simple precondition calculations are done first such that any more complex determinations might not have to be done at all (Pac-Man Example – (68))
      • AI system will respond depend on:
        • type of game, level of gameplay, special powers enemies have
      • Main two paradigms for updating the perception:
        • Polling:
          • Checking for specific values to change or making calculations, on game loop by game loop basis
          • Using Polling for:
            • Analog (continuous or real values) inputs
            • Inputs that may be present in some form all the time
        • Events:
          • Here input tells perception system that it has changed and perception system see if some events occur so it updates otherwise do nothing
          • Preferred to be used in digital systems
      • Some games use advanced perception system because the gameplay is concentrating on beating perception system itself! (as stealth games)
  • Navigation:
  • AI Navigation is the art of getting from point A to B
  • This field has many algorithms because it was investigated many in the field on robotics
  • Navigation contains two main tasks: pathfinding and obstacle avoidance
  • Systems used in pathfinding are:
    • Grid Based:
      • Here world is divided into grid of squares or hexagonal
      • A* Search algorithm is used to find shortest path using grid
      • Each grid square has “traversal possibility” value from 0 (can’t pass @ all) to 1 used analog values to show height of grid or special attributes (water)

  • Simple Avoidance and Potential Fields:
  • Map Node Network:
    • Used more in 3D worlds
    • Search algorithm will find shortest connection path between points
    • Here we are reducing state space
    • This method is not suitable for dynamic obstacles

  • Navigation Mesh:

  • Combination Systems:
    • Some games use combination of these techniques
    • Avoidance is akin for dodging
    • Avoidance of done in a couple of several ways:
      • Potential fields:
        • Make dynamic objects apply an additive repellent force away; make force more stronger until it stops the movement invader
      • Steering behaviors:

  • Basic Steps Involved in AI Engine Design are:
    • Determine different sections your AI system according to game genre
    • Determine types of inputs to the system (digital/analog)
    • Determine outputs system will use
    • Determine primary logic you are going to need to link the inputs to the outputs
    • Determine type of communication between system and AI (continuous/event-driven)
    • Take note for all limitations that your game will endure
    • Divide your system and choose suitable technique
    • Always make a prototype it’ll help you so much!
  • Summary:
    • Three main components of AI Engine are: decision making, perception and navigation
    • Type of decision making technique you choose should rely on: types of solutions, agent reactivity, system realism, genre, special content, platform, development and entertainment limitations
    • Perception systems are central locations for input data calculations for AI characters
    • Perception systems can take into account low-level details such as: update regularity, reaction time, threshold, load balancing, computation cost and preconditions
    • Navigation systems usually fall into: grid based, simple avoidance and potential fields, map node network, navigation Meshs. Some games use combination from these types
    • Obstacle avoidance is more local system dealing with short-term goals

  • Questions:
    • What’s the definition of reactivity in game AI?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: