Index

Note: Page numbers ending in “e” refer to equa- control-based architecture for, 531–538 tions. Page numbers ending in “f” refer to figures. game extensions, 536–537 Page numbers ending in “t” refer to tables. gosling control system, 537 A hierarchical control system, 535–536, 535f introduction to, 531–532 academic AI, 3–5, 8, 66. See also Game AI negative feedback controller, 533–537, 533f, action potential, 15–21, 16f, 17f, 18f 534f agent threat response, 391–398 perceptual control system, 533–535 AI Game Programming Wisdom, 437 purposeful behavior, 531–532 AI Techniques for Game Programming, 391 animation-driven locomotion. See also alibi generation locomotion background of, 460 action-stack, 328–330, 329f choosing alibis, 465–466 commercial implementation, 334 computing, 464e executing actions, 331–333 deleting characters, 466–467 implementing, 331–332, 334 distribution, 463, 465 introduction to, 325 fooling players, 459–467 inverse kinematic (IK) controllers, 333 generating, 464–467 locomotion planning, 325–334 hybrid generation, 466 movement architectures, 326 ideal world, 460–462, 462f, 465 navigation paths, 327–328, 328f initial generation, 462–463 nontransfer actions, 331–332 introduction to, 459–460 performance of, 333–334 maintaining characters, 466–467 preparation for, 326–327 necessity of, 463–464 transfer actions, 325, 330–333 options for, 465–466 architectures perturbation, 466 for animal behavior, 531–538 population size, 462–463 for background characters, 453–455 position selection, 463 for blackboards, 61, 66–67, 214–215 Anguelov, Bobby, 297 for character-rich social simulation, 515–530 animal behavior CiF architecture, 516–529 control systems for, 532–537 common architectures, 62–63 control theory, 532–533 for Game AI, 5–7, 6f, 45–60

581 for hierarchical AI, 378–379, 379f behavior scheduler, 88–90 hybrid architecture, 146 behavior selection algorithms integrated architectures, 231–232 behavior trees, 52–53 movement architectures, 326 chaining search, 56 pathfinding optimizations, 241–252 finite-state machines (FSMs), 48–52 for racing games, 471–479 goal-oriented action planning (GOAP), 7, structural architecture, 61–71 55–59 for tactical positions, 338–339, 339f hierarchical finite-state machines (HFSMs), three-layer architecture, 146f 50–52 Argyle, Michael, 448 introduction to, 47 artificial intelligence (AI), 3–4.See also Game AI solutions for, 57–60, 149–150, 163, 167 Artificial Intelligence for Games, 52, 391 for tactical position selection, 342–343 artificial sound designer (ASD) utility systems for, 53–55 database for, 551–553 behavior trees for dynamic sound, 549–555 actions for, 52–53, 75–76, 99–111 explanation of, 550–551 advanced behavior trees, 84–90 generating events, 551 autonomy and, 130, 136 play-request events, 554 behavior concepts, 75–76 rule set for, 553 behavior selection algorithms, 52–53 updating, 554–555 building blocks of, 75–84 attribute checking, 226–228 C++ and, 214–215 authorial control, 5, 6f completion status for, 76 autonomy composites of, 78–79 approximations of, 130 conditions for, 75–78 behavior trees and, 130, 136 constraints for, 100, 103–106 in CiF, 515–516, 525–528 for decision-making, 130–132, 137 in collision system, 565–566 decorators, 78 in Game AI, 6f, 99–102, 138 evaluation and, 134–136 in OpenCL, 541 event-driven behavior, 88–89 in robots, 383 examples of, 74–76, 100f, 129–130, 129f, 130f in squad AI, 383, 515 execution and, 134–136 avoidance point (AP), 302–304 execution hints, 76 B explanation of, 52–53 extensibility, 53 background characters. See also characters filters, 80 actions for, 454–455 finite-state machines (FSMs), 63 architecture for, 453–455 first-generation trees, 84–85 breathing life into, 451–458 flexibility of, 73, 98 game objects, 454–455 hybrid approach to, 99–111 improvements on, 457–458 initialization of actions, 77 introduction to, 451 introduction to, 73, 99–100, 127–128 schedule entries for, 453–454 leaf behaviors, 77, 90, 94, 134 schedule system for, 452–453 leaf nodes, 75–77, 102, 134–135, 222 schedule templates for, 456 memory access performance, 86–87 techniques for, 452 modular behaviors, 91 Bednarz, Tomasz, 539 monitoring, 77–78, 83 behavior, representing, 12 node implementations, 85–87 behavior asset management, 96 overview of, 74–75 behavior class improvements, 97 performance of, 6 behavior observers, 88 planner hybrid, 102–103

582 Index planners, 101–103, 101f, 111 camera size, 565 popularity of, 128 collision flags, 565 preconditions, 52–53, 80 collision reaction, 565–566 propagating utility, 134 collision system, 565–566 real-world behavior trees, 93–98 competing cameras, 559 return statuses, 76–78 configuration of, 560–561 Runtime Compiled C++ and, 214–215 data driven approach, 561 second-generation trees, 84–85 debugging, 558–559 selectors, 63, 80–81, 83–84, 102–103, 129–133, distance from cameras, 562, 563f 132f explanation of, 557–558 sequences, 79–80 features of, 563–565 sharing between entities, 85–86 first-person camera, 562 shutdown of actions, 77 fixed cameras, 562 simplicity of, 53 input transform, 560 simulating, 99–111 introduction to, 557 starter kit for, 73–91 managing multiple cameras, 559–560 strength of, 53 object references, 561 transient data allocation, 88 occlusion reaction, 566 updating, 74–75 orbit cameras, 562–564, 564f utility decisions for, 127–136, 131e over-the-shoulder cameras, 562 utility selector, 132–133, 132f priorities, 561 utility theory, 130 on rails, 563 utility value, 131–135, 135f spline for, 563–564, 564f variations of, 84–91 sweet spot for, 564–565 Behavioral Mathematics for Game AI, 55 third-person camera, 562 behaviors, debugging, 97–98 tips for, 557–566 Beij, Arjen, 389 tracking cameras, 562 Belgian AI, 370, 373–374 transitions, 559–560 bell curves, 30. See also Gaussian randomness view manager, 559 Binks, Doug, 201 Carlisle, Phil, 433, 441 Bjore, Stephen, 289 central limit theorem, 30–31, 31f blackboard architecture, 61, 66–67, 214–215 Champandard, Alex J., 73, 377 Bodily Communication, 448 character blackboards, 66–67 Boolean flag, 226, 247, 345, 517, 529 character criticality, 188–189 Boolean questions, 53–55, 54e character-rich social simulation. See also Bourke, Conan, 539 characters break in realism (BIR), 187–188, 191–193 character representation, 520–521, 520t Bresenham line algorithm, 311 CiF architecture, 516–529 Brewer, Daniel, 361 explorer interface, 518, 519f Brink, 343, 344 interaction approaches, 527–528 “bucketing,” 121–122, 121f introduction to, 515–516 , 84, 325, 334, 342, 349, 357, 423–424, related work, 528–529 430–431 social exchanges, 517, 518f, 523–527, 523t C social facts knowledge base (SFKB), 522–523 social state, 521–523 C++ for rapid AI, 201–217 story goals, 517, 519f camera system characters activation rules, 561 background characters, 451–458 behavior of, 561–563 breathing life into, 451–458 bones for, 564 components of, 441–449, 448f

Index 583 social dynamics system, 441–450 criticality, measuring, 189 social simulation of, 515–530 crowd pathfinding Ciupinski, Jaroslaw, 325 algorithm for, 311 collision avoidance Bresenham line algorithm, 311 agent collision radius (ACR), 300 cost data, 314 animation-driven locomotion, 297–299 cost fields, 308–309 introduction to, 297 cost integration pass, 311–312 for locomotion, 299–300 cost stamps, 314–315 path modification system, 302–304, 303f CPU usage and, 315–316 reciprocal velocity obstacle technique, dynamic environments, 313–314 297–299, 304–305 dynamic flow field tiles, 307, 323 time per movement, 300 field types, 307–309, 323 velocity vector, 300 flow field cache, 313 collision detection, 299–302, 300f flow field pass, 312–313, 313f collision resolution, 299–304, 304f flow fields, 307–318, 313f, 319f, 320–323 collision sphere motion, 301 integration fields, 308–310 collision system, 565–566 integration steps, 310–311 combat maneuvers integrator, 310 examples of, 173t, 174f, 175f, 176f introduction to, 307 introduction to, 169 island fields, 315 multi-unit planning, 170–171, 170f, 172f, 181f line of sight (LOS) pass, 310–311, 312f planning for, 169–183 motivation for, 307–308 plan-space planning, 172–182, 181f movement types, 314–315 Comme il Fault (CiF) architecture, 515–529 path costs, 308–309, 311–312 Company of Heroes, 246 path requests, 310 Computational Brain, The, 12 world layout, 308–309, 309f control system crowd simulation adaptive control, 497–498 algorithm for, 318–319, 322–323 for animal behavior, 532–537 closed-loop control, 492–493, 492f flow fields, 318–319, 319f, 322–323 control theory, 492–494 flow function, 318–319 explanation of, 532–533 future of, 322–323 hierarchy of, 535–536, 535f grid for, 317–318 introduction to, 491–492 introduction to, 317 negative feedback controller, 533–537, 533f, steering behaviors, 315–316, 319–321 534f units for, 319–321, 320f open-loop control, 492–493, 492f CryENGINE, 203, 337, 406, 411 other racing applications, 498–500 CryENGINE 3, 203, 404, 411 perceptual control system, 533–535 CryEngine Free SDK, 341, 411 PID controllers, 494–500 Crysis 1, 348 predictive control, 498 Crysis 2, 128, 214, 215, 337, 343–344, 348, 352, for racing games, 491–500 356, 358, 404 cost data, 314 D cost fields, 308–309 cost integration pass, 311–312 Da Vinci, Leonardo, 403 cost stamps, 314–315 “danger awareness,” 144–145 Côté, Carle, 137 Dawe, Michael, 47, 93, 369 Crackdown 2, 406 decision-making systems Creatures, 5 action selector, 143f, 144f, 145f critical thinking skills, 11–12, 26 behavior trees for, 130–132, 137

584 Index behavioral artifacts, 141f, 142f, 144f E conceptual model for, 144–147, 145f electrical attraction, 13. See also neurology deliberation and, 137–147 electrical processing myth, 12–13 finite-state machines (FSMs), 137–143, 140f, Embodied Conversational Agents, 443 143f, 146 Emerson, Elijah, 307 goal-oriented action planning (GOAP), 137 Environment Tactical Querying (ETQ) graphical modeling language-based models, anatomy of, 425–426 137 components of, 425 hierarchical finite-state machines (HFSMs), context object, 425 137 editor tool, 428–429, 429f introduction to, 137 final tests, 430 multiple decision models, 142 goals for, 424 pitfalls of, 139–147 implementation details, 428, 431 reactivity and, 137–147, 138f, 139f improving, 430–431 selector switch, 143f merging tests, 430 symbolic planning language-based decision motivation for, 423–424 models, 137 multithreaded implementation, 431 three-layer architecture, 146f overview of, 423–424 timeline of, 138f, 139f, 141f, 142f, 144f, 145f philosophy on, 424 utility theory for, 130–132 pros/cons of, 430 deduplication technique, 226–227, 234 query template, 425, 428–429, 429f Delaunay Triangulation Decompositions, 256, reversed processing, 431 260, 265 test structures, 425–428, 427t, 430–431 deliberation validity tests, 426 in decision-making systems, 137–147 EverSky, 433–440 examples of, 145f, 146f exponential moving average (EMA), 189, 189e, explanation of, 139 190e, 190f depolarization, 16 Deus Ex: Human Revolution, 55 F Dicken, Luke, 47 Far Cry, 343–344, 348 diffusion coefficient D, 14e F.E.A.R., 55 diffusion equation, 14e Fieldrunners 2, 317–323 diffusion technique, 13–15 filtered randomness. See also randomness Dijkstra algorithm, 247, 280–281, 284–285, techniques 318–319, 322–323 anomalies, 35–37 Dill, Kevin, 3, 61 binary randomness, 35–36 disbelief, suspension of, 4 explanation of, 30, 34–38, 43 Disney, Walt, 3 floating-point ranges, 36–37 domain-specific language (DSL), 227–231, generating, 34–37 340–341 implementing, 37–38 Dragon Age: Origins, 246, 255, 274, 285 integer ranges, 36 Dragon Quest, 122 integrity of, 37 Dragon Warrior, 122 Final Fantasy, 122 dual utility AI, 121–122 Final Fantasy XIV: A Realm Reborn, 269–271, Dunstan, Philip, 73 270f, 285 dynamic environments, supporting, 313–314, finite-state machines (FSMs) 352, 423 behavior trees and, 63 dynamic flow field tiles, 307, 323 for decision-making systems, 137–143, 140f, dynamic link libraries (DLLs), 203–204 146

Index 585 examples of, 48–49, 48f, 50f, 51f, 140f, 143f simplicity in, 6–7 states of, 48–52, 57–58 structural architecture, 61–71 for structural architecture, 63 stylized AI, 567–580 transitions of, 48–52 utility-based AI, 63 first-person shooter (FPS), 62–63, 121–122, 241, Game Engine Architecture, 437 377, 453 Game Programming Gems 2, 391 Fitch, Bob, 7 Gargolinski, Steve, 47 flow fields, 307–318, 313f, 319f, 320–323 Gaussian randomness. See also randomness Forbes, Kevin, 421 techniques formation movements applications of, 32–33, 43 band formation, 294 explanation of, 29–33 calculating positions, 290–293, 290f, 291e, filtering, 37 292f, 293f generating, 31–33, 33f column formation, 294 uniform distribution and, 30–33, 33f introduction to, 289 : Judgment, 430 navigating, 293–295 global blackboards, 66–67 path generation, 289–293, 290f goal stack, 65 , 579 goal-oriented action planning (GOAP) Franco, Simon, 549 for behavior selection algorithms, 7, 55–59 From Neuron to Brain, 12 for decision-making systems, 137 fundamental discontinuity (FD), 188 for first-person shooter (FPS), 63 Funge, John, 52 as single-unit planner, 170 Furman, Lukasz, 431 speeding up planning, 165 G structural architectures, 63 Goldblatt, Jay, 29 Game AI GPGPU architectures for, 5–7, 6f, 45–60 converting to, 541–542 authorial control, 5 flocking, 541–542 behavior selection algorithms, 47–60 history of, 540 behavior trees, 6, 73–91, 93–111, 127–136 introduction to, 539–540 C++ for, 62, 201–217 OpenCL, 540–542 cheating and, 7–8 OpenCL setup, 542–545 controlling, 62 results for, 545–547, 546f creating experience with, 4–9 sharing processing, 545 definition of, 3 Graham, David “Rez,” 55, 113, 451 description of, 3–9 graphical modeling language-based decision goal of, 4, 8–9 models, 137 GPGPU for, 539–547 Gravot, Fabien, 269 heuristic functions of, 5–6, 63–64, 102–104 Green Eggs and Ham, 577 introduction to, 3–9 Gregory, Jason, 437 LOD trader, 185–200 Growth-Based Approach to the Automatic neurology and, 11–27 Generation of Navigation Meshes, 266 N-grams for, 567–580 H nondeterminism, 5, 6 purpose of, 4, 8–9 Hale, D. Hunter, 259 racing games for, 471–479, 481–490 2, 84 randomness techniques for, 29–43 Halo series, 128 rule-based AI, 63 Havok Script, 203 scalability in, 6–7 heat vision system scripting and, 219–237 explanation of, 502

586 Index heat line, 502–503, 504f plan-space planning, 172–175, 172f, heat signatures, 502–505, 503f 180–182, 180f, 181f implementation, 504–505 primitive tasks, 58–59, 152–154, 380, 381t, introduction to, 501 384t output smoothing, 502 priority plans for, 160–163, 161f for racing, 501–505 recursion for, 157–158 track position, 502–505, 504f sensors for, 152 Hebb, Donald, 22 simultaneous behaviors, 163–165 Hebb rule, 22–23, 22e, 23e speeding up planning, 165–167 Hertel–Melhlorn decompositions, 265–267 state changers, 150–153, 155–159 heuristic functions, 5–6, 63–64, 102–104. tasks of, 57–59 See also Game AI world state changers, 150–153, 155–159 hierarchical AI. See also multiplayer bots Hilburn, Daniel, 99 in action, 388 Hitman: Absolution, 297, 299, 305 architecture for, 378, 379f Homeworld, 541 commander AI, 378, 379f, 386–388 HTN planners. See also hierarchical task cover data, 383 networks description of, 378 building blocks of, 150–154 future of, 388 compound tasks, 152–154 individual layer, 378, 379f domain for, 151f, 154–155, 157f, 161f influence maps, 384–385 exploring, 149–167 introduction to, 377 introduction to, 149–150 level annotations for, 388 method traversal record (MTR), 161 for multiplayer bots, 377–390 overview of, 150–151, 151f pathfinder for, 386f partial plans, 165–167 primitive tasks, 380, 381t, 384t primitive tasks, 152–154 squad AI, 383–384 priority plans for, 160–163, 161f squad layer, 378, 379f recursion for, 157–158 squad tactical reasoning, 384–386, 386f running plan, 156–157 squad update loop, 383–384 sensors for, 152 strategic graphs, 384–385 simultaneous behaviors, 163–165 tactical reasoning, 383 speeding up planning, 165–167 waypoint graphs, 383 state changers, 150–153, 155–159 hierarchical finite-state machines (HFSMs), world state changers, 150–153, 155–159 50–52, 51f, 137 Humphreys, Troy, 47, 149 hierarchical pathfinding, 246 hybrid architecture, 146 hierarchical reasoning, 61–62, 64, 69 hyperpolarization, 16 hierarchical task networks (HTNs) hysteresis, 18–19 building blocks of, 150–154 I compound tasks, 58–59, 152–154 domain for, 151f, 154–155, 157f, 161f “illusion of intelligence,” 3–4 examples of, 58–59, 149–167 “illusion of life,” 3 exploring planners, 149–167 inertia, 65, 122 for first-person shooter (FPS), 63 instant check mode, 77–78 introduction to, 149–150 intelligence, illusion of, 3–4 method traversal record (MTR), 161 intelligence, placing, 67–68 for multiplayer bots, 380 interest sources overview of, 150–151, 151f for agent scripting, 420 partial plans, 165–167 definition of, 416–417 plan for, 155–156 examples of, 414–417, 415f

Index 587 group behavior, 417–418 events, 436, 439 improvements on, 420–421 execution, 438 investigation, 419–420 existence, 435 limitations of, 420–421 implementation, 437–438 prioritizing interests, 418–419 introduction to, 433 rediscoverability, 419–420 of others, 436 updates from, 417–418 semantic knowledge, 436 Introduction to Utility Theory, An, 55 sensing, 438 inverse kinematic (IK) controllers, 333 serialization, 439 ion channels, 15–17 set membership, 435–436 ion concentration, 13–17, 14f. See also neurology social dynamics system, 441–450 Isla, Damian, 6 system for, 433–440 island fields, 315 Kohan 2, 8 J Kore Script, 203 Kung-Fu Circle, 369–370 Jack, Matthew, 201, 337 L James, William, 532 Jedi AI Laming, Brett, 11 actions for, 103–111 Laplacian operator, 14 changes to, 108–111 level-of-detail (LOD) control, 185–200. constraints for, 103–106 See also LOD Trader Jedi behavior tree, 103–107 Lewis, Mike, 219 Jedi memory, 103–107 life, illusion of, 3 Jedi mistakes, 110–111 lifelike characters, 451–458. See also characters Jedi simulation, 107–108 linear probability, 187e, 187f Jedi skill levels, 109–110 locomotion Johansson, Jonas, 358 animation-driven locomotion, 297–299, Johnson, Tatham, 421 325–334 Just Cause 2, 55 collision avoidance for, 299–300 K collision sphere motion, 301 introduction to, 297 Kernighan, Brian, 7 movement and, 297–305, 325–334 2, 57 performance of, 304–305 , 343, 377–390 planning, 325–334 Kinect Star Wars, 103–111 preplanned locomotion, 297–305 Kingdoms of Amalur: Reckoning, 93–98, 369–374 reciprocal velocity obstacle technique, Kirst, Kevin, 358, 404 297–299, 304–305 Kleve, Hylke, 377 time per movement, 300 knowledge management, 66–69 velocity vector, 300 knowledge representation visual quality of, 304–305 accessing knowledge, 439 LOD Trader agent awareness and, 401–440 algorithm for, 192–199 blackboards, 437, 439 break in realism (BIR), 187–188, 191–193 character behaviors, 433–434 character criticality, 188–189 character relationships, 435–436 defining problems, 186–187 classifications, 435 expansion heuristic, 196–197, 197e debugging scripts, 439 expansion queue, 195–196, 198 design requirements, 433–434 exponential moving average (EMA), 189, entity attributes, 434–435 189e, 190e, 190f event handling, 439 extensions to, 198–199

588 Index features of, 193–194 navigation system, 271, 271f, 284–285 introduction to, 185–186 overview of, 270–271 memory model, 191e pathfinding for, 269–287 modeling costs, 191 pathfinding requests, 276–277, 276f multiple resources, 197–198 precomputed solutions for, 269–287 observability, 189–190 problematic components, 281–284, 282f, 283f in practice, 199–200 results for, 284–285 probability and, 186–188 screenshot of, 270f resource multiplier vector, 197e smoothed distances, 284 return time, 191e table builder, 279–280, 280f transitions, pruning, 196–197, 196e table builder algorithm, 284–285 logarithmic probability, 187e, 187f table connectivity, 275, 275f, 277f Lorenz, Konrad, 537 table generation, 274–276 Lua scripting language, 94–97, 202, 215, 232, table generation algorithm, 278–281 340–341, 439, 553, 561 table inconsistencies, 281–282, 282f M table size, 285 table use on server, 284 Mark, Dave, 47, 55 tool chain, 271 Mark of the Ninja, 413–421 MMORPG, 255 Martel, Eric, 557 mobile games, 317–323. See also crowd simulation Martins, Márcio, 358 modularity, 61, 68–69, 128, 150, 162–163, 167 Mateas, Michael, 515 monitoring mode, 77–78 Matrix, The, 403 Morcus, Robert, 377 McCoy, Josh, 515 morphology, 19–20, 20f Melder, Nic, 471, 491, 501, 507 Mortal Kombat, 567 memory access performance, 86–87 movement. See also locomotion Merrill, Bill, 127 agent collision radius (ACR), 300 method traversal record (MTR), 161 animation-driven locomotion, 297–299, Miles, Brook, 413 325–334 Millington, Ian, 52 collision avoidance for, 297–305 Miyake, Youichiro, 269 collision resolution, 302–303 MMO games crowd simulation for, 317–323 algorithm for, 278–281, 284–285 pathfinding and, 239–252 alternative uses, 285 reciprocal velocity obstacle technique, component approach, 274–276, 277f 297–299, 304–305 component center, 281–284, 282f time per movement, 300 connectivity for, 275, 275f, 277f, 278 velocity vector, 300 convexity problems, 282 multilayer perceptrons (MLPs), 392–396. distances between polygons, 279, 279f See also neural networks falling meshes, 278 multiplayer bots. See also hierarchical AI flow chart of, 271f architecture for, 378–379 hierarchical levels, 277, 277f bot AI, 378, 379f hierarchical table builder, 280, 280f commander AI, 386–388 inconsistencies in, 281–282, 282f cover data, 383 introduction to, 269–270 description of, 378 invalid sublinks, 283–284, 283f hierarchical AI for, 377–390 maps for, 285, 286f individual layer, 379–380, 379f, 380f mesh generation, 271–273, 272f, 273f, 274f individual planner, 380–383 navigation meshes, 271–273, 272f, 273f, 274f, individual tactical reasoning, 383 285, 286f influence maps, 384–385

Index 589 introduction to, 377 electrical attraction, 13 pathfinder for, 386f electrical processing myth, 12–13 squad AI, 383–384 EPSP (excitatory postsynaptic membrane squad tactical reasoning, 384–386, 386f potential), 20–21 squad update loop, 383–384 equilibrium, 15 strategic graphs, 384–385 Game AI and, 11–27 strategy for, 377–390 hyperpolarization, 16 strategy layer for, 378, 379f hysteresis, 18–19 waypoint graphs, 383 introspection, 11–12 N ion channels, 15–17 ion concentrations, 13–17, 14f navigation meshes (NavMeshes) IPSP (inhibitory postsynaptic membrane cover representation, 364–367 potential), 20–21 CoverMap, 364–367, 364f, 365f membrane channels, 15–17, 16f, 18f creating, 259–267 membrane potential, 15–17, 16f in MMO games, 271–273, 272f, 273f, 274f membraned pumps, 13 path segment calculations, 365–366, 366f morphology, 19–20, 20f search space representations, 246f, 253, motor neuron, 24–25 254f, 255–267 myelin sheath, 20, 20f tactical pathfinding and, 361–368 neurons, 12–15, 14f, 19–20, 20f, 21f tessellating and, 363 neurotransmitters, 20–21, 21f neural networks open-loop ballistics, 25 behavior adjustments, 397 pathways, 24–25, 24e benefits of, 397–398 perceptron, 22–23, 22e, 23e, 27 debugging, 396–397 perturbation, 15 drawbacks of, 398 plasticity, 20–22 explanation of, 392 postsynaptic receptors, 20–21, 21f fitness function, 394–397 proprioceptors, 25 hidden nodes, 393–394 Ranvier nodes, 20, 20f inputs for, 392–393 reflex arc, 24–26, 24e, 24f introduction to, 391 refractory period, 16, 17f learning parameters for, 395–396 repolarization, 16, 18f multilayer perceptrons (MLPs), 392–396 resting potential, 13 outputs for, 393, 395e saccades, 25 performance of, 397 Schmitt trigger, 18–19 setting up, 392–394 signal transmission, 17–18, 18f training, 394–397 soma, 19–20, 20f neurology spike activity, 15–21 action potential, 15–21, 16f, 17f, 18f stimuli on brain, 24, 24t axon, 19–20, 20f study of, 12–27 axon terminals, 19–23, 20f synaptic cleft, 20–21, 21f cell location, 15e synaptic transmission, 20–21, 21f cell membrane, 12–13 vesicles, 20–21, 21f critical thinking skills, 11–12, 26 voltage, 12–13 dendrites, 19–20, 20f neurons, 12–15, 14f, 19–20, 20f, 21f depolarization, 16 neurotransmitters, 20–21, 21f diffusion coefficient D, 14e N-grams diffusion equation, 14e changes to, 577–578 diffusion technique, 13–15 computation time, 573 efference copy, 25 corpus, 577

590 Index events and, 571–572, 572e, 573e, 574–580 sound interest sources, 415–416, 415f explanation of, 568–571 vision cones, 415–416, 415f future research on, 579–580 NPC goals, 56–59 implementing, 571–578 O introduction to, 567–568 issues with, 571 OpenCL, 540–542 large numbers and, 571 OpenCL setup, 542–545 memory for, 578 open-loop ballistics, 25 mimicking style, 576–577 optimization. See pathfinding optimizations new trends, 578 option stacks, 61–62, 65–69 offline learning, 576 Orkin, Jeff, 55 order of, 568–569, 569f, 570t P pattern occurrences, 572–573, 572e, 573e player imitation, 579–580 Paris Game/AI conference, 215–216 for player prediction, 567–580 path modification system, 302–304, 303f power of, 578–579 pathfinding.See also pathfinding optimizations predicting with, 569–575 architecture optimizations, 241–252 probability and, 568–570, 568e, 570e, 571e, avoidance point (AP), 302–304 579 crowd pathfinding, 307–316 for procedural generation, 567–580 crowd simulation, 317–323 robustness for, 272 flow field tiles, 307–316 Rock-Paper-Scissors game, 571–575, 573e movement and, 239–252 self-accountability and, 573–574 navigation meshes for, 259–267 time delays, 575, 579 on NavMesh, 361–368 understanding, 568–571 path modification system, 302–304, 303f Nicholls, J. G., 12 precomputed pathfinding for MMO servers, nondeterminism, 5, 6 269–287 nontrivial collision resolution, 302–304 reconnection point (RP), 302–304 NPC attacks search space representations, 253–258 behavior integration, 372–374 steering circles for, 289–295, 307–316 Belgian AI, 370, 373–374 tactics for, 361–368 capacity for, 370–371 pathfinding optimizations circles approach, 371–373, 373f A* implementation, 242–250 concerns about, 373–374 backtracking issues, 249 grid assignments, 374–375 bad ideas for, 249–250 grid capacity, 370–371, 371f better heuristics, 248 grid sectors, 371–372 bidirectional pathfinding, 250 introduction to, 369 caching successors, 249–250 Kung-Fu Circle and, 369–370 differences in, 242 managing, 369–375 Euclidean embedding, 244–245, 245f restrictions on, 374–375 failed paths, 250 scaling difficulty, 373 hierarchical pathfinding, 246 troll, 372f high-quality heuristics, 242–245 NPC awareness implementing, 242–250 examples of, 47 introduction to, 241–242 finite-state machines and, 48–52, 50f, 56–58 look-up table for, 243–244, 243f interest sources, 414–418, 415f lossless compression, 244 introduction to, 413–414 lossy compression, 244 senses, 415–416 magnitude of, 242–245 sight interest sources, 415–416 open list sorting, 248–249

Index 591 optimal search space representation, 245–246, channel cross-over, 499 246f characteristics of, 493–494, 493f, 494e, 494t overestimating heuristics, 247e closed-loop control, 492–493, 492f path generation, 243–244, 243f debugging, 496 preallocating memory, 246–247 derivative control, 495 Roy–Floyd–Warshall algorithm, 242–244, designing, 496–497 243f, 248 determining success, 496 search space representations, 245–246, 246f drifting, 499 simultaneous searches, 249–250 error memory, 495 techniques for, 242–250 error offset, 496 pathways, 24–25, 24e gain scheduling, 497 Pentheny, Graham, 317 grip loss, 499 perception system implementing, 495–496 ADSR envelopes, 408–410, 409f input data, 496 attack phase, 409 integral control, 494–495 data driving, 410–411 introduction to, 491–494 decay phase, 409 K values, 496, 497 introduction to, 403 model reference adaptive control (MRAC), modifiers, 410 498 overview of, 404–405, 404f open-loop control, 492–493, 492f perception manager, 404, 404f, 407–408 other racing applications, 498–500 pulses, 410 predictive control, 498 release phase, 410 priority mixing, 499–500, 500e sight stims, 406 proportional control, 494 sound stims, 405–406 for racing games, 491–500 stims, 404–407, 404f, 407t recovery behavior, 499 sustain phase, 409–410 speed controller, 498–499 target tracks manager, 404, 404f, 408–409 steering controller, 498 threat levels, 410 stopping distance, 499 perceptron, 22–23, 22e, 23e, 27. See also time constants, 495 neurology tuning, 496–497 Perlin, Ken, 38 planning combat maneuvers Perlin noise. See also randomness techniques examples of, 173t, 174f, 175f, 176f, 179f amplitude, 40–42 introduction to, 169 controlling, 42 multi-unit planning, 170–171, 170f, 172f demo of, 42 planning for, 169–183 equation for, 40e, 42e plan-space planning examples of, 38f for combat maneuvers, 169–183 generating, 40–43 combinatorial explosion, 180 interpolation choice, 42 efficiency of, 180–182, 180f, 181f octaves of, 40–42, 41f examples of, 171f, 172f, 173f, 179f in one-dimension, 30, 38–43, 39f, 41f future of, 182 persistence value, 40–42 introduction to, 169 purpose of, 38–39 partial plans, 178–180 sampling, 42 plan of tasks, 173–175, 173t, 174f, 175f, 176f perturbation, 15, 466, 489 planner main loop, 172–173, 182 PHP script, 202 planner methods, 175–178, 177t PID controllers plasticity, 20–22. See also neurology adaptive control, 497–498 play testing, 160, 236, 388 braking distance, 499 players, fooling, 459–467

592 Index players, predicting, 567–580 open-ended tracks, 483 Pokémon Ruby Version, 580 piecewise linear curves, 486, 489 Pokémon Sapphire Version, 580 racing lines, 486, 488–490 Powers, William, 535 radius of, 485f, 486, 486e precomputed pathfinding, 269–270. See also registration of, 484–485, 484e, 485f pathfinding representation of, 482–484, 482f procedural generation, 567–580. See also segments of, 482f N-grams splines, 489–490 procedural knowledge, 144–145 steering, 486–487 Prom Week, 515–527 tactical information, 489 Pulse, 204f, 207 track data calculations, 484–486 Punch-Out!, 578 track positioning tips, 501–505 Python scripting language, 215, 232, 561 wall avoidance, 487–488 Q racing games. See also PID controllers; race tracks 3, 265 AI controlled vehicles, 481–490 queries architecture for, 471–479 anatomy of, 425–426 balancing AI, 476–478 components of, 425 branches, 475 context object, 425 collision avoidance, 472 editor tool, 428–429, 429f defend and block state, 475 final tests, 430 driver persona, 472–473 goals for, 424 driving behaviors, 473–476 implementation details, 428, 431 for Game AI, 471–479, 481–490 improving, 430–431 heat vision system for, 501–505 merging tests, 430 interfaces for, 476 motivation for, 423–424 introduction to, 471 multithreaded implementation, 431 layers of, 472 overview of, 423–424 managing game play for, 507–512 philosophy on, 424 multiple routes, 475 pros and cons of, 430 offline learning, 477–478 query template, 425, 428–429, 429f overtaking mode, 474–475 reversed processing, 431 perturbation, 489 tactical queries, 424–431 physics of, 471–472 test structures, 425–428, 427t, 430–431 race choreographer, 476 validity tests, 426 racing behaviors, 473–476 R recovery behavior, 475–476 rubber-banding system for, 477, 507–512 Rabin, Steve, 29, 241 track for, 481–490 race tracks. See also racing games track positioning tips, 501–505 alternate lines, 489 Ramsey, Michael, 531 braking distance, 487, 487e randomness techniques branches, 483 filtered randomness, 30, 34–38, 43 corner speed, 487, 487e Gaussian randomness, 29–33, 43 curvature of, 485f, 486, 486e introduction to, 29–30 defending lines, 489 Perlin noise, 30, 38–43 driving, 486–488 rapid AI development, 201–217 generating, 483, 483e reactivity introduction to, 481–482 of characters, 5 node spacing, 483–484, 485f cognitive reactions, 138–139, 144–145

Index 593 danger awareness, 144–145 RTS games, 245, 309, 316, 384, 541, 545–546, in decision-making systems, 137–147 575, 578 examples of, 145f, 146f rubber-banding system explanation of, 138–139 difficulty-based rubber-banding, 508–509, involuntary reactions, 138–139, 144 509f procedural knowledge, 144–145 disabling, 510 timeline of, 138f, 139f first place rubber-banding, 511 realism implementation of, 507, 508f break in, 187–188, 191–193 improvements in, 510–511 fundamental discontinuity (FD), 188 introduction to, 507–508 unrealistic long-term behavior (ULTB), 189 issues, 509–510 unrealistic state (US), 188 for long races, 512 visual realism, 449 for multiplayer modes, 510 real-world behavior trees. See also behavior trees parameters for, 511 behavior asset management, 96 power-based rubber-banding, 508–510, 509f behavior class improvements, 97 race pace system, 512 debugging behaviors, 97–98 for racing games, 477, 507–512 defining, 94–97 rule-based AI, 63. See also Game AI enhancements of, 96–98 Runtime Compiled C++ (RCC++) flexibility of, 98 approaches to, 202–205 integration of, 95 behavior trees and, 214–215 introduction to, 93 blackboards and, 214–215 Lua scripting language, 94–97 code optimizations for, 213–214, 216 overview of, 93–94 code-state preservation of, 212–213 previously running behaviors, 97–98 Crytek case study, 215–216 in script, 93–98 debugging, 202, 205 script behaviors, 94–95 dynamic link libraries (DLLs), 203–204 script concerns, 95–98 error recovery, 210–212 selectors and, 98 reasoning, hierarchical, 61–62, 64, 69 examples of, 204f, 207–210 reciprocal velocity obstacle technique (RVO), future of, 216 297–299, 304–305 goals with, 216 Reckoning, 93–98, 369–374 header file handling of, 212–213 reconnection point (RP), 302–304 implementing, 205–207 Red Dead Redemption, 67 introduction to, 201–202 reflex arc, 24–26, 24e, 24f multiple processes of, 203 refractory period, 16, 17f performance-critical code, 213–214, 216 repolarization, 16, 18f Runtime Compiler, 205 Reunion, 224 Runtime Object System, 206 Reynolds, Craig, 39, 319–320, 541–542 scripting languages, 202–203 Robbins, Michael, 391 shared objects, 203–204 Roccucci, Francesco, 358 structured exception handling (SEH), 210 Rock-Paper-Scissors, 571–575, 573e Visual Scripting and, 203 Rodriguez, Benito, 358 Visual Studio and, 203–205, 204f, 211, 216 role-playing games (RPGs), 55, 68, 115, 122, Rutkowski, Adam, 216 221, 245, 369, 452–453, 528 S Rosenblatt, Frank, 22 Rosenblatt perceptron, 22–23, 22e, 23e, 27 Sakata, Shinpei, 285 Roy–Floyd–Warshall algorithm, 242–244, 243f, Schmitt, Otto, 18 248 Schmitt trigger, 18–19

594 Index “scripted AI,” 5–6, 219, 227, 232–236. See also Python scripting language, 215, 232, 561 scripting Runtime Compiled C++, 201–217 scripting. See also scripting languages UnrealScript, 202 attribute checking, 226–228 Visual Studio, 203–205, 210–211, 216 behavior trees and, 222 S-curve function, 40, 42 building scripting system, 225–232 search space representations case studies, 224–225 choosing, 253–258 cross-pollination, 223–224 dynamic modifications, 254 deduplication technique, 226–227 examples of, 246f, 254f delegation of, 221–222, 236–237 graphs, 246–247, 246f, 254f, 256–257 domain-specific language (DSL), 227–231, grids, 246–247, 246f, 254–255, 254f, 257 340–341 introduction to, 253–254 flexibility of, 221–223, 235–236 localization, 254–257 Game AI and, 219–237 memory usage, 254–257 as “glue,” 220, 235–236 navigation meshes, 246f, 253, 254f, 255–267 implementation techniques, 225–232, path following, 254–257 236–237 path planning, 254–257 integrated architectures, 231–232 path smoothing, 254–257 introduction to, 219–220 pathfinding optimizations, 246–247, 246f iteration of, 233, 236 tasks, 254–255 master-style systems, 220–225 waypoint graphs, 246–247, 246f, 253–259, narratives, 235–236 254f, 362–364, 383–386 observation system, 225–226 sequencing technique, 226, 228 overusing, 233 Shank, 413–414 play testing, 236 Shank 2, 413–414, 421 prioritization of, 221–222 “shared objects,” 203–204 reaction system, 225–226 signal transmission, 17–18, 18f “scripted AI,” 5–6, 219, 227, 232–236 Silva, Fernando, 29 sequencing technique, 226, 228 Silva, Mario, 358 servant-style systems, 220–225 space-simulation games, 224–225 Sims, The, 5, 54, 61, 67, 119–122 surprises in, 235 Sims 3, The, 528 transitions in, 233–234 Sims Medieval, The, 122, 452–457 triggers for, 222–223 social dynamics system “tripwire” technique, 219, 223–228, 234–235 for characters, 441–450 variety in, 234–235 components of, 441–449, 448f working with, 220–225 execution of, 449 writing scripts, 232–236 explanation of, 442–443 “X Series,” 224–225 gaze control, 442, 445–446, 445f scripting languages gestures, 443, 447–448 C++ approach, 201–205, 232, 340 implementation of, 443–449 domain-specific language (DSL), 227–231, introduction to, 441 340–341 observation of characters, 441–442 embedded scripts, 553 posture, 443, 446–447 exposed scripts, 561 practical systems, 441–450 Havok Script, 203 proxemic control, 442, 446, 447f Kore Script, 203 social origin, 446 Lua scripting language, 94–97, 202, 215, 232, visual realism, 449 340–341, 439, 553, 561 social facts knowledge base (SFKB), 522–523 PHP script, 202 SoftCode, 215–216

Index 595 soundscapes goal-oriented action planning (GOAP), 63 artificial sound designer, 550–551 hierarchical reasoning, 61, 62, 64, 69 changing, 554 inertia in, 65 creating dynamic sound, 549–555 introduction to, 61 database for, 551–553 knowledge management, 66–69 generating events, 551 modularity, 68–69 introduction to, 549–550 option stacks, 61–62, 65–69 play-request events, 554 rule-based AI, 63 rule set for, 553 scripting basics, 63 updating, 554–555 state stack, 65 source cost data, 314 subsumption, 65 space-simulation games, 224–225 tricks for, 61–71 spatial problems, solving, 19 utility-based AI, 63 squad AI, 383–384, 515 structured exception handling (SEH), 210 Stanford Research Institute Problem Solver Sturtevant, Nathan R., 241, 253 (STRIPS), 55, 128, 165 Sunshine-Hill, Ben, 185, 459 state stack, 65 Super Street Fighter IV: 3D Edition, 579 state-space planning, 171f Supreme Commander 2, 307–309, 309f, stealth platformer, 413–421 314–316, 391–398 steering behaviors Supreme Commander 3, 398 benefits of, 322 “suspension of disbelief,” 4 flow fields, 319f, 320–323 symbolic planning language-based decision future of, 322–323 models, 137 limitations of, 321–322 synaptic plasticity, 21–22 performance considerations, 321–322 synaptic transmission, 20–21, 21f. See also units for, 319–321, 320f neurology steering circles T calculating positions, 290–293, 290f, 291e, 292f, 293f tactical pathfinding formation movement for, 289–295 for 3D applications, 366–367, 368f introduction to, 289, 307 cover representation, 364–367 navigating, 293–295 introduction to, 361 path generation, 289–293, 290f methods for, 361–366 pathfinding, 289–295, 307–316 navigation meshes and, 361–368 Straatman, Remco, 377 path segment calculations, 365–366, 366f strategy raycasts, 362 for multiplayer bots, 377–390 tessellating and, 363 strategic graphs, 384–385 tactical position selection strategy layer, 378, 379f architecture for, 338–339, 339f tactics and, 335–359 behavior selection algorithms, 342–343 Street Fighter II, 575–576 database for, 339, 343 Street Fighter IV: 3D Edition, 579 directness of, 346–348, 347e structural architecture domain-specific language (DSL), 340–341 behavior trees, 63 evaluation of, 353–357 blackboards, 61, 66–67 filters for, 344–345, 353–354 common architectures, 62–63 fundamentals of, 338 definitions for, 62 future of, 358 finite-state machines (FSMs), 63 generation of points, 341–344, 351–352, 358 first-person shooter (FPS), 62–63 group techniques, 349–351 goal stack, 65 hidespot contention, 350

596 Index introduction to, 337 utility theory line of sight for, 341 actions for, 120–125 motivation for, 338 attack desire curve, 122–123, 123f performance of, 351–357 behavior trees and, 130 query language for, 339–343, 358 bucketing, 121–122, 121f query library for, 342, 358 calculating utility, 116–120 raycasts, 352, 358 concept of, 113–114, 130 scheduler for, 339 cool-downs, 122 spatial coherency, 349–350 cubed utility, 135f squad center, 349–350 decision factors, 115–117, 122–127, 123e squadmates, 350 decision-making systems, 125–126, 130–132 timeslicing, 356–357 demos, 122–125 tools for, 357–358 dual utility, 121–122 weights, 345–349 expected utility, 115, 115e tactics health desire curve, 123–124, 124f for NPC attacks, 369–375 inertia and, 122 for pathfinding, 361–368 introduction to, 113 position selections, 337–359 linear curves, 117, 117e, 117f, 119–120, 120f strategy and, 335–359 logistic function, 118–119, 119e, 119f Terran Conflict, 224–225 piecewise linear curves, 119–120, 120f quadratic curves, 117–118, 118e, 118f Threat, The, 224 run desire curve, 124–125, 124f, 125f threat response, 391–398. See also neural scores, 114–115, 115e, 116f networks threat curve, 123–124, 124f time per movement (TPM), 300 utility curves, 117–118, 122–126 Tomlinson, Simon, 471, 491 utility-based AI, 63. See also Game AI Transformers: Fall of Cybertron, 57–58, 156, 159, 167 V Transformers: War for Cybertron, 156 Van der Sterren, William, 169 Trapezoidal Cell Decomposition, 265–267 Vasquez, Joseph, II, 567 tripwire systems, 219, 223–228, 234–235 Verweij, Tim, 377 U visual realism, 449 Visual Scripting, 203 Unreal Engine 3, 341, 428 Visual Studio, 203–205, 204f, 211, 216 Unreal Engine 4, 202, 205 Unreal Kismet, 203, 216 W unrealistic long-term behavior (ULTB), 189 war games unrealistic state (US), 188 examples of, 173t, 174f, 175f, 176f UnrealScript, 202 introduction to, 169 utility curves multi-unit planning, 170–171, 170f, 172f, 181f attack desire curve, 122–123, 123f planning for, 169–183 health desire curve, 123–124, 124e, 124f plan-space planning, 172–182, 181f linear curves, 117, 117e, 117f, 119–120, 120f Warzone, 377, 378, 388 piecewise linear curves, 119–120, 120f wavefront edge expansions quadratic curves, 117–118, 118e algorithm for, 261–267 run desire curve, 124–125, 124f, 125f classification of, 261–263 threat curve, 123–124, 124f comparisons, 265–267 utility decisions, 127–136 decomposition, 261–266, 262f, 266f utility scores, 114–115, 115e, 116f Delaunay Triangulation Decompositions, utility systems, 53–55 256, 260, 265

Index 597 Hertel–Melhlorn decompositions, 265–267 World of Warcraft, 5, 7 introduction to, 259–260 , 532 navigation meshes, 259–267 obstructions, 260–265, 266f X PASFV, 260–261, 264 X2: The Threat, 224 postdecomposition, 264–265 X3: Reunion, 224 reseeding, 264 X3: Terran Conflict, 224–225 runtime, 260, 265 seeding, 261–264 Y space-filling volumes (SFVs), 260–261, 264 spatial decomposition, 261–266, 262f, 266f Yokoyama, Takanori, 269 Trapezoidal Cell Decomposition, 265–267 Youngblood, G. Michael, 259 VASFV, 260–261, 264 Z waypoint graphs, 246–247, 246f, 253–259, 254f, 362–364, 383–386 Zielinski, Agata, 431 Weizenbaum, Joseph, 4 Zielinski, Mieszko, 423 Welsh, Rich, 403 Zoo Tycoon, 5 Wilson, Will, 201 , 67

598 Index