• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 575
  • Last Modified:

C# multiplayer server side web game

I have an online version of TicTactoe. I need to make it multiplayer. Just like Yahoo card games but the difference being that those are applets but this program will run on the server side. Is there a way so that I can synchronize and connect two users accessing the web site. That is display the same image in both browsers. That is provide a two player web game that runs on the server.
0
firebird_stang
Asked:
firebird_stang
  • 6
  • 2
1 Solution
 
a_goatCommented:
First, it's probably easiest to implement this as a web service.  Create a web service which allows users to list games in progress, allows them to join a game, and allows them to post a move.  Whenever a move is posted, the routine can wait until the other players moves or the game is over to respond.

Then create a client.  Give the client the same functionality but provide an interface for the user to use.  If you break it up into those individual steps, it's not too hard to create.

You probably want to use threading so that your interface doesn't lock up while waiting for the other player to move.
0
 
firebird_stangAuthor Commented:
Clear but not clear enough. Can I avoid this web service thuing altogether. How about if I use the class webclient. Create two web clients. Make sure that each player takes his own turn and update the second web clients page when the first web client makes a move. Will this work or is this doomed to fail. This web services thing really makes me uncomfortable.
0
 
a_goatCommented:
The problem is that each of those clients needs to access a central server.  You'd need to build the server itself which'd be a pretty big pain.

The Web Services are easy to set up, easy to use, and work over port 80 which is open almost ubiquitously.  Create a web services project in Visual Studio.  You'll see it's super simple.

As an added bonus you can allow third parties to create their own interfaces to your Tic Tac Toe server.  It uses your game logic engine, but allows people to play on whatever system they want.

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
firebird_stangAuthor Commented:
Well Ok. I know how to create a web service.And I already have the interface built. I am not sure if I can use the TCP/IP classes to connect the two online users. My inteface is on a web form. So I need a class though which I can connect two users. Somehow I feel that the class webclient will solve this problem.I have been stuck on this for two days. I have seen many client/server, client to client window forms applications but not a web form one. Man this thing 's really got me confused and frustrated. Isn't there a nice way out there to synchronize a single web form on two different machines(two different clients).
0
 
firebird_stangAuthor Commented:
Well Ok. I know how to create a web service.And I already have the interface built. I am not sure if I can use the TCP/IP classes to connect the two online users. My inteface is on a web form. So I need a class though which I can connect two users. Somehow I feel that the class webclient will solve this problem.I have been stuck on this for two days. I have seen many client/server, client to client window forms applications but not a web form one. Man this thing 's really got me confused and frustrated. Isn't there a nice way out there to synchronize a single web form on two different machines(two different clients).
0
 
firebird_stangAuthor Commented:
Well Ok. I know how to create a web service.And I already have the interface built. I am not sure if I can use the TCP/IP classes to connect the two online users. My inteface is on a web form. So I need a class though which I can connect two users. Somehow I feel that the class webclient will solve this problem.I have been stuck on this for two days. I have seen many client/server, client to client window forms applications but not a web form one. Man this thing 's really got me confused and frustrated. Isn't there a nice way out there to synchronize a single web form on two different machines(two different clients).
0
 
firebird_stangAuthor Commented:
Well Ok. I know how to create a web service.And I already have the interface built. I am not sure if I can use the TCP/IP classes to connect the two online users. My inteface is on a web form. So I need a class though which I can connect two users. Somehow I feel that the class webclient will solve this problem.I have been stuck on this for two days. I have seen many client/server, client to client window forms applications but not a web form one. Man this thing 's really got me confused and frustrated. Isn't there a nice way out there to synchronize a single web form on two different machines(two different clients).
0
 
firebird_stangAuthor Commented:
Well Ok. I know how to create a web service.And I already have the interface built. I am not sure if I can use the TCP/IP classes to connect the two online users. My inteface is on a web form. So I need a class though which I can connect two users. Somehow I feel that the class webclient will solve this problem.I have been stuck on this for two days. I have seen many client/server, client to client window forms applications but not a web form one. Man this thing 's really got me confused and frustrated. Isn't there a nice way out there to synchronize a single web form on two different machines(two different clients).
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now