Skip to content

Instantly share code, notes, and snippets.

@prail
Created October 21, 2017 02:05
Show Gist options
  • Save prail/cd14e938b3fb715f5165cacbc34c0a97 to your computer and use it in GitHub Desktop.
Save prail/cd14e938b3fb715f5165cacbc34c0a97 to your computer and use it in GitHub Desktop.
Just pseudocode for a simple multiplayer system.
if is host
while waiting for all clients.
send an accept packet to client.
send start packet to all clients.
while gameloop running
while not all data packets recieved
collect data packets from client.
send all packets to each client excluding sender.
update game state.
if is client
connect to host
while connected to host
do game input and process
send data to host
wait and recieve data from host.
update game state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment