2. Agenda
What is Artificial Intelligence (AI) ?
Artificial Intelligence Fields
AI for Games
- Real-Time Strategy Example
- Abstract AI Model
- Agent’s Main Components
- Game Environment
How to Build an AI Game?!
11. Sensors
Sensors are the Eye of the agent.
The agent perform its actions according to the current
observed states
Agent’s sensors works permanently (In the game loop)
12. Actuators
In RTS games, all games units should reach their target. So,
Path-Finding techniques are needed
Examples: BFS, Dijkstra, A*, LBA*
Decision-Making is the most important element when you build an
AI agent. It controls the behavior of the agent during the game
phases
Examples: Finite State Machine (FSM), Fuzzy State Machine (FuSM),
Case-Based Reasoning (CBR)
13. Actuators (Cont.)
Steering Behaviors techniques control the movements of the agent
to be more realistic
Examples: Evade, Fleeing, Pursuit
Planning is commonly used in High-strategic games
Examples: Hierarchical Task Network (HTN)
There other actuators could be added to your agent according to
your game scenario
14. Actions & Percepts
After the agent uses its actuators, actions is done that may reflect
on the game’s environment
Each of these actions change the state and the environment of the
game
Percept is needed to estimate the current state that could reflect
on the behavior of the agent
16. Environment
Environment is the world that the agent acts into it
It is considered to be the main source of information that the agent
should obtain to use its actuators
Information needed to help the agent in simple RTS game could be
- Resources places (Market, Factories, ..etc.)
- Unmovable units (Mountains, Water, ..etc.)
- Enemy’s positions
- Allies’ positions
17. Environment (Cont.)
To implement the AI game environment, you should set the
landmarks, the size of the world and the world’s dimensions
There are many techniques used to build the environment structure,
but all of them are under the name of Location-Based Information
Systems (LBI)
Examples: Influence Maps, Potential Fields
Note that, environment could communicate directly with the agent,
like sending notifications or alerts
19. How to Build an AI Game?!
1. Determine the game scenario and type
• According to the game scenario, you determine the type of the game {RTS,
Board, FPS, ..etc.}
• The Type of the game determines the world landmarks and its dimensions,
for example: if the game looks like a First-Person Shooter game, you should
prepare a 3-D world
2. Choose the programming language and supported tools
• A Graphics library is needed to make any game
• There are multiple of libraries that supports 2-D and 3-D graphics, such as
OpenGL, Unity and XNA (No longer supported )
20. How to Build an AI Game?! (Cont.)
3. Game features and OOP design
• Game development is considered to be a perfect example for how the
programmer uses the project’s features elements and objects efficiently
• No OOP design -> No game!
• Consider using many design patterns to build the game’s OOP design, for
example you will totally need patterns like Strategy, Singleton and
Composite patterns
4. Determine the number of AI agents
• Swarm Techniques could be used to handle the huge number of AI agents
the game
21. How to Build an AI Game?! (Cont.)
5. Agent and Environment Separation
• Separate the agent’s and environment’s structures from each other
• Implement the interface that will be used to handle the communication
between the agent and the other agents and the environment