1 decade ago
by Jesse
I use timeScale to make my game seem like it's running the same speed as a desktop even though the default implementation of the HTML5 canvas element on iPhone4 in whatever appMobi is using to render content is only able to render about 15 FPS.
While the value my code changes to (1.25) when a mobile device is detected looks OK on an iPhone 4, could it be too much or even not enough for other mobile devices?
1 decade ago
by dominic
Don&
039;t do this. #timeScale
is intended to adjust the overall speed of the game, not to work around slowdowns for lower FPS numbers.
Instead, set
ig.Timer.maxStep to something higher than 0.05. If you set it to 0.1, each frame will advance the in-game time
at most 0.1 seconds, so a device that can at least render 10FPS will still run the game in the same speed.
In Impact, a game runs with the same speed regardless of the FPS -
if the FPS are higher than 20 (i.e. a
maxStep
of 0.05). So a device that can run a game with 25FPS will run the game in the exact same in-game speed as a device that can run the game at 60FPS.
However, if a device is incapable to render at least 20FPS, the game is slowed down, so that an
in-game second still has exactly 20 frames. This was done, so that fast entity movements and collisions are still accurate, even with low FPS numbers. It&
039;s a tradeoff and you can adjust the #maxStep
value to tweak this FPS threshold.
1 decade ago
by Jesse
I&039;ll set my #maxStep
to 0.1
before calling ig.main
, regardless of which user agent is currently running the game. The game runs better than it was with the timeScale
change. Seeing how it&039;s very easy to go under 20 FPS on a mobile device without even trying, you should consider defaulting that value to #0.1
instead of 0.05
. Thanks for your help.
Page 1 of 1
« first
« previous
next ›
last »