Supporting all display frame rates
I upgraded from a laptop with a 60Hz display to one with a 120Hz display, and suddenly Fracas 3 played at 2x speed. I instantly regretted hardcoding my game(s) to expect 60 frames per second. I remember folks making similar mistakes with CPU clock speeds, a million years ago. I wonder how many people have tried to play this game and thought “oh dang that’s way too fast”? Or too slow?
Anyhow, I switched to using the actual measured time between frames to decide how much to advance the world clock, instead of assuming every frame is 16 milliseconds.
It took a few tries to get right. I needed a little extra code to get it to work with pausing and stepping. And I didn’t bother with using the visibility API to check for tab freeze/unfreeze caused by tab switching etc. Hackily, I forced each frame to never be more than 2x the length of the previous one, which is robust and simple, even if it’s not absolutely perfect.
If you actually want the game to be faster or slower, you can tweak the speed in the settings menu:
Files
Fracas 3
Dash and shoot, in a cave. Haunt your friends.
Status | Released |
Author | aaryte |
Genre | Action |
Tags | 2D, gamepad, Level Editor, Local Co-Op, Local multiplayer, Multiplayer, Short, Singleplayer, Top-Down, Touch-Friendly |
Languages | English |
More posts
- How it startedJan 19, 2024
- Smart arrows: a bug fix & a design noteFeb 17, 2023
- Fracas 3.1.3Jan 03, 2023
- More new levelsJul 08, 2022
- Blast-radius previews in the editorJul 01, 2022
- Levels & Lasers!Jun 27, 2022
- Fracas 3.1: Caverns & ConflictsJun 11, 2022
- Slight changes to mushrooms and enemiesJul 29, 2021
- Blaster work & level tweaksJul 05, 2021
Leave a comment
Log in with itch.io to leave a comment.