Jump to content
  • Advertisement
Sign in to follow this  
TheGecko

Programming a game lobby....in a webpage!

This topic is 4268 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey people, Ok, bare with me on this as I'm unsure what solutions I have to this problem. I'm developing a game where most of the stuff you do is done in your acount on a webpage. I've also developed a 3D engine inside an activeX control to run the game in 3d in real time. Here's what I'm trying to do. The player has finished setting up his team and settings and everything etc. on his account homepage and now he wants to challenge another player by going to the game lobby page. Once in the game lobby page, he will get a list of players waiting to be challenged. When he finds a competitor, he clicks his name. A message should be sent to the other player asking him if he wishes to accept the challenge.If so, BOTH players will be redirected to a page where the ActiveX control game resides and a game starts between the two. The IP addresses of both players are passed to this control so that it can connect the two. I understand that most of you are thinking that this is such a bad design for a game, but I still need to know how to go about solving it. I thought about maybe putting the game lobby code in the control itself, but taht would mean I would have to develop a GUI system for my engine. Something I'm not willing to do right now :p Any ideas? My site is being done in ASP.NET v2.0 and C#. I'm going all out .NET and SQL 2005 on this thing. Any help would be appreciated. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Set up a database that holds all active games and the players involved. List those out on the lobby page (possibly only showing games that can accept new players) and let players click on a simple link to join each game, e.g. foo/joingame.aspx?gameid=4858. In the joingame page, embed your ActiveX control and pass it the game ID parameter. The control should then query the database for that game ID and retrieve the IP addresses and any other required info to actually join the game.

Ideally you'd also update the database record to flag that the game now has an additional player. Depending on how many players are valid per each game, the mechanism you use for this will vary.

Share this post


Link to post
Share on other sites
Hey ApochPiQ.

That's exactly what I'm doing right now. But the problem lies in the following scenarios:

(1) How would I launch the other persons ActiveX game on the receiving end? Or do you mean that the other person would already have his game launched and in a waiting state till someone joins in?

(2) What if the other person does not want to play against the person who connected to him? I want to send a message to the first player that I am interested in joining his game if he would accept.

It's little things like that that cause the big headaches :p Maybe my designed is flawed from the beginning. The best way would be to actually have the game lobby INSIDE the game itself, but to create a whole GUI system is going to take a lot of time!

Any ideas?

Share this post


Link to post
Share on other sites
A waiting state should work fine; Bob connects up and requests to start a new game. The control then sits in a "waiting" state and periodically asks the database if any partners are available. If so, the two are given each others' IP addresses and the game begins. You can add a simple step here that shows a box like "Joe wants to begin playing. Play with Joe? yes/no". The only interface you have to handle is that one yes/no, which could be a button, or require you to press the Y/N keys, or whatever.

Share this post


Link to post
Share on other sites
Shameless plug: a game lobby system in C#. Okay, so the GUI isn't web friendly, but you'd have to write the GUI anyway, right?

You shouldn't try to connect the two players directly; chances are they won't be able to connect to each other (routers, firewalls) and even if they could they'd probably get a slow connection. It is better to run the games through the server.

In terms of the back end, there are two tables required: games and players, each of which has links to the other (players may be in 0 or more games; games contain 1 or more players). That shouldn't be a problem for a database, though it seems slightly like overkill to me unless you are using the database anyway.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!