PDA

View Full Version : Can You Make Clusters Of Online Games?


Davaris
04-23-2007, 08:24 PM
Hi Everyone,
I have no experience with online programming so I thought I'd ask for some general advice before I start.

What I want to to is make a game that runs off my website where a maximum of 5 players can create a game and play it. I also want other players to be able to form small groups and play different instances of the same game also through my website. So I guess I want to be able create clusters of the same game, where the players can allow others to join them if they want.

So I was wondering, can I do this with RakNet? Or are there other libraries that can do this? Also do I need to have my PC connected to the net at all times to act as a server? Or can I set something up with my ISP or on my webpage?

Any help would be greatly appreciated. :)

MrQ
04-23-2007, 08:53 PM
You could do that with Raknet using a server->client system. Client requests the server to spawn a game and you can have multiple games running on the one server.
Raknet Is quite flexible, we are using it for our upcoming title.

I'm not a programmer though and by the sounds of it you want something running in a browser? If that is the case, then maybe you should be looking at something like Java? I'm not totally sure. Maybe a programmer here could point you in the right direction.

Davaris
04-23-2007, 09:27 PM
I'm not a programmer though and by the sounds of it you want something running in a browser? If that is the case, then maybe you should be looking at something like Java? I'm not totally sure. Maybe a programmer here could point you in the right direction.

What I want to do is only allow the players to link up with their friends through me. That way I'll be able to create and cancel accounts so the pirates can't play.

The only problem is I can't leave my PC on 24 hrs a day, unless the game is making tons of money (Ha!). So if there is an alternative to doing that, I'd like to find out about it. :)

Pyabo
04-23-2007, 09:53 PM
Hey, I just had a brilliant idea for a business... What if I got a nice fat Internet connection... and then connected a bunch of computers to it... and then let people "rent" out these machines!

Now to go search the web and see if anyone is doing this already.

:rolleyes:

Hard to believe you know what an ISP is, but you've never heard "dedicated servers." :)

For that matter, why the heck *couldn't* you leave your PC on 24 hours/day???

Davaris
04-24-2007, 12:14 AM
Hey, I just had a brilliant idea for a business... What if I got a nice fat Internet connection... and then connected a bunch of computers to it... and then let people "rent" out these machines!

Now to go search the web and see if anyone is doing this already.

Hard to believe you know what an ISP is, but you've never heard "dedicated servers."

For that matter, why the heck *couldn't* you leave your PC on 24 hours/day???


Are you trying to be rude or am I misunderstanding you?

XIX
04-24-2007, 03:44 AM
Hi Everyone,
What I want to to is make a game that runs off my website where a maximum of 5 players can create a game and play it. I also want other players to be able to form small groups and play different instances of the same game also through my website. So I guess I want to be able create clusters of the same game, where the players can allow others to join them if they want.



You probably want to do something like this

http://www.s3dconnector.net/connector/s3dView.php

Users download a client/server then some of them run a server (there are issues with firewalls) which talks to the website. The website keeps track of servers currently active and tells the clients which servers they can connect to but doesn't run the actual servers itself.

Sybixsus
04-24-2007, 05:38 AM
I'd have thought the easiest way to do this would be to have a MySQL/PHP verification system on your website ( assuming you've got a really good host ) and then have the game log in to the database before playing. I don't really do any PHP/MySQL but I'm thinking it would be reasonably straightforward to have the login system accessed from a game ( you'd have to encrypt your packets, but still.. ) and then track the online users and let them see each other to match up for a game.

jankoM
04-24-2007, 06:22 AM
The most usual way for a custom client app to talk to some http server is to use a RPC (remote procedure call). The most notable RPC standard is XMLRPC and you can find libraries for it in almost any language.

But this could be used more for something like a lobby... finding players, connecting players, login into the system, taking scores..... if you have a multi player game a http server is not of that much help. Even if it's a very slow or turn based game (that players play in real time - in contrast to TB game that you play 1turn/day) you have to pool for changes (you have to ask "are there any changes"... changes don't come to you when they happen). Well there is a way that is called Comet (which is very slow loading http request) that "streams" you new events as they happen, but usual web servers are not really made/optimized for this.

once you have the player's IPs and they are goruped into "clusters" you could use something like raknet to do the ingame communication between them... or create a custom socket server...

If you will need RPC.... I have made something called SoTinyRPC which is really simple to use and at the same time solves many of headaches XMLRPC was giving me. It is dead simple on client and server side.

I just made this up quickly out of my head as an example... STRPC webapp for posting scores to a webserver...

$server = new ScoreServer($GLOBALS['dbc']);

$map = array(
array('server', 'storeScore',
array(
array('name', 'string'),
array('score', 'integer'),
array('level', 'integer'),
),
),
array('server', 'getScores',
array(
),
),
);

$rpc = new STRPC();
echo $rpc->serve($map);

And this is the backend class (which as you see is pure backend without any RPC specific stuff)
class ScoreServer
{
var $dbc;

function ScoreServer($dbc)
{
$this->dbc = $dbc;
}

function storeScore($name, $score, $level)
{
DBs::insertRow($this->db, 'scores', array($name, $score, $level);
}

function getScores()
{
return DBs::selectRows($this->db, 'scores');
}
}

Client side is even simpler if your environment allows you to do simple HTTP GET or POST request or even just open a browser at given location. I intended to make in open source but yet haven't found time. Besides ultra simplicity it has other to me very important advantages over something like XMLRPC (mainly in regards of debugging it).

Pyabo
04-24-2007, 12:21 PM
Are you trying to be rude or am I misunderstanding you?

A little of both, I suppose. See the smiley face?

facetious (http://dictionary.reference.com/browse/facetious)