Blit
Copy a baked image onto the screen (`ctx.drawImage`). Cheap.
Read moreCopy a baked image onto the screen (`ctx.drawImage`). Cheap.
Read moreKeep a baked result; only rebuild when its input changes.
Read moreLevel split into screen-sized baked pieces, so no single giant image.
Read moreSkip anything off-screen.
Read moreRedraw only the screen area that changed.
Read moreOne `drawImage` / `fillText` / `fillRect`. Fewer = faster.
Read morePhysics steps in equal slices (e.g. 1/60 s) regardless of frame rate, so the game plays the same on slow and fast devices.
Read moreTime allowed per frame. 60 fps = 16.7 ms, everything included.
Read moreAn atlas of pre-drawn letters (each glyph × color).
Read moreCode that runs every frame. Keep it tiny.
Read moreSeparate canvas per depth (sky, scenery, actors, HUD); static layers never redraw.
Read moreReuse bullets/particles instead of creating new objects (avoids garbage-collection stutter).
Read moreHidden canvas used for baking (`new OffscreenCanvas(w,h)` or an unattached `<canvas>`).
Read moreRound positions to whole pixels or grid cells so sprites don't blur or smear.
Read moreDraw something once at load into a hidden image, reuse it every frame.
Read moreMany small images packed into one big image; blit a rectangle out of it.
Read more