Skip to content

Instantly share code, notes, and snippets.

@seanreed1111
Last active August 29, 2015 14:14
Show Gist options
  • Save seanreed1111/310c7542517e51761ab3 to your computer and use it in GitHub Desktop.
Save seanreed1111/310c7542517e51761ab3 to your computer and use it in GitHub Desktop.
Thoughts on how multiplayer game should look
// class GameServer (seems perfect for elixir on second pass)
//controls generating a Game and a game id for each game
// log on players
// logging the players (1 or more players) under each gameID
// receive go signal from players that they are ready for the game to begin.
// return ALL the dice rolls for all turns for that gameID, so that no further communication will be required from gameserver
// this also lets the individual ios devices control all the processing
//can also give the go signal to each player, unlocking their screen and allowing players to games sychronously (ha ha!)
// receive logging sequence of numbers played each turn for each player under each gameID
// Checking for the first "winner" message from players - this means each game is actually played locally on their own devices
//notifying all players that game has been won, by player n
//return to top, generating a new game and game ID for each game which defaults to the same players
//remove player and logoff player if they miss two games
// functions for class GameServer
receiveMessageFromPlayer(player: Player, msg: String) ->(){
msg = "ready to play"
msg = "winner"
//notes - player needs a way to get and set and clear his current gameID
// note msg should be struct with defined values
}
broadcastMessage(gameID: gameID, msg: String) -> String{
//sends msg to all players playing in game gameID
// note msg should be struct with defined values
msg = "waiting for players to register"
msg = "begin game"
msg = "player (player.name) is the winner"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment