This is a submission for the Web Game Challenge: One Byte Explainer
Explainer
In web games, you have three options: HTML nodes, Canvas 2D, or WebGL/WebGPU. The sprite count can help you pick: 1000 sprites with nodes, 1000-3000 with Canvas 2D, and 3000+ requires WebGL/WebGPU. Why HTML or Canvas 2D? Less code to write, means fewer kb.
Additional Context
For simpler games, HTML nodes or Canvas 2D are solid choices. They require less code, resulting in smaller file sizes and faster load times. With HTML nodes, you can leverage CSS and animations without extra code. For Canvas, you can draw directly using simple commands like rect()
. There is no quesstion that with WebGPU you can do some really cool things, but sometimes you only want to draw a pixelart duck that looks like Sonic and make an endless runner.
Top comments (0)