This isn't a bug, so no need to pull your guns out
My question is more of a "how should I code":
Here is the deal: I'm always trying to make very friendly lobbies interfaces, and my attempts haven't been very successful using the old SFS Basic, and now I finally had the guts to order SFS Pro, and as far as I can tell, it works amazing, even with the old config.xml from SFS Basic.
Now, with this new "client approach", I'm trying something new: Instead of having the all known and simple "create room" and "join room" scenarios that are basically "less buggy" and more reliable due to concurrency issues, I'm working on a new "random match" system, that will basically handle the client questions of "should I create a room or should I join an opponent's?".
Basically the system will search for about 5 seconds for open rooms matching that player's level with other players around, and if it can't find it, he will then create a room and wait until someone join his game. As great as it sounds in theory, I'm running into a known problem with client requests: Too many players clicking on the "random match", two clients finding an available game room at the same time. Both will try to join and, o well, one of them will be kicked out of the game.
Now I realize that the all mighty SFS Pro can handle server events and, with extensions, multiple requests much better client requests.
My question is: How? I've read a lot on the docs, and tried a lot of the examples, but due to my client engine code that handles everything with SFS Basic public methods, I can't figure out how to migrate, at least the essential concurrency methods, to SFS Pro's extensions.
In other words, how can I convert a simple
Code: Select all
// This code has been reduced to a better understanding :)
var gameRoomExist:Room = smartfox.getRoom(mylevel);
if (!gameRoomExist.getId()){
var room:Object = new Object;
room.name = mylevel;
room.isGame = true;
room.exitCurrentRoom = false;
room.maxUsers = 2;
smartfox.createRoom(room);
}else{
smartfox.joinRoom(gameRoomExist.getId(),"",false,true);
}
To a more stable server side "random match" with no concurrency problems?
// Daniel L.
// www.ederon.com - Online Trading Card Game.