GDC - Gameplay replication in ACU

Views:
 
     
 

Presentation Description

http://schedule.gdconf.com/session/networking-gameplay-and-ai-in-assassins-creed-unity

Comments

Presentation Transcript

Slide1:

Gameplay and AI networking i n Assassin’s Creed Unity Charles Lefebvre AI programmer, Ubisoft Montreal charles.lefebvre@ubisoft.com, @ FrozenInMtl

Slide2:

Assassin’s Creed Unity

Slide3:

Assassin’s Creed Unity

Slide4:

Assassin’s Creed Unity

Slide5:

Assassin’s Creed Unity

Slide6:

NETWORK TOOLS

Slide7:

Network glossary M Migration Entity Join in progress Session Memento NetObject Master Replica Simulation bubble Peer Peer to peer Player Multiplayer Network key Discovery Host Components Coop

Slide8:

NetObject Network glossary M Peer 1 Visual component AI component Animation component Network component Network key E ntity Network key (u64) = peer + type + ID

Slide9:

Network glossary M R Peer 1 Peer 2 Mementos M

Slide10:

Network tools: NetTokens NetTokens : Layer for peer to peer conflict resolution t=5 t=4 no Peer1 yes Peer2 Peer3 t=4 t=5 yes yes

Slide11:

Network tools: NetTokens Can also be used to wait for all players t=5 t=4 Peer1 Peer2 Peer3 t=4 t=5 t=6 t=6

Slide12:

Network tools: r emote procedure call Remote procedure call (RPC): execute a function on a peer, this function will be executed on other peers network void PlayAnimation ( const AnimationParams & params ); Can be ordered or not Can be persisted for Join In Progress Can be executed later, or re-executed

Slide13:

Flow examples: Network tools: r emote procedure call Replica Replica Replica Master Replica Replica Master Replica Replica Master

Slide14:

Network tools: NetHandle struct NetHandle { Handle<Entity> m_Entity ; NetKey m_NetKey ; bool IsValid (); Entity * GetEntity (); bool GetPosition (vec4& position); bool GetSight (vec4 & position); }

Slide15:

Network tools: NetHandle ? NetHandle (position + sight ) NetHandle (full entity ) ? ? ? Simulation bubble Undiscovered entity

Slide16:

SPAWNING SYSTEM

Slide17:

Spawning strategy Spawning client Spawning system Spawning request Spawning strategy Spawning manager Spawning strategy Mementos

Slide18:

Peer 1 ( spawner ) simulation bubble M Echo replication Peer 2 (observer) simulation bubble Net descriptor Spawning request Spawning request R

Slide19:

Engine replication Peer 1 loading range Peer 2 loading range Spawning request Spawning request Token M R

Slide20:

Systemic gameplay Replicate the crowd event generation in echo Replicate the victim/thief in engine

Slide21:

Spawning system: conclusions (+) Almost no change in the spawning clients code (+) Cheap in bandwidth (+) Data is the same in single and multiplayer (-) No network balancing (-) A lot of edge cases to handle when a spawning request is cancelled (-) Systemic gameplay is not easy to replicate

Slide22:

REPLICATION OF PLAYER BEHAVIOR

Slide23:

Player replication: objectives Need a way to replicate the player’s movements with good accuracy Animation quality of replicas must be the same as masters Must support join in progress Shouldn’t take too much bandwidth

Slide24:

Player replication comparison tool

Slide25:

HSM Animation NetBehaviorAI Replica Replica Brain Player replication flow Controller HSM Animation NetBehaviorAI Master Replication Final decisions

Slide26:

Player final decisions

Slide27:

Player replication: conclusions (+) Good replication quality (+) Can recover nicely from divergences (-) Expensive in bandwidth (-) 3 state machines ( HSM / NetBehaviorAI / animation graph) to maintained

Slide28:

A.I. REPLICATION

Slide29:

Replicate NPC behavior at a very low cost A.I. replication: objectives Not a perfect match: not a first person game Quality of realization: same for masters and replicas Existing behaviors easily updated to support multiplayer

Slide30:

A.I. replication flow Logic HSM Animation HSM Animation Intentions Master Intentions Replica Logic Replication

Slide31:

A.I. replication Animations Navigation Weapons LookAt Idle Idle Idle Idle Play animation Push Stumble … Go to position Wander Follow … Sheath Unsheath Fire … Look at position Look at target Intentions RPC

Slide32:

NPC replication : conclusions (+) Cheap in bandwidth (+) Seamless migrations (-) Average replication quality (-) Services (navigation, animation…) must also be synchronized to prevent behavior branching

Slide33:

GAMEPLAY COORDINATORS

Slide34:

Gameplay coordinators Spawn NPCs UI Interactions

Slide35:

Gameplay coordinators Sensors Distance Line of sight UI Coordinators in previous Assassin’s Creed games … Actions

Slide36:

Gameplay coordinators Net data Sensors synthesis Execution count Local state Released entities For local player Sensors Distance Line of sight UI … Actions R M M

Slide37:

Gameplay coordinators Replica Net data Sensors synthesis … Sensors Replica Net data Sensors synthesis … Sensors Master Net data Sensors synthesis … RPC Sensors RPC RPC Memento Memento

Slide38:

Gameplay coordinators: conclusions (+) Good replication quality (+) Cheap in bandwidth (+) Code and data are the same in single and multiplayer (-) Join in progress can be tricky (-) Reaction times can become noticeable

Slide39:

CROWD STATIONS

Slide40:

Crowd stations

Slide41:

Crowd stations How does it work in single player : Crowd Life Manager updates all stations Stations = data containers (not systemic ) Stations loaded with cells NPCs spawned/released by stations

Slide42:

Crowd stations Amount of stations and NPCs to track Challenges of replicating: Stations are not replicated NPCs in stations can be masters, replicas, or even non-replicated entities

Slide43:

Crowd stations replication

Slide44:

Crowd stations replication What to replicate ? NPCs Station state Master = token winner

Slide45:

Crowd stations replication: split mastering Crowd Life Manager Stations NPCs Peer 1 NetObject (master) Peer 2 NetObject (replica ) Peer 3 NetObject (replica ) Peer 4 NetObject (replica ) Crowd Life Manager Stations NPCs Peer 2 NetObject (master ) Peer 1 NetObject (replica) Peer 3 NetObject (replica ) Peer 4 NetObject (replica ) Peer 1 Peer 2 Replications Memento Memento

Slide46:

Crowd stations: conclusions (+) Only 1 net object per peer = big gains on bandwidth/CPU (+) Each peer can run their own logics (+) Data is already available on discovery (-) Data is broadcast on all peers even if they don’t need it (-) Execution logic tends to be complicated

Slide47:

CONCLUSION

Slide48:

Network stats Current bps

Slide49:

Network stats Below TRC of 92 kbps per peer (around 30 kbps outside fight ) Most expensive systems: Proxies: list of vectors Player , but high replication quality Crowd life: lots of stations, actually cheap per station

Slide50:

Replication quality

Slide51:

Gameplay replication: conclusion (+) Cheap in bandwidth, no additional CPU cost (+) Good replication quality (+) Multiplayer team = gameplay team (-) Limited to a low number of players (-) Hard to identify sources of divergences

Slide52:

Gameplay replication: conclusion Existing code kept and converted to multiplayer

Slide53:

THANKS ! QUESTIONS ? Special thanks: Maxime Mercier, Félix Duchesneau , Eric Bibeau , Karl Dubois, Nicolas Bonnelly -Belanger, Sebastien Scieux , Rémi Toupin-Gaudet , and all the Assassin’s Creed Unity team

authorStream Live Help