Blame view

client/MOT_spec 1.93 KB
bfe98b6db   Pedro L Coutin   MOT_spec
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   Pedro L Coutin   A little more cli...
12
  SRV_BUSY       0xEEEE
bfe98b6db   Pedro L Coutin   MOT_spec
13

154238c11   Pedro L Coutin   spec
14
  MAX_PLAYERNUM  32
9f59b128f   Pedro L Coutin   Lots of things ch...
15
  all the magic numbers will be uint16_t...
bfe98b6db   Pedro L Coutin   MOT_spec
16

9368926a3   Pedro L Coutin   refactoring refac...
17
18
19
20
  TYPES
  unsigned short    magical instruction things
  short             Maze player locations (x, y)
  unsigned char     Player number
95e658213   Pedro L Coutin   A little more cli...
21
  char              Player name, SHOULD BE 32 BYTES (pad with zeroes)
b70047688   Pedro L Coutin   Very basic client...
22
  unsigned int      sizes of things
bfe98b6db   Pedro L Coutin   MOT_spec
23
24
  
  Server: is TCP
154238c11   Pedro L Coutin   spec
25
  handles 32 players max
bfe98b6db   Pedro L Coutin   MOT_spec
26

2f6da6783   Pedro L Coutin   wow spec
27
28
  - If the game already started and someone tries to connect, send SRV_BUSY
    and close the connection...
bfe98b6db   Pedro L Coutin   MOT_spec
29
30
  send the maze for the client.
  * send MAZE_MAGIC
b70047688   Pedro L Coutin   Very basic client...
31
  * send unsigned int, data width of maze (in unsigned chars) (MAZE.w)
bfe98b6db   Pedro L Coutin   MOT_spec
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   Pedro L Coutin   Fix specs and abo...
39
  send current client player's number
bfe98b6db   Pedro L Coutin   MOT_spec
40
41
  
  add players to the connecting pre-game screen as they connect (as well as
46e1e3b4d   Pedro L Coutin   Fix specs and abo...
42
  the ones connected before this player, if any, AND the current player)
bfe98b6db   Pedro L Coutin   MOT_spec
43
44
  * send ADD_PLAYER
  * send unsigned char player number
95e658213   Pedro L Coutin   A little more cli...
45
  * send short X, Y in maze
bfe98b6db   Pedro L Coutin   MOT_spec
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   Pedro L Coutin   Added linked list...
54
  from server - other players to the client:
bfe98b6db   Pedro L Coutin   MOT_spec
55
56
57
58
  
  A player MOVES on the maze
  * PLAYER_MOV
  * unsigned char pnum, short x, short y
154238c11   Pedro L Coutin   spec
59
  > Allow players to walk through each other???
bfe98b6db   Pedro L Coutin   MOT_spec
60
61
62
63
64
65
  
  A player wins
  * send PLAYER_WIN
  * send unsigned char pnum
  
  Player disconnects/loses/get hunted
9f59b128f   Pedro L Coutin   Lots of things ch...
66
67
  * send PLAYER_DC for disconnect
  * send PLAYER_DIE for lose
bfe98b6db   Pedro L Coutin   MOT_spec
68
  * send unsigned char pnum
154238c11   Pedro L Coutin   spec
69
  > clear the player from the screen
bfe98b6db   Pedro L Coutin   MOT_spec
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