Gdc gameplay replication in acu with videos
-
Upload
charles-lefebvre -
Category
Presentations & Public Speaking
-
view
366 -
download
0
Transcript of Gdc gameplay replication in acu with videos
![Page 1: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/1.jpg)
Gameplay and AI networking
in Assassin’s Creed Unity
Charles Lefebvre
AI programmer, Ubisoft Montreal
[email protected], @FrozenInMtl
![Page 2: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/2.jpg)
Unity
![Page 3: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/3.jpg)
Unity
![Page 4: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/4.jpg)
Unity
![Page 5: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/5.jpg)
Unity
![Page 6: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/6.jpg)
Unity
![Page 7: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/7.jpg)
![Page 8: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/8.jpg)
glossary
Migration
Entity
Join in progress
Session Memento
NetObject
Master
Replica
Simulation bubble
PeerPeer to peer
Player
Multiplayer
Network keyDiscovery
Host
Components
Coop
![Page 9: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/9.jpg)
NetObject
glossary
M
Peer 1 Visual component
AI component
Animation component
Network component
Network key
Entity
Network key (u64) = peer + type + ID
![Page 10: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/10.jpg)
glossary
M R
Peer 1 Peer 2
Mementos
M
![Page 11: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/11.jpg)
NetTokens
NetTokens: Layer for peer to peer conflict resolution
t=5
t=4
no
Peer1
yesPeer2 Peer3
t=4
t=5
yes
yes
![Page 12: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/12.jpg)
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
![Page 13: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/13.jpg)
remote 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
![Page 14: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/14.jpg)
Flow examples:
remote procedure call
Replica Replica Replica
Master
Replica Replica
Master
Replica Replica
Master
![Page 15: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/15.jpg)
NetHandle
struct NetHandle{
Handle<Entity> m_Entity;NetKey m_NetKey;
bool IsValid();Entity * GetEntity();bool GetPosition(vec4& position);bool GetSight(vec4& position);
}
![Page 16: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/16.jpg)
NetHandle
?
NetHandle
(full entity)
??
?
Simulation
bubble
Undiscovered
entity
![Page 17: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/17.jpg)
![Page 18: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/18.jpg)
Spawning strategy
Spawning client
system
Spawning
request Spawning strategy
Spawning manager
Spawning strategy
Mementos
![Page 19: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/19.jpg)
Peer 1 (spawner)
simulation bubble
M
replication
Net descriptor
Spawning
request
Spawning
requestR
![Page 20: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/20.jpg)
replication
Peer 1
loading range
Peer 2
loading range
Spawning
request
Spawning
requestToken
M R
![Page 21: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/21.jpg)
gameplay
• Replicate the crowd event generation in echo
• Replicate the victim/thief in engine
![Page 22: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/22.jpg)
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
![Page 23: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/23.jpg)
![Page 24: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/24.jpg)
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
![Page 25: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/25.jpg)
comparison tool
![Page 26: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/26.jpg)
HSM
Animation
NetBehaviorAI
Replica
Replica Brain
flow
Controller
HSM
Animation
NetBehaviorAI
Master
Replication
Final decisions
![Page 27: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/27.jpg)
final decisions
![Page 28: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/28.jpg)
conclusions
(+) Good replication quality
(+) Can recover nicely from divergences
(-) Expensive in bandwidth
(-) 3 state machines (HSM / NetBehaviorAI / animation graph) to
maintained
![Page 29: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/29.jpg)
![Page 30: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/30.jpg)
• Replicate NPC behavior at a very low cost
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
![Page 31: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/31.jpg)
flow
Logic
HSM
Animation
HSM
Animation
Intentions
Master
Intentions
Replica
Logic
Replication
![Page 32: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/32.jpg)
replication
Animations Navigation Weapons LookAt
Idle IdleIdle Idle
Play animation
Push
Stumble
…
Go to position
Wander
Follow
…
Sheath
Unsheath
Fire
…
Look at
position
Look at
target
RPC
![Page 33: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/33.jpg)
conclusions
(+) Cheap in bandwidth
(+) Seamless migrations
(-) Average replication quality
(-) Services (navigation, animation…) must also be synchronized to
prevent behavior branching
![Page 34: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/34.jpg)
![Page 35: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/35.jpg)
coordinators
• Spawn NPCs
• UI
• Interactions
![Page 36: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/36.jpg)
coordinators
Sensors
Distance
Line of sight
UI
Coordinators in previous Assassin’s Creed games
…
Actions
![Page 37: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/37.jpg)
coordinators
Net data
Sensors synthesis
Execution count
Local state
Released entities
For local player
Sensors
Distance
Line of sight
UI
…
Actions
R
M
M
![Page 38: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/38.jpg)
coordinators
Replica
Net data
Sensors
synthesis
…
Sensors
Replica
Net data
Sensors
synthesis
…
Sensors
Master
Net data
Sensors
synthesis
…
RPCSensors
RPCRPC
MementoMemento
![Page 39: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/39.jpg)
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
![Page 40: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/40.jpg)
![Page 41: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/41.jpg)
stations
![Page 42: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/42.jpg)
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
![Page 43: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/43.jpg)
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
![Page 44: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/44.jpg)
replication
![Page 45: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/45.jpg)
replication
What to replicate ?
• NPCs
• Station state
Master = token winner
![Page 46: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/46.jpg)
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
Replication
s
Memento
Memento
![Page 47: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/47.jpg)
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
![Page 48: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/48.jpg)
![Page 49: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/49.jpg)
statsCurrent bps
![Page 50: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/50.jpg)
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
![Page 51: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/51.jpg)
quality
![Page 52: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/52.jpg)
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
![Page 53: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/53.jpg)
conclusion
Existing code kept
and converted to
multiplayer
![Page 54: Gdc gameplay replication in acu with videos](https://reader033.fdocuments.us/reader033/viewer/2022051617/55a51e071a28ab3b5a8b4858/html5/thumbnails/54.jpg)