HomeWildfire Games

Netcode: Identify controller client via a secret key

Description

Netcode: Identify controller client via a secret key

The 'controller' of an MP game (the host in general, though dedicated servers would change that) is currently whoever first tells the server that it is. This can be abused since it relies on trusting the clients.

This changes that logic: the server defines a 'controller secret', and the first client to sent the correct controller secret is the controller. This is safe assuming the secret is unknowable enough (the current solution wouldn't pass strict cryptography tests, but it's likely good enough).

Reverts rP18140, which introduced the 'trust the clients' mechanic, as a change over 'the first local IP is controller'.

Necessary step towards dedicated server, if we want to use the regular gamesetup (Refs #3556)

Differential Revision: https://code.wildfiregames.com/D3075