[java] Java multiplayer game

Started by
12 comments, last by markr 19 years, 2 months ago
I have been programming in Java for a while now, but mostly applications and a few applets that are far from groundbreaking... My java skills over a network are, however, quite a bit under par. In my spare time I have been developing a sort of tradewars/ utopia/ earth2025... well really it's justa mixture of some of the best components of all the old style BBS door type games. When I look at Java games online, they seem to be more the action/arcade type. I was wondering if java is a viable option for this type of game. And if it is, (which I figure it should be) what direction I should be looking to transition between an application/applet to an online game.
Advertisement
You can go one of 3 routes. Applet, application or web application.

If your game is turn based, then a web application would be a good choice. You don't have to write any network code for it and all your users will always be playing the latest version(User needs no downloads or patches).

Applications have a more robust interface, especially if your game is real time. You will have to write your own network code however.

Applets aren't a bad choice if you can stick to Java v1.1.7 or earlier. Most people on Windows machines can't be bothered to install a plugin for newer versions of Java. Plus with webstart, you can have a full blown application that is launched over the Net.
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
Ya here is as great example of a purely java coded web mmorpg and comepletely free too! But there is a downside to making a java based game as ppl have done with this one. You can find the file store location of the client's class files then deobfuscate and decompile and make bots/other cheating programs for it.

Link is www.runescape.com
Quote:Original post by Tallshortkid
Ya here is as great example of a purely java coded web mmorpg and comepletely free too! But there is a downside to making a java based game as ppl have done with this one. You can find the file store location of the client's class files then deobfuscate and decompile and make bots/other cheating programs for it.

Link is www.runescape.com


Runescape is an Applet, not a web app. A web app is very secure.
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
O well would you have to upload the class files to run a web app anyways?
Quote:Original post by Tallshortkid
O well would you have to upload the class files to run a web app anyways?


The class files reside only on the server. They generate HTML for the user to look at. The only interface the user sees is their browser and the web pages that the web app generates(HTML/&#106avascript/CSS/...).
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]

With web apps, you can use Servlets that will process HTTP requests from clients (browsers). You can use this to maintain client state of several applets (the interface you may want to use) without exposing code.

If you plan to make a desktop app with Web start, I suggest you take a look at Java NIO, since it allows asynchronous IO - but only available in SDK 1.4 and beyond.

a.k.a javabeats at yahoo.ca
If you're going for something along the lines of E2025 or Utopia, I'd recommend using Php instead. It's pretty similar to C++ and Java so if you're well versed with either, it should be easy enough to learn. Another idea to ponder is using a php game engine with an applet to support it with graphics/added user interaction. A good example of this would be Galactic Emperor over at Skotos.net.

I know that Java's more than capable of doing the same things, but the database interfaces in Php seem easier to me. Less code to get the same thing done, not to mention that php is pretty much made for use with mysql. Just my opinion anyway.
OK but still has anyone here played runescape? Greatest game I have ever played that has beeen created using Java.
Hi,

I haven't played runescape, but after searching for it I found out it is a MMO game. That's a good challenge to use java NIO with those games. I believe there is an article about it around here.

Another option to this kind of game is RMI, where you would create a Remote object (GameServer) to handle client state of several apps. In terms of performance, the above (NIO) is the best option, since it does asynchronous IO.

Hope it helps,
Son Of Cain
a.k.a javabeats at yahoo.ca

This topic is closed to new replies.

Advertisement