Hey Guys,
I tried to create something like a server manager for a game. That means, the manager is running, a client creates a game (using network and so on - that works fine) and the manager starts a new server application (extends from SimpleApplication).
But when the manager calls serverApplication.start() i get the following exception:
[java]SCHWERWIEGEND: Uncaught exception thrown in Thread[jME3 Audio Thread,6,main]
java.lang.IllegalStateException: Only one OpenAL context may be instantiated at any one time.
at org.lwjgl.openal.AL.create(AL.java:113)
at org.lwjgl.openal.AL.create(AL.java:102)
at org.lwjgl.openal.AL.create(AL.java:201)
at com.jme3.audio.lwjgl.LwjglAudioRenderer.initInThread(LwjglAudioRenderer.java:157)
at com.jme3.audio.lwjgl.LwjglAudioRenderer.run(LwjglAudioRenderer.java:118)
at java.lang.Thread.run(Thread.java:619)[/java]
Is there a way to start multiple Applications without instantiate multiple audio renderer? or is it not possible to start applications out of other applications?
Hello!
This area isn’t exactly my forte, but I think what you’d want to do is utilize appStates:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:application_states
AppStates are essentially little applications that are all being ran/managed from an application. It’s been a little while since I last messed with them but they are very powerful!
Cheers!
~FlaH
oh, you’re right that’s exactly what i need.
thank you!
hmm one more question…
as far as I understand, the states are updated sequentially. Is there a way to run them in separate parallel threads?
Hello again!
That’s beyond my knowledge unfortunately :<
I think there was some discussion on this forum a few pages back about concurrency though; might help, might not. I do know that there’s some quirks to running threaded applications. I want to say there’s a section in the wiki about threading too, but I haven’t checked and I’m about to walk out the door at work XD
~FlaH
The StateManager is handled in SimpleApplication, so you could create your own version that runs them concurrently however none of the supplied AppStates is guaranteed to work properly in that case. Generally we suggest a threading form like explained here.
Oh, that looks like a hard task. i’ll try it tomorrow.
Thanks again!