Sign in to follow this  

[java] Java multiplayer game

This topic is 4681 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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/javascript/CSS/...).

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
OK but still has anyone here played runescape? Greatest game I have ever played that has beeen created using Java.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Son of Cain
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.


FYI: Hell will probably freeze over before Jagex uses NIO.

Quote:

I believe there is an article about it around a href="www.grexengine.com" here /a.


I think you meant: http://grexengine.com/sections/externalgames/articles/Adam%20Martin-Java%20NIO%20Networking%20for%20Games-1.html

Quote:

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.


NIO is better becuase it is a better programming paradigm. It also happens to be more efficient when handling many hundreds (or more) of players, for several reasons, most of which came about simply because it is more modern and better thought-out then old IO. One of those reasons is not having to pay the cost of a thread-context-switch, but by no means is it the only one.

Share this post


Link to post
Share on other sites
really, the java socket classes are very easy to learn, and quite nice as well, certainly much cleaner than winsock or berkly sockets. Plus, with java serialization, it's a simple task to transmit complex data over the network.

Share this post


Link to post
Share on other sites
Thanks capn_, that's the article I mentioned! Now it is clickable!

And thanks also for clarifying my post... and another thing, I haven't said runescape was made using NIO, I said it is a good chalenge to make a MMO using NIO - sorry if I didn't make it clear, english is not my first language (I'm from Brazil) ;)

Son Of Cain

Share this post


Link to post
Share on other sites
It should be noted that RMI and NIO are not necessarily mutually exclusive - if you have a RMI system which uses NIO (on the server side, at least).

Mark

Share this post


Link to post
Share on other sites

This topic is 4681 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this