5 ms·
These are usually iterating over a screen-sized buffer every frame. There's no nice way to slice that, just a bunch of work for the machine to constantly do. E
by usrn 4y ago
These are usually iterating over a screen-sized buffer every frame. There's no nice way to slice that, just a bunch of work for the machine to constantly do.
EDIT: I'm out of quota. For games like this it's pretty hard. You can move it into a fragment shader or maybe mark certain rectangles in the canvas as "empty" (there's a very fast algorithm for cellular automata which pretty much has the same issue.) There are no "easy" solutions though.
- sgt 4y agoIs there a better way to build cute little canvas or browser games?
- 5560675260 4y agoOne simple improvement would have been to pause simulations as soon as system comes to rest.
- sgt 4y agoI was thinking - maybe JS is not the way to do this? Maybe to write similar things one should do it in WebAssembly. Thoughts? I mean, even with paused simulations, I don't see why an i7 CPU should be working at 100% just to draw something on a tiny window in a browser. It seems like a flaw in canvas and JS to me.