Running Game Client in Background

Hi,

I’m trying to make my game client run even when I’m not using it - what I mean by this is:

  1. I click somewhere on my desktop that’s not my JME client window or minimize it
  2. The animations in the JME client window stop - and only start again or fast-forward when I un-minimize it or click on theclient window

And what I want to happen is for the animations to run even when I’m not focused on the JME Client window.

Does anyone know how to approach this?

Thanks in advance!

I think what you want is in your main method

Main app = new Main();//Or whatever you have called your main class
app.setPauseOnLostFocus(false);

1 Like

Thanks so much!

Solved everything.

While I’m on the topic, how do I make it so that I only have one client on, on one computer at any given time.

This is a problem since it’s platform dependent.
For Windows you have process mutexes.
Linux might have that too but i dont know it.

You could also save a lock file. Only Problem is when the Client crashes, you won’t be able to start the game again.

Since this is an jme unrelated topic I recommend you to Google “Java one instance of program” oe such.

Good luck :slight_smile:

A dirty trick is to bind a port without using it. When another instance launches, it’ll fail to bind that port and will close. But as I said, this is a dirty trick.

Put system.current time in the lock file.
update every few seconds.
→ and you know if the other application crashed, if it does not update anymore.