Server for the local multiplayer hangman, a toy network project
To run this project you only need to have installed the programming language zig and run:
zig build run
The player must get the word right, the first to do so will be the winner. The player has a limited number of tries before he loses, the amount of tries depends on the difficulty If player guess word wrong then he loses, if he guess it right he wins
user register player_name
register a player, checks ifplayer_name
is unique and returns aplayer_uuid
user logout player_uuid
unregister a playerroom create room_name player_uuid difficulty
returns theroom_uuid
the difficulty is defined byD
, the creator is automatically inserted into the roomroom exit room_uuid player_uuid
player exist the room, if it is the creator then the room is deletedroom list all
returns all the available rooms waitingroom join room_uuid player_uuid
join given roomroom send_msg room_uuid player_uuid message
player sends message to all players in given roomroom kick room_uuid player_uuid player_index
creator can kick player at player_indexroom start_game room_uuid player_uuid
creator of the room starts a game, notify the players that the game startedgame_uuid
game guess_letter game_uuid player_uuid L
player guess letterL
, if successful continues to play, otherwise loses a life and another player gets his chancegame player_index game_uuid player_uuid
getplayer_index
at givengame_uuid
game exit game_uuid player_uuid
signalizes thatplayer_uuid
of gamegame_uuid
game guess_word game_uuid player_uuid WORD
player guess theWORD
, if successful player wins, otherwise loses all his tries and stays as spectator
Clients must receive those
- game ended
- player state changed
- player joined a room, signal sent to the members of the rooms
- current player changed
- player guessed letter/word