1. Photon vs UNET: Battle of the Giants
Unite Europe 2017
Christof Wegmann | Founder & CTO of Exit Games
2. Who I am – Christof Wegmann
• 2003 Founded Exit Games
Turnkey BaaS for Mobile Phones (Series40/60, J2ME, BREW, …)
• Since 5 Years: Focus on Photon RTMP
210,000 Registered Developers
150 Million Monthly Active Players in the Photon Cloud
Runs on ToastTM
6. What is Client Hosted Architecture?
• One Client is the host and others
connect to it
• Unity == Socket Server
• Option to run as dedicated server
(headless)
9. Advantages Client Hosted
• Host is authoritative
• Simulation right inside Unity
• Local LAN discovery + play
10. Issues Client Hosted
• Host migration
• Dedicated server: Heavy and so
expensive (stability)
• If relayed: 4x hop!
11.
12.
13.
14.
15. What is (Advanced) Relay Architecture?
• All clients connect to “room”
• Room can act as pure relay or
(lightweight) dedicated server
• WebHooks, properties and optional
server side code (NO Unity)
17. Advantages Relay
-Just works everytime...
-Multicast, Webhooks, Properties,
Code, …
-Cost-effective
-BIG Photon titles use THIS
18. Issues Relay
• LAN only works with server
• Might add a bit of latency
• Can use 3PP networking of Steam,
PS4, XB1 or Switch
19. What is Deterministic Architecture?
• Client simulates everything
• Input send>wait>sim (input delay)
• Needs deterministic gameplay code
20. Unity is not Deterministic
• Physics (Replace!)
• Animation System (Display only)
• Floats (Replace!)
• Random (Replace!)
21. Deterministic Architecture
TICK
Peer
1
Peer
2
ALL Simulation Local (delayed)
Input sent to REMOTE and LOCAL
milliseconds
Input DELAY (4 ticks)NOW
b a
a a
20 40 60 80 100 120 140
Each client sends input
to all others.0 1 2 3 4 5 6
Peer 1
Peer 2
C1
C2
C3
Relay
27. Fully Deterministic
• Path Finding (NavMesh)
• Fog of War (integrated into simulation e.g. vision
checks)
• Low network overhead (inputs sent between players)
• No network interpolation required (no artifical delay
added for interpolating gamestate)
• State of the art prediction/rollback deterministic
simulation without lockstepping
• Built-in resistance to cheats that rely on modifying the
game state (making yourself invulnerable, etc.)
• Simulation without Unity to verify game results.
28. Zero Runtime Allocations
• No GC from simulation
code
• Everything is pre-
allocated and re-used
• Blazing fast
performance
Editor's Notes
Why not call relay distributed authority? I know I‘m picky... In the end PUN can be client-hosted if master client is authoritative, and both bolt and thunder DO use relays (not in the advanced sense you describe, but relayed nontheless)... Whatever... The thing is: do you really want to use the word RELAY as a first class approach and not as a transport technology? In the end PHOTON products use relay when needed, but they go beyond it...In my mind is more like:- full client authority (deterministic) – TrueSync and Quantum;- distributed authority (each client auths eachs owned objects and snapshots updates to others) – Default on PUN (possible in Bolt and Thunder – although messages go through clients);- host authoritative – all products can do it, PUN both ways (client machine or server plugin);
Just a note: deterministic (not our products, but in general) ALSO permits LAN play... The only `limitation` of our deterministic products is that we designed them to use photon relay as the sole transport option (because reasons)...
Remember my classification? Lol... Host migration is issue on host-authoritative (check), and not an issue on: distributed auth and deterministic... So my classification is awesome...
#3 is why I don‘t like RELAY as a 1st class approach... Now you‘re saying approach #1 (client hosted) is also relay...
ATTENTION: reducing costs, saving bandwidth, this were concepts I put in my INTERNAL comparison… Not sure if we want to touch this here (sorry, I think I mentioned this to you when I saw the new handouts first time).The danger is that thing about customers wanting price reduction based on punch uses (not CCU).
IF using distributed authority instead of relay:- clients have authority over owned objects;- send periodic updates to others;- normally uses relay as transport;
If talking about distributed authority:
Easiest to prototype;
Cheapest solution often works best;
If we‘re talking about distributed authority:
Difficult to implement physics-based games;
Needs to trust clients;
Think in ticks
Only update if all input arrived (even if no input arrived!)
Input for every frame – but low (dial up modem bandwidth)
Replay files are small, other techiques tend to be very LARGE (spectator games, easy to store and redistribute)
Only chnages with input == # of players
You can have THOUSANDS of units (issue with the other models), as long as you have the guts to make the deterministic code FAST (Quantum)