Skip to content

redo mainloop with requestAnimationFrame#83

Merged
Auroriax merged 1 commit intoAuroriax:developfrom
pancelor:psp-raf
Feb 8, 2023
Merged

redo mainloop with requestAnimationFrame#83
Auroriax merged 1 commit intoAuroriax:developfrom
pancelor:psp-raf

Conversation

@pancelor
Copy link
Copy Markdown

@pancelor pancelor commented Feb 8, 2023

fixes #81

@Auroriax Auroriax changed the base branch from master to develop February 8, 2023 19:42
@Auroriax Auroriax self-assigned this Feb 8, 2023
@Auroriax Auroriax self-requested a review February 8, 2023 21:35
@Auroriax Auroriax merged commit fb79944 into Auroriax:develop Feb 8, 2023
@Auroriax
Copy link
Copy Markdown
Owner

Auroriax commented Feb 8, 2023

So this got a bit wordy, but the gist is that the merge is accepted as-is!

The original behavior is definitely strange. In your report you mention that Chrome is slower Firefox, whereas for me the opposite seems to be true for me. (But my monitor is apparently set to ~50Hz, whereas I presume most monitors will target ~60Hz by default, which might be related?)

Now some things can feel a bit too fast, perhaps? e.g. the quitting title screen animation now feels very fast. I also think I want to change the timing for most of my games, as I've used Firefox which is notably slower, and I'm not sure if this will affect more devs. I'll likely add a warning in the docs for this. I don't think this is a big problem, the only thing I've noticed is that pressing ESC in a game with a level select will very quickly quit the level select again (which I've fixed already).

I'd argue that the game loop could use more improvements (e.g. the mainloop.js you linked seems interesting), however the game loop is such a complex topic, and at the moment it seems overkill to dive too deeply into it for an engine mostly used for non-realtime games. However, otherwise the fix is simple and effective in cases that do require it.

@pancelor pancelor deleted the psp-raf branch February 10, 2023 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix main loop browser timing discrepancies

2 participants