/
potential-ai-in-shooter-advanced.txt
94 lines (87 loc) · 6.17 KB
/
potential-ai-in-shooter-advanced.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
## Notes ##
Very simple, initially
- move toward the player
- shoot
* stop when you die or player dies
Use rules based systems or finite state machines (as of 2003)
Computer controlled enemies stay at a particular skill level and generally stick to a fixed series of rules throughout the game
- human players are constantly learning from fighting previous battles & their characters are usually leveling up
Playing with actual AI in an FPS
- machine learning to teach a bot how to play a shooter
- reinforcement learning so a bot learns which moves are better under given circumstances
AI used to be entirely offensive or defensive if a player entered a given area
Now
- AI 'hunts'
* reacts to signs of the player's existence (e.g. sound of footsteps or a footprint in the dirt)
- AI has 'survival instinct'
* hides if he's out of bullets and needs to reload
* looks for cover in area before attacking player
"Behavior Tree" technology (popularized Halo 2) very popular in FPS industry
F.E.A.R. First Encounter Assault Recon
- AI uses a planner to generate context-sensitive behaviors, the first time in a mainstream game
- This technology used as a reference for many studios still today.
Pathfinding
- can add pathfinding nodes that give weights to certain paths (e.g. you can hop up here but it's difficult, there's no cover here)
- allows computers to be more creative with how bots get from pt 1 to pt 2
- bots working together as a group (no longer oblivious to each other)
TODAY
- percentage of CPU cycles left to process game AI is still limited
Halo
- simulated world, characters and their code are isolated from the world
- ai has simulated senses (vision and hearing) to discover the player
- The Covenant will be here on top of the building. If the player kills three of them, then the Covenant goes to a set of points that are inside the building. What's really happening is the Covenant is following quite simple rules that the player perceives ... as the flow of battle. It seems like the Covenant thinks they have been weakened, so they retreat to a more defensive position. In fact, they are actually just following quite specific rules that have been laid out for them in that space.
- simple if/then statements ("Elite I was with was killed, I'll run away") can seem like emotional responses ("fear")
* The character uses its AI "senses" to perceive the world -- to detect what's going on around it.
* The AI takes the raw information that it gets based on its perception and interprets the data.
* The AI turns that interpreted data into more processed information
* The AI makes decisions about what its actions should be based on that information.
* Then the AI figures out how it can best perform those actions to achieve the desired result based on the physical state of the world around it.
- four states of the combat cycle
* Idle
* Guard/Patrol
* Attack/Defend
* Retreat
- Not necessarily looking for unpredictability. Sneaking up behind a certain character type to make them run should work consistently in a game.
- Pathfinding, objects are tagged, ai knows it can run through small objects but must go around larger ones / larger players know they can go through larger items
- cover tag is attached to an object, not to a space so if object is destroyed, ai won't try to take cover there any more
Call of Duty: Ghosts
- set them to Veteran level and they take more shots to kill
Finite State Machine vs Behavior Tree
- finite state machine has only one state at a time (only one process can be run)
- behavior tree allows for parallel processes
- allows ai to adapt to current game states more easily than FSM
- would take lots of states/transitions for FSM to achieve same behavior
- behavior trees are easy to change
- simply move node for different behavior, no need to worry about transitions
- BTs strength is creating complex tasks composed of simple tasks (w/o worrying about implementation of simple tasks)
- root, control flow nodes, execution nodes (tasks)
- for connected nodes, outgoing is parent, incoming is child
- control flow have at least 1 parent and 1 child
- execution have at least 1 parent and 0 child nodes
* running of BT starts from root and sends a 'tick' w/certain frequency to children
- tick is enabling signal that allows execution of a child
- if execution of node is allowed, it returns one of 3 messages to the parent node
- running: execution has not finished
- success: goal was achieved
- failure: all other instances
- control flow node controls the subtasks that compose it (runs each subtask in turn and decides what to do when success/failure is returned)
- sequence node: find and execute the first child that has not succeeded
- selector (fallback) node: find and execute the first child node that doesn't fail
- Types of behaviors
- Conditions & Actions
- conditions check the status of something in the world (e.g. is enemy nearby?)
- actions do something that alters the world in some way (e.g. pick up pickaxe)
- Decorator
- adds flexibility to control an action without changing it's code (e.g. loop or timer)
- Sequences
- set of behaviors which must all complete for the sequence to succeed (e.g. approach enemy = locate enemy, plan path to enemy, follow path to enemy)
- Selectors
- set of behaviors where 1 must complete in order for the selector to succeed (e.g. attack enemy = gun attack OR knife attack OR magic attack)
- Parallels
- set of behaviors that all run simultaneously (e.g. attack enemy = approach enemy, gun attack, taunt enemy)
- a policy defines success or failure in a parallel
- if parallel succeeds/fails, all child processes must be terminated
Behavior tree is 'brain' of AI
### Script ###
Previously on CompChomp we tale
Even with upgraded versions of these technologies inlcuding Behavior Trees and advanced pathfinding, the AI in modern FPS's isn't much better at these games than an 8-year-old with a noob tube. Instead developers rely on cheater moves like increasing bullet damage for NPCs and allowing bots to see through walls in order to increase the difficulty levels (I'm looking at you Call of Duty).