Skip to content

🌐 Network game supporting AI player clients and GUI spectator clients

Notifications You must be signed in to change notification settings

Albert-Corson/PSU_zappy_2019

Repository files navigation

ZAPPY C/C++ CI

made by: Adrien Lucbert Albert Corson Louis Viot Mathias Vigier Alexis Delebecque Fahad Assoumani


UI/Server communication protocol:

To communicate with the server, a graphical client has to follow this communication protocol.
Note that apart from the initial "-spectator" message, all requests from the graphical clients will be ignored.

Initiating the connection

After receiving the WELCOME message, the UI-client need to respond by -spectator to register as a spectator. The UI-client will next receive the height and width of the map.

--> WELCOME
<-- -spectator
--> map_size height width

/!\ After the connection's initialization, the server will send a first batch of notifications so that the UI-client can catch up on the ongoing game.

Game updates

During a game, the UI-client may receive different types of updates (notifications) about the course of the match. Theses notifications will end by a single new-line character (\n)

NB: <dir> is a numeral representation of the orientation of a player:

  • NORTH = 0
  • WEST = 1
  • SOUTH = 2
  • EAST = 3
new_item <item_name> <y> <x>

A new item has spawned on the map

new_team <max_players> <name>

A new team was created. Be aware that the team's name can be composed of multiple words

new_player <player_id> <dir> <y> <x> <team_name>

A new player has spawned, the inventory notification will be sent right after this one

new_egg <egg_id> <y> <x> <player_id>

An egg has been layed by player_id at [y, x]

inventory <player_uui> [<item_name> <amount>]...

An update of a player's inventory

hatched <egg_id>

An egg has hatched, creating a new slot in it's team for a player to join

died <player_id>

A player has died, leaving a slot in his team vacant

win <team_name>

A team has won and the game has ended. The server will shortly close after this message

elevation_start [<player_id>]...

An elevation has started. The players involved in it is a list of player-IDs

elevation_failed [<player_id>]...

An elevation has failed.

elevation_end [<player_id>]...

An elevation has ended successfully. An inventory update for each participants will be sent right after.

drop <player_id> <object_name>

A player dropped an item from his inventory onto the ground

take <player_id> <object_name>

A player picked-up an item

broadcast <player_id> <message>

A player is broadcasting a message

eject <player_id>

A player has pushed the other players from his tile to the next one in the direction he is facing, this notification with be followed by multiple moves to update the positions of pushed players

move <player_id> <dir> <y> <x>

Moved a player to [y, x] and updated his orientation

forward <player_id>

A player has moved forward

left <player_id>

A player has turned his orientation to the left

right <player_id>

A player has turned his orientation to the right

About

🌐 Network game supporting AI player clients and GUI spectator clients

Resources

Stars

Watchers

Forks