Skip to content

Network

Gwilherm Baudic edited this page Dec 15, 2019 · 1 revision

Network

General information

Even if LinBound is not designed to be a real-time game, it will use UDP. Client and server would listen on port 6545 and send from port 6543. There will be a possibility to use encryption thanks to the SSL library that can be used through libcURL. All the information exchanged will go through the server which will do some rerouting or broadcasting when needed.

Protocol messages

PLEASE NOTE : obviously no reverse engineering would be used to understand and implement the GunBound protocol. If LinBound really gets compatible with softnyx's service, it will be thanks to their effort to code a library. This is the main reason why the license is not GPL, which would have allowed me to reuse the code from the very similar WarMUX or Hedgewars games.

As a result, the following ideas may change and have not been taken from anywhere but my own mind^^ Please feel free to contact me if you see things that are horrible, i.e. redundant or inappropriate structures, unnecessary complexity...

Packet description

The elementary packet used in the game would have:

  • a sender
  • a recipient (which could be a username or CHANNEL, SERVER, TEAM, ROOM)
  • a message ID (to detect any losses)
  • a response ID to indicate that the current message is sent as a reply (ex: server asks for shoot coordinates)
  • an integer code to identify the type of the message (chat text message, user information, room information, shoot coordinates...)
  • a string which would have the main content.

Identification codes

TBD , see protocol.hpp.

Connecting/disconnecting from server

Connection request from client : 10 login password protocol version to use

Reply from server : 0=OK; 23=unsupported protocol, 4=unknown login, 3=wrong password, 6=server full, 7=unsuitable level for this server
220 : player info (items, points, stats...)
8 : ping
9 : pong

255 login : disconnection request. Server may disconnect you after 5 minutes of inactivity (no message sent, no ack of a message from the server). Reply is always 254 login.

Chat messages

100 user message : same format for all scopes
101 message : for all team members
102 message : for all players of this game
103 message : for whole server

Game messages

50 name password : room creation
116 : your turn
215 <type> <map> <A/B> <nb teams> <nb players> <turns> <sudden death> : room settings
134 +item1 -item2 ... : item changes
120 power angle : shot
125 user damage ... : shot results for each player
111 power angle : wind change
142 type x : extra item falling down
141 name x turns : player falling down in turns turns
116 user reward amount points : reward for user user
117 user penalty amount points : penalty for user user (amount is positive, although it is in fact negative)
150 : results