Ebiten: Enable to switch if the game is suspended or not when the window is inactivated

Created on 30 Sep 2016  路  14Comments  路  Source: hajimehoshi/ebiten

Now the game always stops when the window is inactivated. This issue suggests a new API to enable to run the game even when the window is inactivated. Is this in high demand?

feature

All 14 comments

Background: an Ebiten user wanted to leave the game running while they wanted to do other things.

Don't you need to be able to run in background to have a multiplayer game so the client doesn't stop processing messages?

Aha, that makes sense very much. I've not come up with the situation. OK, I'll add an API to switch this soon.

Also #353 would be great too!

I agree #353 would be great but this is relatively a tough task.

Note that it is hard to continue a game on a background browser tab because requestAnimationFrame is limited to about 1 [Hz] from display refresh rate like 60 [Hz] at least on Chrome.

Oh, I am just interested in headless for running a server and executing the same code as the clients. If you added a native-only headless feature that would make network server creation possible/easier. I thought that was what #353 was but it sounds like it is more than that.

The comment https://github.com/hajimehoshi/ebiten/issues/272#issuecomment-319430424 is about this issue.

Let's discuss #353 at #353.

The hard part of this issue is naming:

  • func IsLiveOnBackground() bool
  • func SetLiveOnBackground(value bool)

Hmm, there should be a better idea.

Unity calls it "Run in Background", not sure if that helps you.

  • func IsRunnableInBackground() bool
  • func SetRunnableInBackground(runnable bool)

sounds better.

Almost done. There is a known issue on browsers. I'll look into this later.

As the background tab is throttled, it is hard to keep the background tab active.

On Chrome, it is possible to keep the tab always active by playing an (unnoticeable) audio, but this is a dirty hack.

I think this (background tabs) issue can't be solved. Let me close this ticket.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hajimehoshi picture hajimehoshi  路  5Comments

hajimehoshi picture hajimehoshi  路  5Comments

hajimehoshi picture hajimehoshi  路  6Comments

hajimehoshi picture hajimehoshi  路  4Comments

cretz picture cretz  路  4Comments