Living Lanes: Townsfolk Crowds with Daily Routines and Reactions Kit
- Author
- claude-code @ auraAgent
- Opened
- Nov 15, 2026
- From
- contrib-whac29bf
- Into
- main
- Merged
- Nov 15, 2026
Fixes #1. Reproduced in a scratch world (townKit castleTown toon seed 7, NavMap 160x10x160, 18 townsfolk): with 1.0.4 + navKit 1.4.5 frames reached 2,735 ms (NavAgent update up to 3.3 s: navKit searched the whole grid for unreachable slots), 20 frames >= 80 ms in 53 s. Cause on the townsfolk side: a person who failed to reach a slot (goTo 'failed' after 6 s) waited 5 s and re-claimed the same slot (favourite or nearest), so the whole-map search came back every ~11 s forever; S.tick also ran every due think in one frame with no bound.
Changes:
- sim.S.tick: due people served longest-waiting first, stopping at config.thinkBudgetMs (2 ms) or maxThinksPerFrame (8); the rest think next frame (stats.deferred).
- sim.S.noteUnreachable: a slot a person could not reach is avoided by them for avoidSeconds (120 s) and stops being their favourite; retry waits retrySeconds (5) doubling to retryMaxSeconds (60). claimSlot skips avoided slots; doSpot also stops the agent on failure.
- Town: changing count in play despawns the highest-numbered townsfolk 3 a frame (claims released, agents stopped) or spawns missing ones. Before, count changes in play did nothing.
- TF.stats().deferred; README section 'Large towns' with before/after numbers; test 'backs off a slot it could not reach' (13/13 pass).
- Needs navKit 1.5.0 (bounded, frame-sliced searches); the world's navKit install is updated on main with the merge.
After (1.0.5 + navKit 1.5.0): worst frame 136 ms, 15 frames >= 80 ms in 40 s, p99 59 ms; townsfolk sim at most 7.2 ms a frame, navKit tick at most 21 ms. Count 18 -> 0 removed everyone in 6 s, worst frame 108 ms.
Source world: f401d7e1-2dc7-42d2-8987-664767442219 Contributed paths:
- townsfolkKit.package/README.md
- townsfolkKit.package/Town.component/init.luau
- townsfolkKit.package/api.module/init.luau
- townsfolkKit.package/package.yaml
- townsfolkKit.package/sim.module/init.luau
- townsfolkKit.package/townsfolkKit.testSuite/init.luau
- townsfolkKit.package
- townsfolkKit.package/Town.component
- townsfolkKit.package/api.module
- townsfolkKit.package/sim.module
- townsfolkKit.package/townsfolkKit.testSuite
- scenes/bench.scene/authoring/state.json
- scenes/bench.scene/build.luau
- scenes/bench.scene/scene.json
- scenes/main.scene/authoring/state.json
- scenes/main.scene/scene.json
- showcase/MarketDay.component/init.luau
- showcase/MarketTown.module/init.luau
- showcase/PerfReadout.module/init.luau
- showcase/PlayerLook.module/init.luau
- townsfolkKit.package/ActivitySpot.component/init.luau
- townsfolkKit.package/Home.component/init.luau
- townsfolkKit.package/TownChatter.component/init.luau
- townsfolkKit.package/Townsperson.component/init.luau
- townsfolkKit.package/bodyview.module/init.luau
- townsfolkKit.package/groups.module/init.luau
- townsfolkKit.package/reactions.module/init.luau
11 files changed
- ChangedtownsfolkKit.packageFolderBeforeAfter
- ChangedtownsfolkKit.package/README.md25.3 KB → 27.7 KBBeforeAfter
- ChangedtownsfolkKit.package/Town.componentFolderBeforeAfter
- ChangedtownsfolkKit.package/Town.component/init.luau5.0 KB → 6.4 KBBeforeAfter
- ChangedtownsfolkKit.package/api.moduleFolderBeforeAfter
- ChangedtownsfolkKit.package/api.module/init.luau15.7 KB → 15.7 KBBeforeAfter
- ChangedtownsfolkKit.package/package.yaml1.6 KB → 1.6 KBBeforeAfter
- ChangedtownsfolkKit.package/sim.moduleFolderBeforeAfter
- ChangedtownsfolkKit.package/sim.module/init.luau33.7 KB → 35.8 KBBeforeAfter
- ChangedtownsfolkKit.package/townsfolkKit.testSuiteFolderBeforeAfter
- ChangedtownsfolkKit.package/townsfolkKit.testSuite/init.luau8.9 KB → 10.6 KBBeforeAfter
Checks
No checks have been posted.
Reviews
No reviews yet.
Conversation
- claude-code @ auraAgentNov 15, 2026
Checked on the PR head (branch pr2 at contrib-whac29bf in townsfolkKit's world): townsfolkKit suite 13/13 passed, including the new 'backs off a slot it could not reach'. zm pr check refused because a session cannot sit on the contrib ref by its own name.
Sign in to comment or review.