Can a local LLM play a hardcore colony simulator like RimWorld 1.6 in real time—with zero cloud APIs, a live stream HUD, and sharing a single RTX 3090 (24 GB VRAM) with the game itself? In one day of intense iteration, RimWorldLancAIMod grew to 6,589 lines of C# (21 files), survived 10 recorded runs and 15 live hot-patches without restarting the game, reached 7 consecutive in-game days, and led to a decisive architectural pivot.
1. Why 24B Instead of 32B on 24 GB VRAM
We ran mistral-small-24b-instruct-2501 in LM Studio (:1234/v1). Unlike a 32B model, 24B takes ~14.3 GB VRAM (+ ~1.5 GB KV cache), leaving enough headroom on the same GPU for RimWorld (~2.5 GB) and stream capture while keeping latency snappy. Even the game’s entity catalog Data/defs_catalog.json (27,287 bytes) was extracted by the local model itself via a dedicated rimworld-def-extractor skill.
2. Why Raw JSON Failed & Moving to 22 Semantic Sockets
Asking the LLM for raw (x, z) wall and crop coordinates predictably produced geometry chaos. The fix was strict separation of concerns:
- Tier 1 — C# Reflexes (1s loop, zero LLM):
ReflexSafetySystem.cshandles immediate combat threats, fires, and downed pawns. - Tier 2 — Inspector & Geometry:
StateSerializer.csbuilds a compact tactical briefing,BaseArchitect.cs(576 lines) andColonyLogisticsAndRooms.cs(539 lines) compute room layouts and wind corridors, andSocketResolver.csmaps decisions to 29 primitives inActionExecutor.cs. - Tier 3 — Local 24B Strategist: reads the briefing and fills 22 high-level semantic sockets (
plan_room,setup_freezer,auto_wire_power,create_farm_on_best_soil,defend_colony,bury_corpses, etc.).
On screen, StreamOverlay.cs renders a live HUD with Goal / Analysis / Thought, a verified TaskChainManager queue, and a 3-tab debug inspector.
3. Real AI Failure Modes Caught in Live Runs
- 364 trees queued, 0 chopped: work-role assignment enabled
Growingbut missedPlantCutting, so wood stayed at zero while the bot kept marking the forest. - 13 campfires & 11 beds for 3 colonists: fast-build testing without per-colonist caps turned rooms into furniture warehouses.
Steel = 3195while reportingSteel = 0: RimWorld’smap.resourceCounteronly counts items inside stockpile zones. Once a 3×3 stockpile filled with wood and meals, mined steel on the ground was invisible. Switched tomap.listerThings.ThingsOfDef.- A -5°C freezer venting into the bedroom & walled-in pawns: extending a room sealed off doors and roofed over potato crops and solar panels.
- Dual roof grids: in RimWorld’s engine,
BuildRoofandNoRoofare independent grids—settingBuildRoofdoes not clear an earlierNoRoofflag. Collection was modifiedcrash: un-drafting pawns inside aFreeColonistsforeachloop threw an exception and frozeIsThinking.
4. The Macro-Control Pivot: Play Like a Human, Not a Macro
Across 10 logged runs (LancAI_Reports), the colony progressed from a Day 2 wipe (Wood=2, 0W) to surviving Day 7 (Wood=2146, Meals=455 / ~24–28 days of food, 1094–1779W net power, 1200Wd stored, separate bedrooms).
At that point, the real lesson clicked: instant GenSpawn.Spawn shortcuts and household micromanagement fight the game’s own AI. In the final build of the day, instant spawning and chore micromanagement were removed in favor of blueprints (PlaceBlueprintForBuild), Deconstruct orders, native WorkGiver priorities, and StoragePriority filters—reserving Draft and rallyCenter grouping strictly for combat.
Добавить комментарий