perf(rendering): optimize client Pixi.js renderer with sprite chunking, 60 FPS cap, map prefetch throttle, and sharp HUD resolution (#20) - #77
Conversation
…xporter with audit & round-trip tests
…g, 60 FPS cap, map prefetch throttle, and sharp HUD resolution
41e84df to
b6cffda
Compare
| const terrainGrid: number[][][] = []; | ||
| const openAONpcs: OpenAONpcPlacement[] = []; | ||
| const specialsExits: Record<string, { map: number; x: number; y: number }> = {}; | ||
| const specialsObjects: Record<string, { objIndex: number; amount: number }> = {}; | ||
| const specialsTriggers: Record<string, number> = {}; | ||
|
|
||
| let translatedTilesCount = 0; | ||
|
|
||
| for (let yIndex = 0; yIndex < 100; yIndex++) { | ||
| const rowLayers: number[][] = []; | ||
| for (let xIndex = 0; xIndex < 100; xIndex++) { | ||
| const tile = tiles[yIndex]?.[xIndex]; | ||
| const posX = xIndex + 1; | ||
| const posY = yIndex + 1; | ||
| const tileKey = `${posX},${posY}`; |
There was a problem hiding this comment.
⚠️ Bug: Tile 'blocked' collision flag is lost during map conversion
convertClassicToOpenAO reads tile.blocked from every parsed tile but never writes it anywhere in the resulting bundle — the OpenAOSpecials.blocked field declared at line 72 is left unset. On the reverse path, convertOpenAOToClassic hardcodes blocked: false (line 473). As a result every tile's collision/blocked state is silently dropped when importing a classic map, so blocked tiles become walkable in OpenAO. Populate specials.blocked for blocked tiles in convertClassicToOpenAO and read it back in convertOpenAOToClassic. Note that validateRoundTrip (and the round-trip test) never compares blocked, so this loss is currently masked; add blocked to the comparison and test fixtures.
Persist and restore per-tile blocked state; also add blocked to validateRoundTrip comparison.:
// in convertClassicToOpenAO tile loop:
const specialsBlocked: Record<string, boolean> = {};
// ... inside loop, after computing tile:
if (tile.blocked) specialsBlocked[tileKey] = true;
// ... when building specials:
blocked: Object.keys(specialsBlocked).length > 0 ? specialsBlocked : undefined,
// in convertOpenAOToClassic tile loop:
blocked: specials?.blocked?.[tileKey] === true,
- Apply fix
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎
Code Review
|
| Auto-apply | Compact |
|
|
Important
Your trial ends in 5 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.
Was this helpful? React with 👍 / 👎 | Gitar
|
Revisé esta contra el 1. El
|
Closes #20
Summary of Changes
Sprite Chunking (Deferred Rendering):
requestIdleCallbacktime-sliced chunking inuseRendererBootstrap.ts, avoiding main thread lock during scene loading.FPS Capping (
maxFPS = 60):app.ticker.maxFPS = 60inuseRendererBootstrap.tsto prevent battery drain and excessive GPU load on 120 Hz screens.Prefetch Throttling:
navigator.connection?.saveDatacheck inuseAssetPipeline.ts.Sharp HUD Text Resolution:
app.renderer.resolutionforfpsText,pingText,seguroText,clanSeguroText, anddebugCombatTextinuseRendererBootstrap.ts.Summary by Gitar
classicMapParser.tssupporting binary.map,.inf, and.datfiles with round-trip validationconvertClassicMap.tsconversion script and comprehensive test suiteThis will update automatically on new commits.