CIS 488/588 Bruce R. Maxim UM-Dearborn Movement CIS 488/588 Bruce R. Maxim UM-Dearborn 1/3/2019
Environment Structure Detail Parts of game environment that can physically affect movement (e.g. doors) Player cannot simply push these asid Detail Cosmetic parts of the environment that players cannot collide with in a significant way (e.g. books) 1/3/2019
Living Creatures Affect movement during game Often have been forced into either structure or scenery as needed by game designer Other players and NPC’s can be considered obstacles in large crowds It may be best to consider moving creatures as category of their own when considering movement issues 1/3/2019
Defining Space - 1 Human players AI characters Have to assimilate the environment based on imperfect visual information AI characters May get a simplified or incomplete version of the world off line before the game starts (e.g. a list of way points) They may be expected to perceive and interpret the world on-line like humans 1/3/2019
Defining Space - 2 Space is an abstract concept that cannot be fully understood Each representation scheme will involve considerations of design tradeoffs Once an entity has “figured out” space it is possible for the entity to determine which parts can be traversed and which cannot 1/3/2019
Dimensions Some game take place in 2D worlds (Warcraft II) and some in 3D (Half Life) It is important to note the the game world dimensions do not always match its rendering Most academic AI deals with 2D movement algorithms In many cases it is permissible to generalize a 2D movement algorithm to 3D 1/3/2019
Pitfalls 2D to 3D Complex environments may contain widgets (e.g. jump pads) that are rare in a 2d world Naively applying the 2D algorithm without custom tailoring it to the problem at hand Gravity plays a role in realistic environments and should not be ignored 1/3/2019
Space Discrete Continuous Game environment limited cells on a grid using integer coordinates Continuous Have unlimited (real) coordinate values Usually can be done using single precision (32 bit) floating-point numbers 1/3/2019
Time Discrete Continuous “Clock” advances at regular fixed length intervals Continuous Actions can be continuous and appear concurrent A single CPU shares its clock cycles with each object and a portion of the game code is devoted to determining what happened since the last update (say every 0.1 seconds) 1/3/2019
Conversions For digital computers everything ends up being implemented as if it was discrete It is possible for the game world to use one discrete conversion scheme and the AI different scheme This allows the use of an grid-based A* path finding routine in a continuous game world There may be tradeoffs to consider (e.g. compromising behavior quality) 1/3/2019
Handling Movement The allowed movement is imposed on the creatures by their environment In both 2D and 3D worlds the patter is: Game simulation loop Integration Collision detection 1/3/2019
Role of Game Engine Game engine takes into account all movement requests from players and NPC’s Physics system resolves all collisions and updates the creature data structures with new velocities, positions, and orientations Animation system handles low-level “limb” control as predefined animations (abstracting this low-level control as a “locomotion” layer greatly simplifies programming) 1/3/2019
Dr. Spin Only behavior is to move and turn Often bumps into walls Can get stuck in corners Supposed to demonstrate the importance of world simulation and structure on movement 1/3/2019
Navigation - 1 Process of purposely steering course of some entity though a physical environment Autonomous navigation means the software system can steer its course unassisted Navigation produces proactive rather than reactive movement Purposeful navigation is not possible by trial and error of actions 1/3/2019
Navigation - 2 Most living creatures require spatial information to interpret that provides them a sense of their world and helps them select their “next step” Much of the complexity of navigation comes from the acquisition of world information A rough description of space is encoded by animals to help them pick out empty and solid spaces 1/3/2019
Game Bots - 1 Very few computer games use sensing and environment interpretation to achieve navigation behavior Virtual game worlds can be stored entirely in the computer’s memory Algorithms process the world description to extract structural information form it 1/3/2019
Game Bots - 2 The bot is part of the game simulation world so they have perfect position information By dropping waypoints or processing polygons a compact terrain description can be given to the bot before the game begins Bots are particularly good at global movement and allow very effective use of standard algorithms like A* 1/3/2019
Game Bots - 3 Bots do not sense the world like animals Bots perceive the world using preprocessed environment knowledge and this is not always good The terrain model might be based on erroneous assumptions The terrain model may not be up to date in dynamic environment Bots can become stuck or ignore obstacles 1/3/2019
Animats Autonomous navigation is possible by giving animats the ability to sense the environment and selectively process the relevant information This give animats fresh information about their local surroundings This reactive approach has good local navigation, but has problems reaching points in space (similar to hill climbing) 1/3/2019
Criteria for Effective Motion Realistic Movement must be similar to real world analogs Efficient Economical use of processing cycles Reliable Must guarantee NPC can complete standard situations with getting stuck Purposeful Must be able to achieve goals in space 1/3/2019
Motion Tradeoffs These criteria often comes in conflict with one another and compromise is needed Efficiency has historically been the greatest concern of game developers Realism has become more important in recent years Different game situations require different tradeoff decisions 1/3/2019
Obstacle Avoidance With no obstacles near, animat is free to travel in any direction With walls on one side, animat should be turned away slowly in a preventative manner With obstacle in front, turn should be executed to avoid danger on one side When stuck in a corner, animat should attempt a complete turnaround 1/3/2019
Bouncer Runs around the game monitoring its own movement If its forward movement is not what was expected, a collision is assumed Following a collision, animat takes off in a random direction until it can move again 1/3/2019