You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to maintain consistency between players, the random number generator will require synchronizing.
Initial Synchronization
Initial synchronization should be performed by hooking the native srand function that has been inlined into the executable. It is available at 0x0059B7BD.
srand() is called on:
Race load start.
Race start (after intro cutscene).
Race restart.
Since srand is only called during initialization, the host should send out a seed to the players every time the function is called and wait for acknowledgements (effectively freeze the game). Players should wait for an acknowledgement from the host.
Constant Synchronization
While initial synchronization should maintain perfect synchronization in theory; in practice there are still edge cases such as a client disconnecting, grabbing an item box and reconnecting.
Other cases include RNG triggering events that may not be hooked by the user.
In order to enforce a consistent RNG for those edge cases, the client's seeds should simply force synchronize with the host in a non-blocking way.
During gameplay, after the host executes the rand function, the host should send a copy of the new seed using the reliable channel. Clients will apply this new seed asynchronously.
rand() is called on:
Periodically on a timer.
On item pickup.
On other similar conditions.
Address of rand: 0x0059B7CA
The text was updated successfully, but these errors were encountered:
Sewer56
changed the title
Synchronization of RNG
[WIP] Synchronization of RNG
May 23, 2020
In order to maintain consistency between players, the random number generator will require synchronizing.
Initial Synchronization
Initial synchronization should be performed by hooking the native
srand
function that has been inlined into the executable. It is available at0x0059B7BD
.srand()
is called on:Since
srand
is only called during initialization, the host should send out a seed to the players every time the function is called and wait for acknowledgements (effectively freeze the game). Players should wait for an acknowledgement from the host.Constant Synchronization
While initial synchronization should maintain perfect synchronization in theory; in practice there are still edge cases such as a client disconnecting, grabbing an item box and reconnecting.
Other cases include RNG triggering events that may not be hooked by the user.
In order to enforce a consistent RNG for those edge cases, the client's seeds should simply force synchronize with the host in a non-blocking way.
During gameplay, after the host executes the
rand
function, the host should send a copy of the new seed using the reliable channel. Clients will apply this new seed asynchronously.rand()
is called on:Address of
rand
: 0x0059B7CAThe text was updated successfully, but these errors were encountered: