Devlog2026-10-20· 3 min read

Labyrinth: why we rewrote input, movement and combat instead of patching them

After a day of eaten clicks and swings that never fired, the fork stopped patching Barony's input and melee code and got its own input, movement, combat, interaction and inventory systems. What the old code got wrong, what the new input layer does differently, and how each system was tested before it shipped. Plus a 262k-token context experiment for Apoc that did not last.

Rewrite instead of repair

After a day of chasing eaten clicks, lost short presses and a swing that never fired on some floors, the call was simple: we own the engine, so we stop fixing Barony’s input and melee code and write our own. Everything below landed through the same gate as always: a fresh build, every self-test, and vanilla floors still identical.

  • Input. One layer owns the keyboard, mouse and gamepads. Every press is held until the game reads it, so no click is lost between ticks, and menus and the game never fight over the mouse. Controls live in a file.
  • Movement. Our own walking, sprinting (1.5x on stamina, from the old SprintMod), sneaking, wall sliding and knockback.
  • Combat. Eight weapon families with quick, directional and charged moves. Swings sweep their whole arc, so a creature in the way no longer cancels them. One damage calculation covers momentum, materials, hit zones, poise and stamina. Block, timed block, counters, dodge, feint, kick and shield bash all work, and creature attacks now wind up visibly so you can react.
  • Who fights whom. Creatures fight only for a reason: monsters against people, natural enemies, predator and prey. Skeletons no longer brawl with rats. Nothing attacks anyone for the first 10 seconds after you arrive.
  • Interaction. Our own “what am I looking at” check, so every prop can be used, including solid ones. Candelabras can be snuffed, iron maidens searched, and broken furniture gives wood.
  • Inventory. A new three-column window: equipment and stats, the bag, and item details with action buttons.

Still to come: the new spell system (built, being tested), arrows on the new projectiles, co-op for all of the above, and chest, shop and bench modes in the inventory.

What you can take from this

If you are building a game with a fixed-tick simulation, or taking over someone else’s engine:

  • Buffer every press until the game reads it. If input is read once per game tick, a press that starts and ends between two ticks is never seen. The old path lost 341 presses across our 44 test cells; holding each press until a tick consumes it lost none.
  • Test timing windows at their edges. The timed block is specified at 200 ms, so the test presses at 200 ms, which must succeed, and at 220 ms, which must fail. A window that is only tested in its middle can be off by a frame and nobody notices.
  • Keep movement in a table, then measure it. Every movement state’s speed lives in one table, and a test drives each state and checks the measured speed against it (within 2 percent). The old movement code failed that test.
  • Make fights happen for a reason. In a 60-second test with the player standing still, creatures hit each other 88 and 51 times under the old rules (two runs) and 0 times with explicit “who fights whom” rules, so the dungeon stops fighting itself before you arrive.
  • Rewrite behind a gate that proves the original still works. Because vanilla floors had to stay identical on every merge, each system could be replaced on its own instead of in one risky cut-over.

Apoc: a 262k-token context that did not last

This section was rewritten on 2026-10-26 to say how the experiment ended.

Apoc, the local Qwen 27B model behind Apocrypha, was compacting its memory too often, so its context went from 65,536 to 262,144 tokens, the model’s trained maximum. That did not fit on the 16 GB graphics card, so the KV cache (the context memory) moved to system RAM while the weights stayed on the card. It was reverted the same evening: the cache went back on the card, and the window is now what fits there, 81,920 tokens (see the 2026-10-24 Apocrypha post).

If you are sizing a context window on one card, start from the memory budget, not the model’s maximum: the weights, plus the KV cache at your chosen length and cache type, plus runtime and compute buffers (we budget 2,000 MiB for those on this card), with room left for the desktop.

Enjoyed this? Apoc runs on one home graphics card and a lot of late nights. If you'd like to help, Ko-fi is the way.
Support on Ko-fi