Skip to content

Instantly share code, notes, and snippets.

@qingwei91
Last active April 11, 2017 07:31
Show Gist options
  • Save qingwei91/4cfa92fce7a13e4472d180eb227ed66e to your computer and use it in GitHub Desktop.
Save qingwei91/4cfa92fce7a13e4472d180eb227ed66e to your computer and use it in GitHub Desktop.
multiplayer-game-blog
def onReceivedInput(i: UserInput) = {
storeInputToBuffer(i)
}
while(!gameEnded) {
val allUserInputs = readInputFromBuffer()
currentState = step(currentState, allUserInputs) // ie. (STATEn , INPUTn) => STATEn+1
sendStateToAllPlayers(currentState)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment