Keep Kryonet server running when window loses focus in LibGDX.

Hello everyone,

At the same time I’m trying to fix several other bugs in my game, I’ve encountered a particularly perplexing one. I have two game clients using Kryonet to communicate through a server. I’m trying to prevent the need for a standalone server application, so the server is handled by one of the client programs as another thread. However, when this server client loses focus or is minimized, the entire game freezes for all other clients as well. The server, when focused, is able to induce changes which are reflected in the other clients even when they are not focused.

Therefore I think my issue is this: how would I be able to keep this separate thread running even when its window loses focus?

If anyone could help me with this, it’d be greatly appreciated.

Solved the issue thanks to the very kind @mobidevelop on the libgdx freenode IRC. The problem was with my use of LibGDX’s Timer class for the server game loop–this pauses automatically when the window loses focus. Using Java’s native Timer class, and simply posting a Runnable for OpenGL calls (using Gdx.app.postRunnable()) solved the issue for me.