1.4 KiB
Shield rendering optimization
The polished shield previously rebuilt 34 antialiased arcs plus a filled circle per ship every frame. These primitives caused a large rendering cost in the Compatibility renderer.
Normal shields now share one 256 × 256 mipmapped texture and one shader material. The shader animates opacity; ordinary frames no longer rebuild shield geometry. Directional impact ripples still animate only while hits exist. Shield radius, collision interception, absorption and shield capacities are unchanged. Auxiliary shields retain their separate appearance and reuse the impact renderer without drawing a second normal shell.
Isolated benchmark, 120 full shields, 1280 × 720, OpenGL Compatibility, VSync disabled, 30 warm-up frames and 150 measured frames:
| Version | Mean frame time | Draw calls per frame |
|---|---|---|
| Before | 221.991 ms | 12,360 |
| Cached shell | 1.099 ms | 1 |
This is an isolated rendering stress test, not a measurement of complete gameplay FPS. Logs: tmp/shield_perf_before.log and tmp/shield_perf_after.log. Benchmark scene: tests/previews/shield_performance_test.tscn. The optional --baseline switch uses the saved pre-optimization script in tmp/shield_visual_before_optimization.gd.
Validation: shield collision test passes; graphical full/low/impact preview checked. Auxiliary-shield behavior tested separately.