-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
api to skip frames #767
Comments
You could set the Example drawing at 30fps: #include "wasm4.h"
const size_t FRAME_SKIP = 2; // Draw every 2nd frame
void start() {
*SYSTEM_FLAGS |= SYSTEM_PRESERVE_FRAMEBUFFER;
}
size_t frame = 0;
void update() {
frame++;
if ((frame % FRAME_SKIP) == 0) {
// Regular processing here
rect(10, 10, 32, 32);
}
} |
if you know the system is fast enough to handle 30 fps, maybe it works. otherwise, maybe not. also, i prefer an api to allow 60 fps on the first machine. btw, i think it can be useful to provide a way for the update callback to tell wasm4 that it made no user-visible changes to the frame buffer/palette/etc. so that wasm4 can skip its entire graphic processing for the frame. |
I suppose in addition to Instead, I would suggest looking into transpiling the WASM to your hardware and running games natively instead. There this cool project called wasm4-aot specifically for that you could take a look at! |
well, i also want to reduce power consumption eg. when playing non-realtime games like puzzles on a phone. |
I like the idea of We could also have a system flag settable by the game to skip the entire update next frame, basically opting into 30hz update mode? I also agree with @JerwuQu though that we probably shouldn't go crazy with supporting devices that can't run at 60hz. Not sure! |
for games, it's often more important to provide a constant game speed than drawing every single frames.
it would be nicer for wasm4 to provide a mechanism for skipping frames.
especially for graphics-heavy games on slow hardware.
eg. a simple timestamp (maybe in fps) on the shared memory area.
The text was updated successfully, but these errors were encountered: