Games have randomness (shuffle a stack of cards, roll a dice, ...). Since Ravens relies on a deterministic model to properly update the state of the game on the server and on each clients, a special mechanism must be created to allow for randomness.
At it's core, it's quite simple: server-side, before applying an operation, the game must generate a seed and make it available through an API to processAction. When broadcasting the operation to the clients, the server should also send the seed so that the clients can correctly synchronizes their state.
Games have randomness (shuffle a stack of cards, roll a dice, ...). Since Ravens relies on a deterministic model to properly update the state of the game on the server and on each clients, a special mechanism must be created to allow for randomness.
At it's core, it's quite simple: server-side, before applying an operation, the game must generate a seed and make it available through an API to
processAction
. When broadcasting the operation to the clients, the server should also send the seed so that the clients can correctly synchronizes their state.