artificial intelligence in game design cooperative movement

Download Artificial Intelligence in Game Design Cooperative Movement

Post on 03-Jan-2016

218 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

Slide 1

Artificial Intelligence in Game Design

Cooperative Movement1Coordinated MovementSteering of individual character based on movement of other charactersOrganized movementCooperating in pursuit of overall goal

Moving group in formationCreating formations

Implementing plays in sports games

2Fixed FormationsLine

Circle

V formation

Note that all are usually scalable to different group sizes

3Leader-Based SteeringLeader steers towards goalFollowers have slots Fixed position relative to leaderMove with leaderFollowers seek location of slotleader

Fixed distance, orientation WRT leader

leaderLeftflankRightflankRightrearslotsSeek new slot positions4Leader-Based SteeringProblem if leader has to steer around obstaclesFollowers will also steer for no good reason! Need greater degree of independenceleader

5Leader Marker SteeringInvisible leader marker leads formationAll characters have slots relative to leader markerLeader marker not affected by obstacles

Fixed distance, orientation WRT leader markerLeader markerLeftflankRightflankRightrearslotsFront

6Leader Marker SteeringFollowers steer around obstaclesUse blending/priorities to determine steeringMay have other goals (seek cover, avoid collisions, etc.)

Leader markerRightside

Seek slotAvoid obstacle

Seek coverFinal steering

Avoid collision7Leader Marker SteeringProblem if many obstacles in squad pathLeader marker not affectedFollowers are slowed by obstaclesFollowers get far behind leaderLeader marker should move slow if necessaryTarget velocity of leader = Average current velocity of squad

LeftflankRightflankRightrearFrontSquad moving slow8Leader Marker SteeringProblem if some units slower than othersSmaller MaxVel, MaxAccelLarger units slower to steer pastTarget velocity of leader = Minimum velocity of units in squad

LeftflankRightflankCenterFront

9Hierarchical FormationsLarge units usually consist of smaller squads also in fixed relative locationsHave overall leader markerLeader markers of individual squads have slots in overall unitHeavy weapons

Infantry

Infantry

Flankers

Flankers

Overall leader

10Slot AssignmentDifferent slots in a formation may require different abilitiesGiven group of characters, how should those slots be filled?

Example: Heavy weapon escort group

Hand to Hand WeaponryHand to Hand WeaponryLong Distance WeaponryHand to Hand WeaponryLong Distance WeaponryHeavy Weaponry

11Slot AssignmentDifferent characters have different abilitiesCan represent fit to role numericallySwords-manPikemanAxemanArcherCatapultCannonGrenadierHand to Hand1010104003Long Distance03010007Heavy Weaponry000020203

12Minimal Cost Slot AssignmentGoal: Assign slots to maximize score (or minimize cost)

Hand to Hand Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

Heavy Weaponry

Total score: 8 Hand to Hand Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

Heavy Weaponry

Total score: 68 13Minimal Cost Slot AssignmentNot feasible to check all possible assignments n characters O(n!) possible assignmentsGreedy algorithmStart with hardest to assign characters firstCharacters with greatest variance between slot scores

secondthirdfourthlastHand to Hand Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

Heavy Weaponry

first14Dynamic Slot AssignmentMay need to reassign slots dynamicallySquad members removedMay need to factor in cost of empty slotCan use to put preferences on filled slotsWithout a heavy weapon, no purpose for squad!Can use to put preferences on numbers in slotsOk to have one hand to hand slot in front, but not to havenone in frontHand to Hand Weaponry

Empty = - 10 Hand to Hand Weaponry

Empty = -15Long Distance Weaponry

Empty = - 15Hand to Hand Weaponry

Empty = - 20Long Distance Weaponry

Empty = - 5Heavy Weaponry

Empty = - 5015Minimal Cost Slot AssignmentExample:

Hand to Hand Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

EmptyHeavy Weaponry

Total score: 54 Hand to Hand Weaponry

EmptyHand to Hand Weaponry

Long Distance Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

Heavy Weaponry

Total score: 48 16Minimal Cost Slot AssignmentIf costs too great, may need to change squad typeTry all squad types of new group sizeExample:

Hand to Hand Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

New attack squadHand to Hand Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

Hand to Hand Weaponry

Long Distance Weaponry

EmptyHeavy Weaponry

Total score: 46

17Squad Cover MovementSquad moves one at a timeRearmost member moves to next cover positionRest of squad remains stationary, providing coverSquad as a whole must move in desired direction

Desired direction

18CoverCoverCoverCoverSquad Cover MovementCan still use formation slotsBased on nearest cover instead of fixed formation

Slot BSlot DSlot CSlot ACoverSlot BSeek19Squad Cover MovementChoose squad member furthest from goalChoosing next cover pointIn direction of squad goalOften done by targeting a squad anchor point in center of formationNot used by another member of squadWithin cover range of rest of squadMay not necessarily put in front of rest of squadMove squad member slot to that cover pointSquad member will seek that slot

Cover

Squad Cover MovementCover

CoverCoverCoverCoverCoverRange of coverageCoverCoverCoverCoverSquad centerState-Based MovementCharacter does not begin movement until signaled to do so by another characterDirection/type of steering depends on location/steering of other charactersState 1ASteering forthis state Character AState 2ASteering forthis state State 1BSteering forthis state Character BState 2BSteering forthis state Change in character A stateCauses change in character B statesignal22Play-Based SteeringTypical in most team sports gamesExample: Passing formation

23Play-Based SteeringArrive atpocketQuarterbackFollowPath route,Avoid defendersReceiverWander,AvoiddefendersAt route end and openWander,AvoiddefendersThrow:Pursue(football, receiver)PursuefootballFootball thrown24State-Based ImplementationCharacter A sets flag in central repository for team in state exitReciever3 RunRoute statevoid Exit() { repository.setFlag( this, open, true); Who set flagFlag name, valueTeam Repository

SenderFlagValueReciever3opentrue25State-Based ImplementationCharacter B checks for flag as input in checkTransitions method to determine whether to change stateQuarterbackWaitForReciever stateint CheckTransitions() { if (repository.getFlag( Reciever3, open)) { return THROW_STATE; } Team Repository

SenderFlagValueReciever3opentrue26Handling Failed StatesExample:Target receiver never openQuarterback must eventually take another action Choose another receiver ScrambleNeed a state timeout to recognize thisReceiver should recognize and change to blocking stateHandling Failed StatesArrive atpocketQuarterbackFollowPath route,Avoid defendersReceiverWander,AvoiddefendersAt route end and openWander,AvoiddefendersThrow:Pursue(football, receiver)PursuefootballFootball thrownSeek goalAvoid defenders3 secondsSeek defenders28

Recommended

View more >