51 lines
856 B
Plaintext
51 lines
856 B
Plaintext
Client:
|
|
loops
|
|
handles input from the user
|
|
handles graphics and sound
|
|
communicates with the server (how?)
|
|
|
|
-------------------------
|
|
|
|
Server:
|
|
loops
|
|
accepts new connections, disconnections, and handles loss of connections
|
|
holds the positions/data of all players
|
|
|
|
Player:
|
|
id
|
|
[graphical stuff]
|
|
position
|
|
velocity
|
|
|
|
-------------------------
|
|
|
|
Player:
|
|
index --global index on the server
|
|
position
|
|
motion
|
|
image --avatar chosen by the player (later)
|
|
ShiftMotion(vector relativeMotion)
|
|
|
|
|
|
PlayerManager:
|
|
Update(delta) //all player objects
|
|
Synchronize(dataArray) //possible
|
|
|
|
-------------------------
|
|
|
|
Rememer: Top down programming/K.I.S.S.
|
|
|
|
KeyDown:
|
|
up:
|
|
PlayerManager.ShiftMotion(playerIndex, up)
|
|
down:
|
|
PlayerManager.ShiftMotion(playerIndex, down)
|
|
...
|
|
end
|
|
|
|
Receive:
|
|
switch(message->type):
|
|
player update:
|
|
PlayerManager.Update(message)
|
|
end
|