PushManager v7 - nodeGame/nodegame GitHub Wiki
- status: complete
- version: 7.x
- follows from: Size Handlers
The push manager "pushes" clients that are lagging behind in the game sequence to go to the next step.
To enable, in the logic client type, add the property pushClients
to the steps and stages that require this feature, like in the example below:
// In logic.js
// Enable pushClients with default settings.
stager.extendStep('step_with_default_push', {
pushClients: true,
});
// Or with custom settings.
stager.extendStep('step_with_custom_push', {
pushClients: {
offset: 20000, // Default: 5000
reply: 5000, // Default: 2000
check: 2000 // Default: 2000
});
Note: Make sure that the steps with pushClient
enabled have a timer set either in the
TIMER
object in game.settings.js or directly as a step property.
-
When the step timer expires, if there are still clients that have not yet finished the current step (stageLevel equals to DONE), then the push manager will start a timer of duration
offset
. -
At the end of this timer, clients that are not yet DONE (or that have not stepped forward) will be pinged.
-
Upon receiving the ping, the client will try to call the step timeup function, and then try to step forward.
-
The reply to the ping must arrive to the logic before
reply
milliseconds, otherwise the client will be disconnected. -
If a reply is received in time, then another timer is started of duration
checkPush
, after which it will be checked if the client has successfully stepped forward. If not, the client will be disconnected.