ship crafter building animation makes game laggy #6
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Done.
Cause: every NeonDraw call is four antialiased polylines, and I had the crafter redrawing its entire yard every frame - reactor housing, radiator fins, truss spine, cradle ribs, crane rail - purely to advance a crane and some sparks. The structure is most of the drawing and none of the movement. The mothership had just picked up the same problem when it started animating. Roughly 128 polylines per frame for the crafter plus ~92 for the mothership, every frame, for two buildings.
Fix, two parts:
Combined, the per-frame drawing work for an animated building is down to roughly a fifth of what it was.
The command centre is unaffected: it has no animation, so it gets no extra layer at all.
Files: new
BuildingStaticLayer.gd/.tscn,Building.gd(split_draw_crafter/_draw_mothershipinto static + animated halves, added the redraw cap).Verified: new
tests/test_building_redraw_cost.gdasserts the static layer is rasterised exactly ONCE across two seconds of animation while the crafter keeps animating - so it cannot be "fixed" by quietly freezing the animation - and that a non-animated building gets no pointless extra layer. Rendered the buildings before and after the split and compared: identical, nothing lost in the move. Full suite 38/38.Worth a playtest on the device to confirm it actually feels smooth now - the measurement here is draw-call count, not frames per second on your phone.