Pause Game loop & Asynchronous input

Hope this is the best subfourm for the question.

I have to date used my own “engine” for my small set of games. Clearly this is extra work with very little payoff. So it is use engine time. I did dabble with jME back like 5 years ago or something. So far i am impressed with the progress. I love the SDK so far and the docs are good. As far as general game engine JME seems perfect.

However there are several features that can really help esp for mobile games.

Feature 1. Pause the game loop while waiting for input. There really is no need to crank at 60fps when nothing is changing. This can really help battery life on mobile games. I tried putting pauses in the simpleUpdate method which worked well.

Feature 2. Asynchronous input. I have my own component back end with networking and everything. It runs in its own thread/threads and provides a “current” view of things that simpleUpdate can use to modify the scene graph. Most if not all UI is interacting with the backend, not the render thread. this way if there is a slowdown in graphics the UI is not “blocked” or locked. ie you can still click/escape or otherwise get some UI response to work even if the game is taking seconds to update the screen.

Can i hack that into JME?

Well if you block the ui to long, you will get blankouts by the os.

However what you can do, you could introduce artifical Thread.sleeps(low ms number) to slow down to like 10fps or so while waiting.

1 Like

And for 2) async works the same as in any render loop, you just queue your stuff in callables into the update loop, similar to swing or other display systems.

1 Like

This may or may not be helpful:

1 Like

I think that’s a good idea you are presenting here.
Many users are really frustrated when an app sucks their battery life empty without doing anything.
Asynchronous Input and File I/O is always a neat feature that many people want to have.

Well on some phones in the past we have even had overheating problems. Phones may have powerful cores, but they are not really designed to have them run flat out.

oh and thanks for the replies folks.