JME Suitable For Online Multiplayer Game?

Hello,



Can i just say, WOW. This software looks fab. I am considering using this to develop my game. Its a MMORPG (without the first M) similar to the popular java online browser fantasy games around today.



Now is it possible for me to create a game with JDK and then put on my website so it can be played through others browsers. Now I'm on a shared server so there are some limitations -



  • I cant install install onto the server, I'm assuming nothing needs to be installed onto the server once i compile the game on my pc.

  • I cant use server side java but i can use it in applets, so I'm presumming creating a game with this is still possible.



Can i create a game without the above?
    * I cant install install onto the server, I'm assuming nothing needs to be installed onto the server once i compile the game on my pc.

You may need to configure the webserver to recognize jnlp files.

    * I cant use server side java but i can use it in applets, so I'm presumming creating a game with this is still possible.

That's fine, but the users will not be able to see each other or communicate, or store the game state on the server. So what you are making is a single player game, which is playable in the browser.
That's fine, but the users will not be able to see each other or communicate, or store the game state on the server. So what you are making is a single player game, which is playable in the browser.


:-o can i not code the back end in another language?

You can code your backend in any language, but if you cannot run it on the server - you have no server. Plenty of backend code, but no server.



Applets donot run on the serve side, they run on the user side. So having java applets will not give you any server-like capabilities.

Oh, this the quote from the host

http://www.streamlinesupport.net/index.php?page=show&id=95 wrote:
Unfortunately you are unable to use java on the server side as it is not supported, however you are able to use Java Applets which is Client side, for further information on Java Applets have a look at support pages and search for Java Applets

Ok... i have asked the host about the jlnp files, im thinking they will just say no. Is it certain applets cant run without this? i read in the docs about applets and the just reffered to .jar files.

And isint Java Web Start different to an applet? so i can still make a game in an applet, cant i?
http://www.jmonkeyengine.com/wiki/doku.php?id=writing_a_jme_applet

Thanks,

Webstart simply installs the application on the user's computer and runs it locally from there. Consider the following article on how to enable jnlp on your webserver.



Relevant quote from the article:

Web Server Setup

While Java Web Start and JNLP rely on existing technologies like HTTP and a Web server, there is one configuration issue that must be addressed for JNLP to work properly. It isn't always sufficient to just create a .jnlp file and put it on your Web server with the rest of the application; the Web server must be configured to return the proper MIME type for the JNLP content -- and that MIME type must be application/x-java-jnlp-file.


The whole article: http://java.sun.com/developer/technicalArticles/Programming/jnlp/

However, having jnlp enabled will not give you a central multiplayer server.

One of the workarounds could be to make calls to a different server (possibly located on your computer). Then you can host the application on your web server and run the game multilayer server somewhere else.

O, so do all applets then need to have this or is it just the jME created applets? Because if the host says you can use applets, do you think they will already have this support?

Applets do not need any special server support or JNLP support.  He's talking about the game server.

Ok  :D, so i think i will make a basic game as an applet (prob 1 player) and then in the future and if the host does configure the server etc. then i may expand the game.



Thanks both of you for your help.

You have to take into account that an applet is very restrictive for what the program can access from it. Running jME in Applet mode would probably limit you a lot… That is why lex is suggesting running that as a JNLP (Webstart) which you “install” in your server the same as an applet (i.e. you put some files accessible in a web page, and no need for Java or anything in the server), but gives the program full access to the computer resources (like reading/writing files used for Save/Load).



There are many threads in the forums regarding this… http://www.jmonkeyengine.com/jmeforum/index.php?topic=6241.0

You should consider that your game server does not need to run on the same machine as your web host.  Your clients just need to know the IP to connect to.  So you could even deploy the server on your home machine if you have a static IP and enough bandwidth.



Also, here's an easy way to enable jnlp if you're running apache without admin privileges, just put this in .htacces:

AddType application/x-java-jnlp-file  .jnlp

Hey,



Thanks for your replys. I was speaking to the host and they said that jnlp was an unsupported file type but i will try the .htaccess trick. I might actually offer the game as a download and then connect to the server, although i dont know how to do this  :|. i dont need to worry about the bandwidth. Would you be able to do this on a shared server with out any server side java?

Yes, but you would have to implement all the network stuff "by hands"…



To use facilities like JGN you'd need Java on both sides (client and server)… And that's a LOT of work to do by hands…



Did you ever programed network sockets before?

Couldn't PHP-based server code running on the web server be used? The webstart application would just have to talk to it via HTTP (maybe even XML-RPC). Most hosts have PHP installed.

anlumo said:

Couldn't PHP-based server code running on the web server be used? The webstart application would just have to talk to it via HTTP (maybe even XML-RPC). Most hosts have PHP installed.


perick said:

Yes, but you would have to implement all the network stuff "by hands"...

You could probably look for java based HTML parser or adapt one of the XML parsers to communicate with web-based PHP. However, this is slow and not very scalable.

As I always say, better slow and non-scalable than non-existing :slight_smile:

anlumo said:

As I always say, better slow and non-scalable than non-existing :)


Personally, I would just develop the server on my own machine and when it's ready pony up $10 or $20 a month to get a webhost with shell access and Java.  You should really worry about having a working game before you worry about a place to run it.

It doesn't seem worth it to spend hundreds of hours of headache trying to write a game server in PHP just to save a few bucks.  I mean, how would you even handle multithreading in PHP?  Maybe that's just me though  :P
Agri said:

I might actually offer the game as a download and then connect to the server, although i dont know how to do this  :|. i dont need to worry about the bandwidth. Would you be able to do this on a shared server with out any server side java?


By "the server" I'm going to assume you are talking about the game server, and by "shared server" that you are talking about your web host.

You can upload a file with a list of game server IPs to your webserver.  Then when people download your clients, the clients fetch the file to look up the latest IPs.  You just need to update that file whenever your IP changes.  Maybe via an automatic script or somesuch.

Alternatively, use a dynamic hostname on your game server machine from a place like dyndns.org.  Then you can hardcode the domain name into the game, and dyndns will handle the IP resolution.

Is this what you were asking?  If you're stuck on the specifics of making client/server connections in Java I'm sure JGN has some examples (haven't messed with it yet myself).