example code for a simple online 2-4 player game

does someone have a sample code/tutorial on how to build a basic network interface for a simple multiplayer game?

I am practising on making a bomberman game and I would like to do the multiplayer through TCP/IP

I want to know how I can let people connect to a server and have them sent their location to the server, and then have the server send all the locations to all the other players. That shouldn’t be too hard to start with right? For now all I need is how to transfer all the player positions to each other.

What 3D engine are you using? JGN (http://javagamenetworking.dev.java.net) has features to easily connect jME and GTGE scene objects via networking. If you’re using some other engine (or none at all) then it’s not quite as easy but there are plenty of examples in the source of how to do it.

I am actually just programming in standard java2D, using swing and awt :-[

but then again, I am also planning to switch to lwjgl or jogl soon, since I am very familiar with programming in openGL using C++

hehe, well I almost mentioned that there is a built-in example in JGN using Swing synchronization but neglected to say so because I figured it wasn’t relevant to your cause. :wink:

ok, I will look into that, thanks. if anyone has a showcase game which uses IP networkingm, I would appreciate it. :slight_smile:

There are dozens of examples in the JGN source. Also, if you check out the JGN forum a few people have posted complete code to games they’ve been developing using it.