multiplayer (applet) java game question

Hi all,

I’m looking for information on creating a multiplayer java applet game. I’ve googled for it, but haven’t been able to find the information i need. I’m looking for things like these:

  1. If i put an applet on a webpage. What are good ways to let the applets that are viewed (at the same time) by a browser obtain eachothers IP. I don’t think there is a way to retreive this information from the server without server side scripting, unless there is some way to get the “active connections” that i’m not aware of. I guess it’s possible to store the ip in a central database or in files on some ftp account, but I rather not store database or ftp passwords in an applet. Or let some server side script send the ip of the first applet to all new ones, which can act as a server. But i’m sure there are better methods that are already in use, which i’m not aware of.

  2. Can an applet function as a server from within a browser?

  3. What is the best network strategy to use. Token ring, Star with a central server, etc …

  4. What are the best java functions and techniques one can use to create a stable network connection.

Any help with this, or links to helpful webpages or source code are greatly appreciated.

Best Regards,
Rick

You would have to sign your applet to be allowed to do this. Unsigned applets can only talk to the server they cam from. By far the easiest way to do this is to have the web server as the game server and have the applets talk to that.

It is possible to do it all with server side scripting alone, where the applet will request a game state every so often, the server then maintains a database of each games state (allowing for multiple games at once) and handles this. But it would probably be easier (& more secure) to have a dedicated server program that runs the games and the applets are thin-clients.

Letting the applet handle any game logic/game decisions leaves it open for abuse - someone could easily build a hacked applet that lets them win all the time. Using a server to handle game logic severely limits this.

  • Dom