mmmries / ref

An elixir game server for playing simple games
http://games.riesd.com
4 stars 0 forks source link

Match Making #7

Open mmmries opened 9 years ago

mmmries commented 9 years ago

Think "Tinder for AI games"

There should be a protocol where you can open a websocket and ask to be matched up into a game, then the server will create games for the connections that are waiting in the queue.

For example:

connection1 asks for a match {token: "t1", name: "bob"}
connection2 asks for a match {token: "t2", name: "gob"}

The server sees that it has two pending requests and generates a unique `game_id`

TicTacToe.create_or_join("tictactoe:#{game_id}", %{token: "t1", name: "bob"})
then adds connection1 to the "tictactoe:#{game_id}" channel and sends it a message like {topic: "tictactoe:#{game_id}", role: "X"}
TicTacToe.create_or_join("tictactoe:#{game_id}", %{token: "t2", name: "bob"})
then adds connection2 to the "tictactoe:#{game_id}" channel and sends it a message like {topic: "tictactoe:#{game_id}", role: "O"}

Unanswered questions:

mmmries commented 9 years ago

I started implementing this in the match maker branch, but I'm leaving it to the side for a while because I think creating games against a hosted AI is a more important feature to have ready for UV.rb September.