Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: dumduel bullets invisible — immediate snapshot on fire + UDP→WS fallback

Bullets could fire and hit between snapshot intervals (every 3 ticks)
without the client ever seeing them. Now broadcastSnapshot() fires
immediately on bullet creation. Also, stale UDP channels silently
dropped snapshots with no WS fallback — sendUDP now returns success
so broadcastSnapshot falls through to WebSocket when UDP is dead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+10 -5
+8 -4
session-server/duel-manager.mjs
··· 460 460 age: 0, 461 461 }); 462 462 console.log(`🎯 ${h} fired! bullets=${this.bullets.length}`); 463 + // Immediately broadcast so client sees the bullet ASAP 464 + // (don't wait for next SNAPSHOT_INTERVAL tick) 465 + this.broadcastSnapshot(); 463 466 } 464 467 } 465 468 } ··· 569 572 // Send to each player with UDP channel, fallback to WS 570 573 for (const [handle, player] of this.players) { 571 574 if (handle === DUMMY_HANDLE) continue; 572 - // Try UDP first 575 + // Try UDP first, fall back to WS if channel is dead 576 + let sent = false; 573 577 if (player.udpChannelId && this.sendUDP) { 574 - this.sendUDP(player.udpChannelId, "duel:snapshot", data); 575 - } else if (player.wsId != null && this.sendWS) { 576 - // Fallback to WS 578 + sent = this.sendUDP(player.udpChannelId, "duel:snapshot", data); 579 + } 580 + if (!sent && player.wsId != null && this.sendWS) { 577 581 this.sendWS(player.wsId, "duel:snapshot", snapshot); 578 582 } 579 583 }
+2 -1
session-server/session.mjs
··· 3044 3044 sendUDP: (channelId, event, data) => { 3045 3045 const entry = udpChannels[channelId]; 3046 3046 if (entry?.channel?.webrtcConnection?.state === "open") { 3047 - try { entry.channel.emit(event, data); } catch {} 3047 + try { entry.channel.emit(event, data); return true; } catch {} 3048 3048 } 3049 + return false; // Signal failure so caller can fall back to WS 3049 3050 }, 3050 3051 sendWS: (wsId, type, content) => { 3051 3052 connections[wsId]?.send(pack(type, JSON.stringify(content), "duel"));