Turning off game step notifications & launching bot before waiting time is over

138 views
Skip to first unread message

a.st...@gmail.com

unread,
Jan 21, 2023, 8:56:33 PM1/21/23
to nodeGame
Hi Stefano, and others,

I think we achieved this in an earlier discussion, but I cannot find it on here anymore: How to turn off the notifications (dark grey background with white font) stating "initializing game step, will be ready soon..."? I believe it had to do with the connection settings deep down.

Second, my game launches a bot when the maximum waiting time expires*. Would it be possible to launch it earlier (while the timer is > zero), to give the impression that a player connected before the timer hit zero?

Best,
Arjen

* ON_TIMEOUT_SERVER: function(player) {
this.CHOSEN_TREATMENT = 'bot';
this.dispatchWithBots();
return false; // prevents disposing the client
}, 

Stefano Balietti

unread,
Jan 22, 2023, 8:11:00 AM1/22/23
to node...@googlegroups.com
Hi Arjen,

You can disable it with this command:

W.init({ waitScreen: false });

However, I believe this will disable all gray screens, including "waiting for other players..." So, you could handle this manually, e.g., by calling at the right moment:

W.init({waitScreen: true});
W.lockScreen("A player disconnected...")
setTimeout(function() {
    W.lockScreen("A player connected") // after a while, this is your BOT
    W.unlockScreen();
    W.init({waitScreen: false});
}, 10000);

This needs to be executed on the client side, so you might have an event listener for those commands. 
It is also a bit more complicated, because you would need to kill the timeout if the player reconnects.

Let me know if you have any questions.

Cheers,
Stefano

--
You received this message because you are subscribed to the Google Groups "nodeGame" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodegame+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodegame/9e7e9f6c-a2e5-426c-86af-c36d2534e3f7n%40googlegroups.com.

Arjen Stolk

unread,
Jan 22, 2023, 12:47:49 PM1/22/23
to node...@googlegroups.com
Grazie mille, that did the job. 

For a follow-up, what's the white bar/box at the top of the page called, and is it possible to query its dimensions, i.e. width on the page?    

You received this message because you are subscribed to a topic in the Google Groups "nodeGame" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodegame/W92EykpvOPk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodegame+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodegame/CAMSNNM%3D9ttNHjHry%3D4ziAOg9J9T%2BkShM7pR3hjni-xUktS9ijQ%40mail.gmail.com.

shakty

unread,
Jan 22, 2023, 4:22:07 PM1/22/23
to nodeGame
You're welcome!

The white bar on top is the header, you can get it as a div element with W.getHeader(); you can then use offsetWidth/offsetHeight to get its dimensions. Here are some more info:

Cheers,
Stefano

Arjen Stolk

unread,
Jan 22, 2023, 5:44:32 PM1/22/23
to node...@googlegroups.com
Excellent, thank you!

Reply all
Reply to author
Forward
0 new messages