Blame view
client/MOT_spec
1.93 KB
bfe98b6db
|
1 2 3 4 5 6 7 8 9 10 11 |
MAZE_MAGIC 0x6D7A ADD_PLAYER 0x4E45 HUNTER 0x4855 ILLEGAL_MOV 0xF000 PLAYER_MOV 0x4D4F PLAYER_DC 0x4443 PLAYER_DIE 0x4B4F PLAYER_WIN 0x5749 |
95e658213
|
12 |
SRV_BUSY 0xEEEE |
bfe98b6db
|
13 |
|
154238c11
|
14 |
MAX_PLAYERNUM 32 |
9f59b128f
|
15 |
all the magic numbers will be uint16_t... |
bfe98b6db
|
16 |
|
9368926a3
|
17 18 19 20 |
TYPES unsigned short magical instruction things short Maze player locations (x, y) unsigned char Player number |
95e658213
|
21 |
char Player name, SHOULD BE 32 BYTES (pad with zeroes) |
b70047688
|
22 |
unsigned int sizes of things |
bfe98b6db
|
23 24 |
Server: is TCP |
154238c11
|
25 |
handles 32 players max |
bfe98b6db
|
26 |
|
2f6da6783
|
27 28 |
- If the game already started and someone tries to connect, send SRV_BUSY and close the connection... |
bfe98b6db
|
29 30 |
send the maze for the client. * send MAZE_MAGIC |
b70047688
|
31 |
* send unsigned int, data width of maze (in unsigned chars) (MAZE.w) |
bfe98b6db
|
32 33 34 35 36 37 38 |
* send unsigned int, size of maze in bytes * send the whole maze byte by byte * wait for MAZE_MAGIC packet expect player name right after sending the maze (the player chooses name before connecting) * receive null terminated string |
46e1e3b4d
|
39 |
send current client player's number |
bfe98b6db
|
40 41 |
add players to the connecting pre-game screen as they connect (as well as |
46e1e3b4d
|
42 |
the ones connected before this player, if any, AND the current player) |
bfe98b6db
|
43 44 |
* send ADD_PLAYER * send unsigned char player number |
95e658213
|
45 |
* send short X, Y in maze |
bfe98b6db
|
46 47 48 49 50 51 52 53 |
* send null-terminated string for the name Choose hunter (which means the game begins) * send HUNTER * send the unsigned char value of the hunter player Player updates ============== |
fef9a1f6b
|
54 |
from server - other players to the client: |
bfe98b6db
|
55 56 57 58 |
A player MOVES on the maze * PLAYER_MOV * unsigned char pnum, short x, short y |
154238c11
|
59 |
> Allow players to walk through each other??? |
bfe98b6db
|
60 61 62 63 64 65 |
A player wins * send PLAYER_WIN * send unsigned char pnum Player disconnects/loses/get hunted |
9f59b128f
|
66 67 |
* send PLAYER_DC for disconnect * send PLAYER_DIE for lose |
bfe98b6db
|
68 |
* send unsigned char pnum |
154238c11
|
69 |
> clear the player from the screen |
bfe98b6db
|
70 71 72 73 74 75 76 77 |
from the client to the server: Move * PLAYER_MOV * short x, short y * if the move is illegal, send ILLEGAL_MOV and don't send move update to players |