Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by FelipeBudinich

I recently developed an Idle game Overlod, it's doing quite well as it is among the most played games in Kongregate this week, but it has a fatal flaw;

It doesn't run when in background tab (basically all progress halts when you are not staring at the game).

I'm really at a loss here, if you have any tips I would love to hear them.

1 decade ago by dungeonmaster

I played the game a little while. Well, the game is quite addicting :)

I guess there isn't any way to make Javascript run when the tab isn't in focus. I guess you are short on options there. But I'm no expert, there might be a solution.

However, if you can manage to use the system clock instead of the ig.system.tick and on every update check the system clock, you might do a 'catch up' based on the "real" elapsed time maybe.

1 decade ago by Joncom

Here's a similar situation where some code was improved so that it would work better despite being in an inactive tab:

http://stackoverflow.com/questions/5927284/how-can-i-make-setinterval-also-work-when-a-tab-is-inactive-in-chrome

Edit: It sounds like for the most part though, you're going to have to deal with ImpactJS running at about 1 frame per second while the tab is inactive. If you have timers that reset multiple times per second, they will seem to slow down.

1 decade ago by FelipeBudinich

Thanks very much Joncom!

This is pointing me in the right direction :) (I can live with 1FPS, I only need to multiply progress for a delta).

I may be able to create a special kind of Timer that uses this method instead of the Impactjs timer
Page 1 of 1
« first « previous next › last »