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?

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.

Got a question about Java and game programming? Just new to the Java Game Development Community? Try my FAQ. Its likely you'll learn something!

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...

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

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)?

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)?

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.

Got a question about Java and game programming? Just new to the Java Game Development Community? Try my FAQ. Its likely you'll learn something!

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...

Got a question about Java and game programming? Just new to the Java Game Development Community? Try my FAQ. Its likely you'll learn something!

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org