BattleOfAI
BattleOfAI copied to clipboard
How to treat old games
I'm here to ask for any suggestions:
The problem is, that the database fills with open and started, but not finished games. Either the player(s) of the game don't want or don't know how to finish the game, but either way, there has to be a solution to keep the database "clean".
ATM it's not possible for the user to just end the game. An endpoint like '/delete_game' might be a good idea. Of course something like the token should be required to delete a game so you only delete your own games. Another option would be to delete all games with no interactions in the last 3/7/30 days.
Issue
At the moment you have unlimited time to make your next move. This leads to games that run endlessly.
Solution
Add a timeout e.g. 5 minutes to send your next move. When the timeout occurs, the player has lost the game. This also puts more pressure to end a game soon.
Issue
At the moment it is not restricted how often you could create a new game. This leads to many empty games, that also could be exploited to run a DOS attack against the server.
Possible solutions
- Restrict to only one game (Waiting and started game state) per player and when a player creates a new game he automatically joins it.
- A player is only allowed to create a new game e.g. every 30 minutes.
In general I agree with @Vitroxyn .
I think when a player doesn't make a move within 24 hours (5 Minutes might be too short for some advanced games and AIs), the game should be considered as finished and lost for this player.
As him, I'd highly recommend, that you automatically join a game that you created 'cause it doesn't make any sense at all to create a game just for joy without joining it.
I'd also vote for a "In-Game-Restriction". Maybe not restricted to one joined game, but to 10 (or even 50).
[...] when a player creates a new game he automatically joins it.
As him, I'd highly recommend, that you automatically join a game that you created 'cause it doesn't make any sense at all to create a game just for joy without joining it.
Creating a game without joining it would make sense in some situations, such as in a tournament (as the organizer). I suggest a boolean join
parameter for /games/createGame
which defaults to true
. This would at least prevent an "accidentally" created game from being forgotten.