Squad Tactics Presentation By: Danny Powell, Andrew Pro, and Kofi White Squad Tactics in Real Life Swat Teams Wolf Packs Velociraptors (Jurassic Park) Hyenas Fighter Squadrons What is a squad? Small team with a goal Kill foes, Move there, Defend here, patrol, etc Tries to accomplish its goals through coordinated actions Even under adversity Squad structure can vary Casualties, regroupings Interference from other friendlies Leader Squads sometimes have a leader The leader can be prominent, or act like any other squad member Team AI Tactics A conceptual action used by a unit to implement a specific mission and achieve a specific objective or to advance toward a specific goal Implemented as one or more specific tasks. Team AI The use of teammates has become increasingly prevalent It’s rather important to make the teammates convincing though Team AI: Bad Don’t want teammates who will get in your way Or run off to the far corners of the map Or give away your location Or outright sabotage your team… http://www.youtube.com/watch?v=LkCNJRfSZBU Team AI: Good Provide back up Without stealing the show! Follow instructions Anticipate beneficial actions Squad Organization Player can be squad leader or squad member depending on the game Example: Early levels of CoD: player is just a member of the squad Mass Effect: player is the leader of the squad Decentralized AI Interactions between squad members Simple extension of individual AI Easily combined with level-specific scripting However, weak at maneuvers that require autonomy or tight coordination From decentralized interactions, squad maneuvers emerge… Decentralized AI Simply and extension of individual AI Robustly handles many situations Utilizes the variety of capabilities within the team Easily combined with scripted squad member actions Decentralized Communication AI members publish the following info to nearby squad members Their Intentions (“I’m moving to position <xyz>,” “I’m firing from <xyz>in direction <p, y> at <xyz>,” “reloading”) Their Observations (“enemy seen at <xyz>,” “grenade tossed toward <xyz>”) Solo AI vs. Squad member AI Solo AI vs. Squad member AI Not much of a difference So where do we find the squad behavior, let alone squad tactics? http://www.youtube.com/watch?v=_tGOKngtkt4&f eature=player_embedded Birds Emergent behavior The squad behavior comes from the interactions of the squad members, rather than in their individual actions. Functionality originating from the interactions of elements, rather than from their individual actions. The emergent high order organized behavior is generated from lower-level, simpler behavior http://www.youtube.com/watch?v=rqzlSj_VngY&fe ature=player_embedded# Emergent Fire & Maneuver Behavior Solo AI: Either fires at a threat, or moves to a better position Squad member AI: announces intentions and decisions Determines actions based on state and intentions and observations of nearby squad members Move up if too many teammates are engaging Ignores already-engaged enemies The fire & maneuver tactic emerges from these interactions Tactical Enhancements Stay close to cover Don’t block teammates’ lines of fire Knowledge of weapon capabilities Maintain team cohesion Stay spread out Keep enemy in sight Tactical Enhancements This can be accomplished by… Extend the squad member’s mental picture Improve communication between squad members Include tactical information about allies Adding a “next position” algorithm to tactically improve movement Create squad member subclasses to define specific behavior Leader, rifleman, machine gunner, sniper, etc. The Squad Member’s Mental Picture Represents what the member “knows” For each Squad member Position Destination/path Line of Fire For each Opponent Known position, state, estimated current position Other squad members engaging Line of fire Other hazards and threats Personalizing Squad Member Behavior Different squad members have different preferences, and abilities Riflemen—move quick and often, close in on enemy Machine gunners—slow, support fire from a static position Sniper—stay back and engage enemy from a distance State also affects position preference Favor cover when wounded or reloading When team out-mans the enemy, aggressive tactics are favored Cons of Emergent Tactics Difficult to form long term strategy Team members sometimes do unexpected things i.e. move around randomly for no reason Trouble reaching a decision and executing it unanimously i.e. ambushes No autonomy—nobody actually thinks for the squad Cannot execute some more sophisticated maneuvers Its up to the level designers to design the more complex behaviors Counter-Strike Emergent Squad Behavior Planned Maneuvers Asses situation for squad as a whole unit and pick a course of action Possibly reduce demand of CPU by doing computations only once for squad strategy rather than doing it individually Commands assign goals for squad members… new commands may interfere with current goals or tasks of individual soldiers. What can we do? Centralized Command Style Authoritarian Leader knows best Soldiers always adopt new plan set by leader Coaching Soldiers execute tasks at their own discretion Soldier has to make own decisions if there is a conflict with the leader’s commands The best style would be a mix of the two by implementing an intelligent message passing system Command Hierarchy and Message Passing Tactical Team AI Using a Command Hierarchy A move toward real-time decision making instead of more scripted sequences Information passed up the hierarchy, from lower level soldiers gathering information Decisions made and passed back down from highest level Command Hierarchy Commander Orders Information Captain Sergeant Soldier Figure 5.5.1 Lower levels carry out orders and higher levels organize the team and make decisions Robocode Example TeamScout message passing Decision Support Individual AI need to know certain things about environment to carry out orders Soldier example from book: Can reach location x from location z without passing through y?... Exits for a certain room Fill arrays to save specific information about the environment to make decisions based on that information Higher levels need to know what each soldier is doing, and what the priority of their action is Squad Implementation Processor friendly message passing allows for high level decisions to be made immediately when new information is present… no polling Global data can be kept so information can be available to all levels at all times, but messages still passed when info is updated Squad should try to carry out complex maneuvers and perform them logically but not predictably so a player is not critical of the AI Choosing A Strategy Figure 5.5.2 Outflanking Example Figure 5.5.3 Pseudo-code example to check if maneuver is possible and appropriate before performing Outflanking Pseudo-code RoomSeen = Room where opponent has been seen ReachableDoors = 0 if(NumDoors(RoomSeen)<2) Abort . Not enough doors. NumBots = FindAvailableBots(AvailBotList,PriorityThreshold) if(NumBots<2) Abort. Not enough bots. for each RoomDoor in room RoomSeen for each bot in AvailBotList if(CanReachWithoutRoom(RoomSeen, RoomDoorLeadsTo(RoomDoor),AvailBot.Room)) ReachableDoors += 1. Don’t try other bots. Try next Door. if(ReachableDoors<2) Abort. Can’t reach enough doors. for each bot in AvailBotList Create team to preform maneuver, with first bot acting as Captain. Captain: outflank RoomSeen Outflanking Example cont’d Some details not taken into account, bots may be available to reach a door in RoomSeen, but may not be anywhere close Consider while actually performing maneuver: Have bots move to closest door, but also try to have bots spread evenly between doors Send message ‘in position’ so Captain can time the attack What does soldier do after executing command? Squad Tactics - Formations What is a Formation Squad Formation - a grouping of individuals and units strategically positioned in order to efficiently and effectively carry out a premeditated strategy Formation Utility Important for formation to actually contribute to the actual game play as opposed to being just visual appeasements for the player. Formation Dimensions Formations can be designed to fit both a 2d and a 3d mold 2d Formations Line • Column 2d Formations Left Flank • Right Flank 2d Formations Wedge • Vee Squad Visibility Units have limited angle of perception Formations often designed to permit maximum squad visibility Increased Visibility Formations Staggered Line • Outward Facing Formation Strategies Fixed Formation Units are ultimately stationary Good for defensive strategies Mobile Formation Units are moving in formation Typically used for offensive strategies (attacking or rallying). Fixed Formation Considerations Organizing Mixed Units Reshuffling Formations Unit Mobility Spacing between Units Handling Unit Overflow (More units than allotted spaces for formation). Formation unit requirements Organizing Mixed Units Smart to invoke a strategy which incorporates units with varying talents Implement formation in which units have complementary skills Reshuffling Formations Sometimes units need to quickly change from one formation to another. More efficient to have units path to the nearest slot as opposed to pathing to its assigned spot. Unit Mobility When designing your formation it is important to take into consideration the expected movement of each unit. Info on expected unit movement should be used to reduce unit collision Spacing Between Units Depending on your strategy it is sometimes better to have tightly spaced units or loosely spaced units. Unit Overflow When there are more units that need to fall into formation than there are slots available, a new rank should be invoked to accommodate the extra units. Formation Unit Requirements Some formations may call for specific unit types in specific formation positions, similar to a football offensive line. Mobile Formation Considerations Group Pathing and Movement Reacting to Obstacles and Combat Group Pathing and Movement When invoking squad movement there are several strategies which can be applied to maintain formation integrity Leader offset movement http://www.youtube.com/watch?v=7qZj-DW3eFU Flocking All units move as fast as slowest unit, in order to maintain formation integrity Flying V!!! Reacting to Obstacles and Combat Two options Go into waiting mode Maintains integrity of team formation Seek alternative Path Will vary the group formation, and may alter the end formation. Best to choose the option which best fits your squad strategy Squad Tactics -Team Members Primary focuses for Team Members Correct Positioning Correct Movement Correct Behavior Supporting the Player Correct Positioning Avoid colliding with player. Avoid moving into players field of view Correct Movement NPC team member should never take lead unless instructed to do so. i.e. NPC team member should not be the first around corners unless instructed by player. If so the NPC team member should do everything to not jeopardize the players status and should employ tactical strategies NPC team member should respect the current context of the situation If player wants team to be in stealth mode, the NPC team member should honor the players request. NPC team member should move approximately the same speed as player. Correct Behavior In the context of a team Shooter Use of Cover Selective firing Reloading NPC should behave in such a way that it has its own self preservation in mind along with the self preservation of the player Supporting the Player Depending on strategy of the game NPC team member may act more autonomously or more cohesively. NPC team member should relay information to player in order to give player a chance to react i.e., If a threat is detected Bottom Line: THE PLAYER IS THE MOST IMPORTANT!