There is a game called Verbosity (it’s a Game With A Purpose) and it’s on this link
http://www.gwap.com
in the game they connect two players randomly to play with each other, the game is that player1 should describe a word to his partner(player2) and player2 should gues the word.
I’m trying to build a website that do something like that, but I wonder
1- how I can connect two players randomly to let them play together although they are not registered users ( they are just guests to the website )?
2- how to make them playing in private game, i mean each two players are playing their own game?
3- What would I need to use? Is it enough to use ASP.Net? Do I need silverlight?
Thanks
In my understanding we have two logic entities:
Games: involve interactivity between two players in private
Players: Visitors (anonymous) of a web site
I will start with Players because it’s easier. A visitor lands on your site and there is a need to (uniquely) identify him. The easiest solution is a Guid that can be used as a session parameter or as a session cookie (my suggestion). Guid is not a nullable type so any Guid of 32 zeros will be our undefined Guid.
Having your GUIDed visitors, you need a key/value collection that will connect them to games.
Scenario 1:
Each visitor can be a player for only one game at a time. A Dictionary<player, game> can do the job and visitors who are not players can easily be traced (game = undefined Guid)
Scenario 2:
Each visitor can be a player for many games at the same time. A Dictionary<player, List<game>> is the solution but game = undefinedGuid will become List.Count = 0
Now let’s see what you can do with games. First of all you can use GUIDs to identify your games. This means that your players dictionary will be Dictionary<Guid, Guid> for scenario 1 or Dictionary<Guid, List<Guild>> for scenario 2. Obviously you will need a key/value collection for the games, let’s say in the form of Dictionary<gameGuid, gameDetails>. GameDetails must be a class holding the necessary information that can define the interactivity between the players. In other worlds this class must include the role of each player (role 1: the one who asks or role 2: the one who is guessing) and the messages they exchange as a key/value collection where key is the player Guid and value is a string message.
To summarize you will need two static dictionaries defined in your global.asax, one for the players and one for the games. You will also need a GameDetails class similar to this (basic concept implementation):
Adding and removing players is easy as well as games (players are connected to games).
There are a lot of other things you can do (ie the one who guesses quits and you randomly assign another player to continue etc).
More or less this is also the way to make an asp.net chat with private rooms. It may be helpful for you to find and check a good sample of a simple asp.net chat script, see the logic and the implementation and adapt them to the above. In addition you can extend the chat script to support private rooms and have two applications instead of one.
Needless to say that asp.net is more than enough for your project. What you have to take in account is that if you cannot control you application pool recycling you will also need a persistence layer otherwise you may loose your dictionaries.
If you need more help just let me know.