Skip to content
Tech News
← Back to articles

Show HN: Automatically detect and patch walking-dead states in Sierra games

read original more articles
Why This Matters

This tool automates the detection and fixing of softlock states in classic Sierra adventure games, enhancing gameplay stability and preserving the integrity of these vintage titles. By analyzing game scripts and automatically patching potential dead-ends, it reduces frustration for players and facilitates preservation efforts for classic games in the industry. This approach demonstrates how modern static analysis techniques can improve the maintenance and accessibility of legacy software.

Key Takeaways

Sierra softlock analyzer

Static analysis for 30-year-old adventure games. This tool decompiles a Sierra SCI game, abstract-interprets the decompiled scripts into a graph of guarded room transitions, item movements and plot-flag writes, finds the softlocks — states where the game still accepts input but victory has quietly become impossible — and derives, verifies, compiles and installs guards that prevent them. Nothing about any title is declared: the start room, the victory room, the death signal and the debug flags are all discovered from the game's own code.

Sierra games, unlike LucasArts ones, let you get stuck. Forget the sunscreen in Los Angeles, board the cruise ship, and you die days later on a raft with no way back. This finds these traps automatically and blocks the crossing that causes them — at the last moment you can still comply.

Four games analyzed and play-tested — Leisure Suit Larry 2 (SCI0, 1988), King's Quest IV (SCI0, 1988), King's Quest VI (SCI1.1, 1992), and Laura Bow 2 (SCI1.1, 1992) — same engine, no game-specific analysis code.

Demo

King's Quest IV, patched — the whale, the night clock and seven stranded items, all guarded:

The thirty-second version

Abridged from a real run on Leisure Suit Larry 2 ( python3 -m pipeline <game> ):

[2] ANALYZE anchors: start rm11, victory [86] (discovered) death signal: global101 == 1001, debug globals: [14, 100] (derived) 101 rooms, 27 strongly-connected components, 40 gating registers softlocks: 15 items + 1 disjunctive group(s) - Sunscreen ... [3] DERIVE rm38 -> rm131: (and (gEgo has: 11) (gEgo has: 12) (gEgo has: 14) (gEgo has: 15)) rm57 -> rm58: (and (gEgo has: 21) (gEgo has: 24) (gEgo has: 25) (gEgo has: 26)) rm79 -> rm80: (or (gEgo has: 30) (gEgo has: 31)) rm131 -> rm138: (not (gEgo has: 13)) rm63: delete `(gEgo put: 21 -1)` (Hair_Rejuvenator) verifying against the guarded model... fixed 15 + 1 group(s); NEW softlocks introduced: none [4] PATCH compiled 117/118 scripts script.000 Main 10790 bytes script.057 rm57 2938 bytes ... Done. 10 patch files in build/patch

The analyzer discovered the ship boarding as a one-way crossing, derived which items must cross with you, re-verified the guarded model to prove the guards introduce no new softlocks, and recompiled the touched scripts into Sierra's own loose-patch format.

... continue reading