Upload
anis-garrison
View
235
Download
5
Tags:
Embed Size (px)
Citation preview
Application of AI techniques for Computer Games
BSc Computer Games Programming, 2006
Julien Delezenne
GAMES ARTIFICIAL INTELLIGENCE
Overview of the demo
In-game editor
Pathfinding demo
Design
• The AI component is part of the game engine
• Contains a generic pathfinding system
• Object-oriented state machines
• Data-driven with the reflection system
AI and architecture
• AI can be divided in two parts– The game object system– The AI techniques
• The object system becomes very complex in commercial games
• AI techniques need to be integrated in a flexible way
Game system
-CellSize-Divisions
Map
-Position-Depth
Cell
-Type-FileName
Tile
-Type-FileName
ActorDef
-Position-Orientation
Actor
Placeable
-Next
WayPointSpawn Goal
-Name-Design
GameEntity
-TypeInfo
Object
Tileset
-Editor
World1
11
*
1
*
* 1
*1
-WalkSpeed-RunSpeed-ViewConeAngle-ViewDistance
Character
1
1
*
-Player
1
Reflection
• For each game entity:– Instantiation from its name– Exposition of its properties– (De)Serialization including with files such as
XML (used in the demos)– Editable attributes in the editor. The property
grid of the editor is generated automatically
Abstract controller
• Two types of controllers– Player– AI
• Only the input is different
• The game logic should only know about the abstract controller
AI techniques
• Game developers always have:– A* for pathfinding– FSM for decision-making
• They are the two techniques of the stealth demo in a game environnment
Pathfinding
F.E.A.R.
• Environnment represented as a graph
• A* is independent of the environnment
C&C Generals
Pathfinding
• A* is divided in three modules– Map– Goal– Storage
• The client application implement these objects
• The A* algorithm will send request to them
Pathfinding
-Goal-Heuristic-Fitness
AStarPathfinderNode
-ID
PathfinderNode
+GetNeighbourCount()+GetNeighbour()
PathfinderMap
+Run()
-SourceNode-DestinationNode-CurrentNode
Pathfinder
AStarPathfinderMap
+GetHeuristic()+GetCost()
-DestinationNode
AStarPathfinderGoal
+IsNodeValid()+IsSearchFinished()
PathfinderGoal
AStarPathfinder
+CreateNode()+DestroyNode()+Reset()+AddToOpenList()+AddToClosedList()+RemoveFromOpenList()+RemoveFromClosedList()+FindInOpenList()+FindInClosedList()+RemoveBestOpenNode()
AStarPathfinderStorage
1
1
1
1
11
-Parent
1
*
CustomPathfinderGoal
CustomPathfinderMap
CustomPathfinderStorage
State machine
• Object-oriented
• States are independent of each others
• State changes are requested
• In the demo, the state machine is mostly driven by the the field of view of the characters
State machine
Idle
Follow
CombatGoto
TargetLost
SearchGuard Patrol
In FOV
FOV = Player in the field of view
In FOVIn
FOV
In FOV
Timer
Collision
Has no waypoint
Has a waypoint
Not in FOV
At destination
Combat ended
Results
• Actual game demo achieved using the two most common AI tehcniques: A* and FSM in a game scenario
Conclusion
• Pros– Objectives achieved– Overall methodology– Reflection system
• Cons– Data-driven system not complete– Some performance issues– Need different behaviours– Need an event-system
Future enhancements
• Scripting
• More behaviours
• Agents’ memory
• Dynamic pathfinding
• Navigational meshes
• More advanced Toolsets
• …