Is it possible to handle a headless Virtual GPU?

I want to run headless on a VPS, running Ubuntu Linux. So no GPU.
It is running vncserver as the display server
SDK works, but I get an exception trying to run the simple HelloWorld example.
It appears LWJGL is not recognizing a Virtual GPU and connecting to vncserver display

Caused by: java.lang.RuntimeException: org.lwjgl.LWJGLException: No modes available

I know it is probably a long shot, but anyone else try to do this?

I tried various simple tools-options-opengl buttons. No luck.

Thanks!

---- ERROR—

INFO: Running on jMonkeyEngine 3.2-stable

  • Branch: HEAD
  • Git Hash: 8291d61
  • Build Date: 2019-07-27
    Aug 15, 2019 4:43:34 PM com.jme3.app.LegacyApplication handleError
    SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
    java.lang.ExceptionInInitializerError
    at com.jme3.system.lwjgl.LwjglDisplay.createContext(LwjglDisplay.java:112)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:113)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
    at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.RuntimeException: org.lwjgl.LWJGLException: No modes available
    at org.lwjgl.opengl.Display.(Display.java:141)
    … 4 more
    Caused by: org.lwjgl.LWJGLException: No modes available
    at org.lwjgl.opengl.LinuxDisplay.init(LinuxDisplay.java:740)
    at org.lwjgl.opengl.Display.(Display.java:138)
    … 4 more

Exception: java.lang.NullPointerException thrown from the UncaughtExceptionHandler in thread “jME3 Main”

Let’s step back and do some basic troubleshooting before we worry about the JME stuff.

  • Can you successfully run glxgears with your setup?

If not, that’s the first thing to take care of. You do need to have OpenGL available for JME to work the way you are hoping, so your VPS must have a GL-capable GPU, even if it is a virtual GPU shared with other tenants on the hardware.

1 Like

I’m slightly more confused as to what you’re trying to achieve. Servers are usually providers of data, and the engine is usually a visual representation of that data.

Are you sure you even want the engine running on the server?

I guess he wants to work(?) on a remote VPS using VNC Server.
The Problem is that the Server doesn’t provide any Hardware Acceleration, so also glxinfo shouldn’t work and everything, because there is no GPU (“virtual GPU” here is actually the CPU).

Now there is a headless mode for jme, see the wiki https://wiki.jmonkeyengine.org/jme3/advanced/headless_server.html (first google result when searching jmonkeyengine headless, so as a heads up: sometimes it’s quicker to just google your thread title :slight_smile: )

This however does no rendering and you won’t see anything via vnc but a console window. You don’t actually need VNC for this, ssh is enough.

What is it that you are trying to achieve? Because for a multiplayer game you better start developing locally first (sim-eth-es as the most complex example).

BTW: The SDK also only works partially, opening a model will crash just the same

First, thanks for the replies, and sorry it was not clear.

I am doing a multi-player real time strategy game.
The main user client will have full 3D graphics running on a PC/Mac desktop.
A persistent server will be on a VPS in the cloud.

Yes, I do intend for the server to have graphics!
But really just limited 2D, for debug.
I want an overview map, entity state, and a couple of other things.
Prefer not to debug through client, or through text log files.

The likely server alternative is to run simple NetBeans and X11 graphics.
But obviously it would be much better if both server and client ran the
same language, SDK, libraries, and so on.

As background, the game is about 1/10 coded (1/100 done), but using
Unity/C# for client, and X11/C++ for server. Switching to Java.

I think @sailsman63 has it correct - go back to basic troubleshooting.
I was using X11, not OpenGL before. It might not be set up correctly.
Will do that first.

So if I understand your latest message correctly… you want to run JME on a virtual server just to draw some 2D debugging information?

I would think there are a few thousand better ways to do that, personally.

UPDATE:

OpenGL does seem to mostly work.

glxgears does work.
gears show up and rotate nicely
GL_RENDERER = Mesa GLX Indirect

glxinfo does work
16 bit depth only rgb-655
I did match that on JME
direct rendering: No
(expected)

BUT : I tried a simple C++ opengl code, and it failed.
freeglut is not working either.
ERROR: Internal error in function fgOpenWindow
And looks like others have hit similar issues.
Not directly LWJGL related though.

Sounds great but why do you need it? What is the purpose of that? We all wonder :slight_smile: But please don’t let us stop you…

By running JME on the server:

  • I don’t have to switch between different IDEs/SDKs/engine when developing.
  • I can use identical network stack and setup when communicating.
  • I can use the same internal libraries.
  • I can do some of the same physics as needed.
  • I can do debug as mentioned.
  • I can potentially even run a slow client.

Although yes, I could link in needed JME libs/etc to a more raw native app.

Basically: If it “just works” I see it really simplifying development effort,
and that matters a lot to me.

Certainly not best for everyone though.

If I am obviously going in the wrong direction, by all means tell me.
I will not be insulted, and would rather not waste time.

This whole server thing is separate from the main JME client.

Alternative suggestions very welcome.

Really no offense meant!
Maybe take a look at @pspeed examples for network related games, with and without zay-es (ECS is another story, also worth it and cuts down development effort by factors!). I don’t have the links to the examples at my finger tips, but google for sim-eth-es, might lead you in the right direction.
And yes like any other client server software, I highly suggest to split that, you can of course use the same IDE as it is all java (or I didn’t get that point correctly maybe).

1 Like

You CAN use jme on the server (so all your points work), but you may have to think about the “debug” methology.

  1. You don’t need to use jme’s lwjgl stuff (openGL for that matter) to draw 2D Stuff, use Swing instead.
  2. Debugging doesn’t need openGL. As I said most debugging should happen when you run the server locally and connect to it locally. Apart from that there is “real” java debugging over TCP, so you don’t need any graphics. Apart from that you could even use “debugging” over the console, so you don’t even need X11 and all that stuff.

So that’s where you’re doing “useless” work. Also think of the future of your game: You don’t want everyone to need a real gpu just to run your game server. noone wants that. You could even think about a website to debug.

1 Like

Write your server as a server.

Write your client as a client.

The client doesn’t actually use JME to display anything, but it does create a connection, join and close it, so it’s pretty easy to create a GUI yourself and connect with that.

1 Like

I think your responses are correct. I need to rethink my plan in general.

Especially since after spending a bit more time, still no luck.

Probably do a much more typical flow:
Stripped down server in cloud, no JME, no graphics.
JME on local client, with a special debug mode as needed.

Why “no JME” on the Server? Not needed, you can use JME, you just have to do as I linked above :smiley:

1 Like

Use JME with the headless renderer (= no opengl required). Output the debug infos through an http server.