optimizations + bugfixes

* Bombs explode on damage/explosion
* Orbits spell fixed
* Performance: implemented shared component indexes,
compiled Lua caching, and updates only for changed projectile fields.
Also removed accumulating hidden entity slots.
This commit is contained in:
Gaël committed 2026-10-20 11:02:18 +02:00
1 parent 87bff164f1
commit a34f42d53e
17 files changed
+727 -131

No files matched your search

+3 -3
View File
@@ -14,7 +14,7 @@ void main() {
for (int r = int(gl_LocalInvocationID.x); r < reqCount; r += 64) {
vec4 r0 = hcast[(list * 256 + r) * 2], r1 = hcast[(list * 256 + r) * 2 + 1];
int node = int(r1.x);
uint seed = uint(r1.z) * 2654435761u + uint(r) * 40503u + uint(pc.frame);
uint seed = uint(abs(r1.z)) * 2654435761u + uint(r) * 40503u + uint(pc.frame);
if (node < 0) { boom_fx(-node - 1, r0.xy, seed, -1.0); continue; }
vec4 n0 = hnodes[node * 4], n1 = hnodes[node * 4 + 1], n2 = hnodes[node * 4 + 2], n3 = hnodes[node * 4 + 3];
int first = int(n0.x), count = int(n0.y);
@@ -69,9 +69,9 @@ void main() {
}
p.d = ivec4(type, first + i, ((int(r1.y) & 3) << 8) | ((shotBits & 1) << 10) | (min(int(n3.y) & 8191, 4095) << 12) | (((int(n3.y) >> 13) & 15) << 24) | (n2.z > 0.0 ? (1 << 28) : 0), int(serial + 1u)); // bits 24-27: lightning_count, bit 28: the wand added bounces (00c0b440 then sets bounce_at_any_angle) // team in bits 8-9, the critical chance (percent) from bit 12 // team in bits 8-9 (1 the player's wand, 2 enemies), fired triggers in the low bits
fprojs[slot] = p;
if ((fti(tb + 11).y & 1) != 0) { // a projectile with components the GPU does not simulate: the host makes its runtime twin (event kind -4, two entries)
if ((fti(tb + 11).y & 1) != 0 || r1.z < 0.0) { // negative seed: bind the script's existing entity as the twin
uint xi = uint(atomicAdd(xhead.x, 2));
if (xi + 1u < 512u) { xe[xi] = vec4(r0.xy, -4.0, float(slot)); xe[xi + 1u] = vec4(float(serial + 1u), float(type), float(shooterSlot), float(int(r1.y) & 3)); }
if (xi + 1u < 512u) { xe[xi] = vec4(r0.xy, -4.0, float(slot)); xe[xi + 1u] = vec4(float(serial + 1u), float(type), float(shooterSlot), r1.z < 0.0 ? r1.z : float(int(r1.y) & 3)); }
}
if ((int(r1.w) & 1) != 0) { // muzzle flash of the first projectiles of a cast
ivec4 t6 = fti(tb + 6);