240 likes | 354 Views
Designing Intelligence. CIS 488/588 Bruce R. Maxim UM-Dearborn. Useful Game AI - 1. Perception Ability of NPC to detect what is happening in the game world (near or far away) Enemies, goals, collisions, and damage should be processed in a believable way Action
E N D
Designing Intelligence CIS 488/588 Bruce R. Maxim UM-Dearborn
Useful Game AI - 1 • Perception • Ability of NPC to detect what is happening in the game world (near or far away) • Enemies, goals, collisions, and damage should be processed in a believable way • Action • Behaviors chosen by NPC without any apparent inputs • Often determined by scripts or rules
Useful Game AI - 2 • Reaction • Behaviors triggered by game world related stimuli (usually the player’s actions) • Learning • Could be simply recording previous information (what worked and what did not) • Is better if some generalization takes place (and NPC’s share some knowledge of player over time)
Opponents • Any entity that tries to prevent player from achieving goals • Opponent’s capabilities need to match player expectations and abilities ramp up as game progresses • Perfect (cheatbots) opponents discourage good game play
Opponent Types • Action opponents • Should have classes of behaviors that can be easily identified by players (e.g. guards) • Sports Opponents • Should approximate player skills (e.g. reaction times, accuracy, tactical decision making) • Board Game Opponents • Often Mini-max search and book move libraries (handicap AI by reducing look ahead)
Allies • NPC’s that work with player • Concerns • Recognition (opponents vs allies) • Communication (allowing allies and player to share understanding of game information) • Following/chasing behaviors (when to follow and when to act on their own) • Party or squad behavior (groups that share abilities to support the player’s lead)
Traditional Approach • In-game agents simulated as part of the game logic with 2D positions updated each clock tick (very slow) • AI code can be separated from the game logic if the game agent has access to game state data as needed • Agile development processes are used to build user interface and game logic from scratch incrementally • Game AI requires lots of experimentation to get working right as increments evolve
Traditional Agents • AI viewed as code fragment that manipulates data • Single CPU controls all information processing and executes actions on behalf of the agents • Agents are able to solve some problems for the player by not requiring micromanagement of all game objects
Traditional Guidelines • Cut corners whenever possible to save development time without sacrificing efficiency • Requiring both realism and efficiency argues for weak AI techniques
Traditional Weaknesses • Dangerous to let AI access game information directly if changes are allowed • Manually programming all AI behaviors is tedious and causes exponential growth in development times • This approach scales up very poorly and fails to transfer examples well from one domain to another
Modern Approach • CPU is not needed to deliberate every move for every object • System behavior is distributed to reactive objects in the game environment • Full systems are built incrementally by testing each set of new components as they come on line
Animats • Animats are embodied systems situated in realistic environments as robots or NPC’s • Animats simulate reactive creatures accurately meaning fewer aspects need to be faked • Allow more complete separation of AI from game logic and simulation
Animat Benefits • Interaction with environment is formalized to that is can be optimized using the best information sharing technique • Learning techniques minimize processing power use to perform a particular behavior • Can provide improvements in efficiency of the design and development pipeline
Embodiment • An embodied agent is a living creature subject to the constraints of its environment • The environmental constraints restrict the AI to the subset of actions plausible with the laws governing the simulation • A standard agent can change its position to reach any reachable point in space • An embodied agent will need to deal with obstacles since it does not have the ability to update its position directly (some trial and error is involved)
Formal Interfaces • Provide hooks to agents using the game engine • Allow agents to reside on different servers than the game engine • Let engineers decide on the best mechanism to communicate data to the AI (messages, callbacks, abstract function calls, shared variables)
Performance Advantages ofFormal Interfaces • Lazy evaluation (information gathered only as needed) • Event-driven (AI does not need to poll for data it is notified) • Function in-lining (interfaces can be factored out by the compiler if needed) • Custom optimizations (can be used to speed up queries) • Batching (queries can be queued for later processing)
Learning • Acquisition of new knowledge and abilities • Motivation: • Optimization (solving known puzzles off-line to allow for better game performance) • Adaptaton (continuously updating state knowledge on-line to deal with different playing styles during the game)
Learning Technology • Supervised learning (algorithms presented with examples expected to generalize patterns) • Reinforcement learning (feedback takes the form of a numeric reward following particular behaviors reward adapts policy over time) • Evolutionary approaches (numeric rewards given for sequences of actions) • Unsupervised learning (design provides performance metric rather than direct training)
Teaching • Teaching (humans provide set of examples to help animat adjust its behavior) • Imitation (animat copies behavior of another another player) • Shaping (animat completes sequence of successively more complex tasks) • Trial and error (animat placed in environment and lets it try all actions on its own)
AI Development Process - 1 • Informal phases • Analysis phase describes how existing design and platform affect general task • Understanding phase provides precise definition of the problem and testing criteria • Formal phases • Specification phase defines the interfaces between the AI and the game engine • Research phase investigates existing AI techniques and expresses theory operationally
AI Development Process - 2 • Programming phases • Development phase implements AI theory as a convenient AI module • Application phase take problem definition and framework and uses AI module to solve problem • Testing phases • Experimentation phase uses testing to assess the current prototype focusing on tough cases • Testing phase presents thorough series of evaluations using test case likely to be successful
AI Development Process - 3 • Postproduction phase • Optimization phase attempts to make actual implementation lean and mean • The final product of this process is a single behavior • The process is repeated for each new behavior • The number of iterations can be reduced using a cleaver AI architectural design