so, i'm currently writing match-making code for my game, i'm using apache, php, and a mysql database. the game is not real-time with opponents, so the database is used for maintaining a persistent game, essentially a client well ask for the game's current state, and then the user well play if the opponent has taken their turn.
essentially what i'm doing for match-making is a request comes into my server, and i ask the database for any games that don't currently have an opponent, i select the first one, add myself into the game, and then start the game(this is completly automated, their is no choosing a game from the client). if no game is available, a new game is created, and waits for an opponent to add themselve's into the game.
my problem is that i can foresee problems like this:
client A asks for list of games available, client B then asks for a list of games(which is the same list client A has), client A add's itself to the first game avaialble, client B add's itself to the first game avaiable, now client B is actually in the game, but client A thinks it's in the game.
any ideas on an probable approach that would be possible?
Edited by slicer4ever, 03 January 2013 - 06:48 AM.