Randoloot/artifacts/shield_performance_validation.md
2026-10-26 21:06:32 +01:00

17 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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.