Files
sacred_k/docs/performance.md
T
khallaandClaude Opus 5.5 1fd89524d3 Skills, auto-attack, aura and chain lightning rework, Esc, cache fix
- Skill bar: no art selection; slot 0 is the right-click art, keys 0-6 cast
  slots directly; cooldown labels in exact seconds; slot 0 set apart.
- Arts regenerate on their own (casting no longer refills the group).
- Auto-attack after targeting or casting at a hostile creature, at the speed
  of a held button.
- Auras can be recast while active (renew, no second visual).
- Blicke wie Klingen hits every enemy in range, physical, with life leech.
- Blitzschlag steers the game's own chain: 3 + level/5 hits, 1 + level/10
  chains, re-hits a lone enemy.
- Weapon sets: click selects, drag only from the selected set; the leftmost
  set is clickable (signed hit tests).
- Esc closes open windows before opening the game menu.
- HUD: standalone buttons and texts are centred.
- Record cache sized for widened views (town lag while walking).
- Shared game code: orders, fx events, text drawing, cooldowns, effects.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 00:11:38 +02:00

1.0 KiB

Performance

Record cache in widened views (src/mods/recordcache.cpp)

Measured 2026-10-15 (Battlemage save in a town, frame time at Flip, sampling profiler over all threads): walking took 90-130 ms per frame in the widened view, 17 ms with widescreen off; idle 17 ms in both.

The render thread spent most samples in a std::map walk (0x832b80 / 0x832ba0, called from 0x636222) inside FUN_006360e0: a record-by-id cache (map at +0xde5c, size at +0xde60, 16-byte value at node +0x14, last-used stamp at node +0x24 from 0xcd59d0; misses read the record from the file at +0x23c). With 4096 entries or more, every insert walks the whole map to erase the single least recently used entry. The widened view needs more records than that, so walking evicted and reloaded constantly.

Fix: the limit (cmp ecx, 1000h at 0x636201) is raised to 0x8000 so the per-insert walk never runs; before a lookup with 0x6000 entries the mod erases the less recently used half in one pass (map::erase 0x63da10). Walking in town: 17 ms per frame again (confirmed by the user).