budget.module
README.md
artsTD.budget
Holds Arts TD at its frame-rate target: 60 fps on the desktop app, 30 fps on the web. Once a second it reads the average frame time. When frames run long, it renders the scene and the art-medium looks at a smaller resolution (renderer.setResolutionScale, down to 55% on desktop and 50% on the web). When there is room to spare, it climbs back to full resolution. The looks are full-screen passes, so their cost falls with the pixel count.
artsTD.game starts it on every player's machine in play. Budget.setTarget(fps) changes the target, Budget.stats() reports { target, scale, frameMs, minScale, running }, and Budget.stop() returns to full resolution.
It cannot help a frame that is limited by the CPU rather than the GPU. The README's frame budget says which is which.