grapereader / GameNamePending

An awesome new Roguelike written in Javascript.
https://www.viaware.ca/gnp
3 stars 0 forks source link

Movement twitch #2

Open grapereader opened 9 years ago

grapereader commented 9 years ago

Everything twitches every couple spaces the character walks.

grapereader commented 9 years ago

Preface: tests performed in Firefox 40.0a2.

After some profiling, it looks like the twitches correspond exactly with drops in FPS.

I don't exactly know why these performance drops occur; it seems that every so often everything just takes longer. Perhaps the browser is allocating resources to other processes during these times.

The result of these FPS drops is an increase in delta time, which causes things to move faster over that frame so that game logic runs at the same pace.

Unfortunately, the increase in delta time is that of 30-40 milliseconds, bringing it up to around 50-60 milliseconds. We can't blacklist these values, since a 50 millisecond frame is perfectly acceptable on a slow computer.