Using jME for Game Server

can anyone please provide me with some information or some code snippets to setup a jME app that will work for a server? i know there is such a thing as the DummyDisplayDriver, but i havent been to find out how to use it.



Thanks.

StandardGame supports server-mode that will get you there.

darkfrog said:

StandardGame supports server-mode that will get you there.


could you provide a quick example of how to setup StandardGame in server-mode?

Pretty easy:


StandardGame game = new StandardGame("MyGame", StandardGame.GameType.HEADLESS);
game.start();

Interesting :slight_smile:

Is that like standard game without graphics? Example: Can I use it insted for creating my own stuff like GameSettings & GameManager because standard game implements them…?

Yes

well it's not that easy, you must never ever use DisplaySystem (Cameras, aso.) in your entire code if you want to run it in headless. i think it would be ideally if you could just flip the switch and a game would run headless, but it isnt.

well it's not that easy, you must never ever use DisplaySystem (Cameras, aso.) in your entire code if you want to run it in headless. i think it would be ideally if you could just flip the switch and a game would run headless, but it isnt.

The whole point of the headless mode is that those things exist but they do nothing.
For example if you use headless mode then a DummyDisplaySystem implementor will be used, the cameras and RenderStates are implemented but they do nothing. So essentially you have the whole jME api working fine but no OpenGL context exists and no rendering is done.

Momoko_Fan++

jgn + standard headless = great server  :smiley:



darkfrog++;

hehe, thanks. :o

not if you're limiting framerates or using VSync. in such a case the cpu idles like hell :wink:

I must agree with Neakor on that!  :lol:



Speaking of headless games, I was wondering the other day how much resources a headless game really consumes in comparison with a regular game. Since the openGL thread processing is gone, I'd guess the headless game barely calculates anything besides from the update loops that constantly run in the gamestates, correct? So my assumption is that a headless JME game uses just as much cpu as when I would make a program with a while(true) loop and for instance print text lines to the console.

That's a good point. Perhaps headless games should automatically default to a limited framerate of 60.

It would make alot of since, especially when considering the non-headless games do have that 60 fps limitation

Technically they do not…they do vertical sync by default, which on your machine happens to be 60Hz. :o