gameserver standalone or merged?

Im working on a networked version of a pong clone I wrote. Im thinking about how I can best design the server part. Basically I want a client/server model. The server would be in charge of shared objects like the ball and check for collisions, goals etc.
The client would also compute the ball pos using the same logic, but gets corrected by the server when they’re out of sync.

Is it a good idea to make the server app standalone from the game? Or maybe integrate the server into the actual game classes itself? (so it’d also be easier to switch to a peer-to-peer model later? and it also makes sence as much of the gamelogic is shared).

I’ve started with a server app that is completely seperated from the game (which is an applet). The server application does basically the same things as the game but except the rendering/sound etc and is not an applet. But it doesn’t feel right, i’ve got the same gamelogic at two places that way and other games seem to include the server in the game itself. How is this usually done in multiplayer games?

Thanks!

Martijn

Depends.

On small group games where rondeyvous is over the net (eg Counterstrike, NWN) typically a light server process is started on the host and then al lthe clients symmetircally connect to it.

Logically, thats the easiest way to go because it makes the clients symmectrial. Whether you make the server a seperate process or a trhead running in the same process as one of the games though is a trivial difference in Java. (What I would not do is put it in your game loop, that forces an assymetry into the code.)

Keep in mind though that Applets have pertty serious limits on opening server sockets.

I’m working on a multiplayer space shooter with a kind of similar situation (see it in platform/action games, xtreme spacewar). I have one GamePhysics class that does all calculations… this class is used by both the server and the clients (so you don’t need to write the code logic twice)… but the client physics gets corrected by the server…works good for me.

So the server is running in it’s own process, and as Jeff says, all clients are symmetric. I worked on a networked fighting game once and did it with one of the players actually acting as server… was much more troublesome as I remember it (got alot of assymetry…), but that was years ago, and I lacked alot of network programming experience then…

Im not sure what you guys mean with the clients being symetrical, do you mean that all clients connect to the same server like this:

SERVER

/ |
/ |
C C C

Instead of:

C

/
C------C

And as for each player acting as a server, it would be the case with p2p? Maybe it a game that requires very quick responses from each player could benefit from this scenario?

This is a really a different issue. Here you are addressing a net topology,. The one you have above is called a star network.

This is more like a token ring.

The third type is a “fully connected” network like this:

C — C
| \ / |
| \ / |
| / \ |
| / \ |
C-----C

Of these, a star network is the simplest, a fully connected network the most direct.
Most small group games use star networks.

Jeff I think it’s more like there is no diference with only 3 nodes :wink: (connectivity wise)

Ah yes with this topology:

C

/
C------C

I was actually referring to the same thing as you drawn (a fully connected network, p2p). It might looked like token ring because I used only 3 clients in my example :slight_smile:

But you wrote that hadn’t anything todo with the symmetry you guys where talking about earlier… With asymmetry you meant a difference in the gameloop on different clients connected maybe (as there was some talk about integrating the server into the gameloop)?

Good point 8)

Right the symmetryI was referring to is that all clients execute the same code.

This can be true in any connection model, but it also can not be true if oen is still “playing host”.

It can even be true in a star model IF the host is written as running totally independant from the client code.

When it is destintly not true is if that hosting is mixed with the clien code. Then one client ios doing soemthing different (clienting and hsoting) while the others are just hosting.

edit: er I meant “just clienting” ofcourse.

Can you clarify: do you mean “identical code”? Or do you mean code is centrally located with some kind of remote method accessing?

josh

I mean that all clients are executing identical bits in an identical manner.

Where those bits come from is ANOTHER orthogonal issue.

Thanks. Any recommendations for a good tutorial on getting started with “real-time” small group networked games?

Hmm.

There are various articles around about the bits and peices of networkinf for various types of games. It all tends to be game-type specific. So if yo uare thinkign “FPS” for intance, there are some fairly standard techniques. A racing game, contact sports game, or head to head fighting game are all more or less deemed difficult to impossible across the internet today due to critical timign issues but there are certainyl techniques used for local LAN netowrking.

In general its very very specific to both the game type and the networking environment. I knwo of no one-good-source that lays it all out. (Maybe someday I’ll consider writing/editing such a book but not til Im past my current time crunches.)

Your best =bet in the meantime is to tell us ehre what type of game you want to try to build and we can direct you at specific techniques…