5 ms·
> Since it happens every frame, you don't need state management to push updates around. Everything just grabs the latest value anyway. This is not true or at
by chacham15 6y ago
> Since it happens every frame, you don't need state management to push updates around. Everything just grabs the latest value anyway.
This is not true or at least only deceptively so. If you think about "global state" in a game or more specifically in a rendering scene as "all of the objects in the scene" then the main difference is the lack of acceleration structures for the web. Most of the objects in a scene are never touched because AABB or some other structure allows you to cull large number of objects without ever actually touching them. If objects in the scene change, you definitely need to update those acceleration structures. Fortunately for games, those updates are quick and there are typically not that many of them.
- _bxg1 6y agoIn the web the performance bottleneck is not figuring out what changed, it's doing any rendering at all. Rendering health bars in games is cheap because they happen on the GPU and because they don't have the sprawling layout ramifications ("reflow") that UI changes in the DOM do.