]> git.cworth.org Git - empires-server/commit
Allow for games to opt in to allow "Guest" users
authorCarl Worth <cworth@cworth.org>
Sat, 6 Jun 2020 12:58:53 +0000 (05:58 -0700)
committerCarl Worth <cworth@cworth.org>
Sat, 6 Jun 2020 12:58:53 +0000 (05:58 -0700)
commite368873853353b4b8949bfdf3c560b484e4cfb88
tree251721f1846d061cc35eb2775303ca4185968689
parentdbeeca917db24aaaffabc63072365f31ac2652ab
Allow for games to opt in to allow "Guest" users

Here we allow a new object to the game metadata called "options" and a
new optional property in that called "allow_guest".

If this option is present and true, then the choose-nickname form does
not require the user to enter a name, but will use "Guest" by default.

This is convenient in a 2-player game, for example, where the two
players are the only ones present so there's no ambiguity over who is
who.

But this could be very confusing for a party game like Empires.

That is why, in this commit, tictactoe.js sets allow_guest to true
while empires.js does not.

Also, now that it's even more likely for there to be name collisions,
(such as multiple people entering the game as "Guest"), when adding a
player we not automatically append a numeric suffix to their name to
make it unique within the game. (Note: The name in the session is left
untouched so if a user with the same session joins a different game
and the session name is unique there, it won't get any suffix.)
game.js
lmno.js
templates/choose-nickname.html
tictactoe.js