Last active
April 11, 2017 07:31
-
-
Save qingwei91/4cfa92fce7a13e4472d180eb227ed66e to your computer and use it in GitHub Desktop.
multiplayer-game-blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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