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 Hugeen

Hi,

I'm doing some experiments with ImpactJS and Node and I noticed a problem in the update loop.

To illustrate the problem I have placed 3 console.log :
- 1 when I receive the event to send a missile
- 1 when I spawn the missile Entity in game
- 1 when the first update loop for the missile is called

Here is the video I recorded to show you this "bug"
http://www.youtube.com/watch?v=2rP7feVPeWQ

You may find that when I leave my game window the update loop is not played.

I searched a little bit in the source code of impact but I have not found a solution. If someone has an idea I would appreciate a lot.

Thank you
Bye

1 decade ago by dominic

It's a feature, not a bug :)

Impact uses the requestAnimationFrame to schedule frames internally - it will stop animating when the canvas element is scrolled out of view or otherwise not visible. After all, a game that's not visible, is not played.

Even with the older setTimeout or setInterval most browsers will limit the number of calls to 1 per second when the window/tab is not visible.

So, to test the multiplayer functionality of your game, simply use two browser windows instead of two tabs.

1 decade ago by Hugeen

Thank you very much for your answer, it saves me time.

There seems to be two ways to solve my problem:

Disconnect the player when he changes window (easy) or synchronize the position of the grenade when he returns to his window (difficult).

For the second solution should migrate Impact physics on server side.
Page 1 of 1
« first « previous next › last »