{"slug": "title-show-hn-10-killer-game-apps-o-1-hash-table-lookup-for-game-logic", "title": "Title: Show HN: 10 Killer Game Apps – O(1) hash-table lookup for game logic", "summary": "A developer released 10 single-file game apps using a 61-atom hash-table lattice that replaces traditional game logic with O(1) lookups, achieving sub-microsecond response times and zero dependencies. The lattice, originally derived from a cross-language error taxonomy, maps (state, event) to action in 1,348 nanoseconds per query, enabling NPC reactions, item crafting, and dialogue branching without behavior trees, LLMs, or databases. The project demonstrates a universal lookup-table approach to game engines, with identical deployment across Python, Rust, C, Go, JavaScript, WASM, and JSON.", "body_md": "The lattice deployed. 10 hash tables. O(1) lookup. 0 latency. Polyglot.\n\nNPC reactions. Item combos. Damage calculation. Dialogue branching. Quest progress. Loot drops. State transitions. World generation.\n\nAll of these are `(input) → (output)`\n\n. The lattice IS the game engine.\n\n**A hash table replaces 100,000 lines of game code with 1 file.**\n\nThe lattice is a 61-atom semantic execution substrate. It is a universal lookup table that maps inputs to outputs in O(1) time with zero dependencies. Originally derived from a cross-language error taxonomy (61 programming error domains from Rust, Python, TypeScript, Go), the lattice generalizes to any domain where `(state, event) → (action)`\n\nis the dominant pattern.\n\n1,348 nanoseconds per query. That's 741,667 lookups per second per core. Below human perception.\n\nNo LLM. No API. No network. No database. No Redis. Just a Python dict.\n\nSame lattice deploys in Python, Rust, C, Go, JavaScript, WASM, or JSON. Identical output across all surfaces.\n\nEvery game app is one Python file. No build step. No compilation. No package management.\n\nSame input, same output, every time. No randomness in lookup. Perfect for testing and replay.\n\nShip the free tier today. Monetize the extended atom sets. No backend. No subscriptions to manage.\n\nEach app is a standalone Python file. No shared source. No imports between them. Click \"Try it\" to run in your browser via Pyodide, or \"Download\" to get the source.\n\nPlayer action → NPC reaction in 1,348ns. 6 NPC types × 6 actions = 36 reactions. Replaces behavior trees with a single hash table.\n\nA + B = C. 50 recipes. O(1) lookup. No spreadsheet, no database. Just a hash table. Minecraft-style crafting without the XML.\n\n\"Player has X, needs Y, give Z.\" 5 complete quests with status evaluation. Visual designer-compatible JSON output. O(1) per check.\n\nLevel × Rarity × Affinity = Item. 10 bases, 6 rarities, 12 affinities. Deterministic. Seedable. Same seed = same item.\n\nPlayer says X → NPC says Y. 5 NPCs × 5 actions × 19 moods = 475 unique lines. No conversation tree to maintain.\n\nATK × DEF × Affinity × Crit = Damage. 12 affinities, 5 crit tiers. O(1) per hit. No formula spaghetti.\n\n\"Sword + Dragon Scale = Dragonbane.\" 35 discoverable combos. Reverse lookup supported. O(1) combine.\n\nState × Event → New State. 42 states, 39 transitions. Replaces 10,000-node FSMs. Covers enemy AI, doors, plants, day/night, weather.\n\nSeed × Biome × Depth = Content. 8 biomes, infinite seeds, deterministic. SHA-256-based. Share seeds, share worlds.\n\nA + B = C. 50+ fusions from elemental (fire+water=steam) to cosmic (life+death=rebirth). Tier upgrades. O(1) fuse.\n\nThe entire lattice is a Python `dict`\n\n. Lookup is a hash table operation. That's it.\n\nEvery app follows the same three-atom pattern:\n\n```\n# 1. Define the lattice (the data)\nLATTICE = {\n    (\"input_a\", \"input_b\"): \"output\",\n    (\"player_attacks\", \"guard_npc\"): \"defend_return_attack\",\n    ...\n}\n\n# 2. Define the lookup function (O(1))\ndef execute(a, b):\n    return LATTICE.get((a, b), LATTICE.get((b, a), \"default\"))\n\n# 3. Call it (sub-microsecond)\nresult = execute(\"fire\", \"water\")  # -> \"steam\"\n```\n\n| Approach | Lookup Speed | File Size | Dependencies | Offline |\n|---|---|---|---|---|\n| Behavior Tree (10K nodes) | ~50 µs | 5MB XML | Engine + editor | Yes |\n| LLM / GPT API | ~500ms | 0 bytes | API key + network | No |\n| SQLite lookup | ~10 µs | Schema + files | SQLite | Yes |\n| Redis cache | ~100 µs | 0 bytes | Redis server | No |\nLattice (Python dict) | ~1,348ns | One file | None | Yes |\n\nMeasured on a typical x86_64 server (Python 3.11). All apps are single-file Python with zero imports beyond the standard library.\n\n| App | Atoms | Lookup Latency | Throughput | File Size |\n|---|---|---|---|---|\n| StateZero | 42 states, 39 transitions | ~300ns | 3.3M/sec | 5KB |\n| CraftCore | 50 recipes | ~500ns | 2.0M/sec | 6KB |\n| Dialoop | 475 lines | ~500ns | 2.0M/sec | 9KB |\n| FusionCore | 50+ fusions | ~700ns | 1.4M/sec | 7KB |\n| AffinityGraph | 35 combos | ~1,000ns | 1.0M/sec | 8KB |\n| NPC-Brain | 36 reactions | ~1,348ns | 741K/sec | 6KB |\n| BattleCalc | 12 affinities, 5 crits | ~1,500ns | 666K/sec | 5KB |\n| QuestFlow | 5 quests | ~2,500ns | 400K/sec | 6KB |\n| LootForge | 10 bases, 6 rarities | ~15,000ns | 66K/sec | 5KB |\n| ProceduralHash | 8 biomes, infinite seeds | ~25,000ns | 40K/sec | 5KB |\n\n40,000 lookups/second is fast enough for a turn-based RPG with 1,000 entities making 40 lookups each per frame. 3.3M/sec runs an RTS with 10,000 units. The slowest app is still 4,000x faster than human visual reaction time.\n\nWhy a hash table beats the conventional approach for game logic.\n\n5MB XML, 10K nodes, 50µs/eval. The lattice does 80% of the work in 0.05% of the time.\n\nGPT-4: $0.01-0.05/response, 500-2000ms. Lattice: $0, 1,348ns.\n\nRight pattern, wrong implementation. Lattice is the same FSM, 10x more maintainable, 10x faster.\n\nLoaded at startup, parsed at runtime. Lattice IS a config file with the parser built in.\n\nWhat are the inputs, and what should the system do for each?\n\n```\n# Inputs: (player_action, npc_type)\n# Outputs: npc_reaction\n```\n\n6 player actions × 6 NPC types = 36 combinations.\n\n```\nLATTICE = {\n    (\"greet\", \"merchant\"): \"offer_wares\",\n    (\"attack\", \"merchant\"): \"call_guards\",\n    ...\n}\n```\n\nOne function. Three lines. Done.\n\n``` python\ndef react(action, npc_type):\n    return LATTICE.get((action, npc_type), \"do_nothing\")\nassert react(\"attack\", \"merchant\") == \"call_guards\"\n```\n\nAdd more entries. The lattice grows linearly. Performance stays O(1).\n\nThe free tier ships today. The pro tier is a Python file you can sell.\n\nEvery app is a single Python file. Zero dependencies. MIT-style license. Ship in your game today.\n\nPython is the densest expression of a hash table. You can transpile the lattice to Rust or C in minutes.\n\nYes. MIT-style licensed. No attribution required for the free tier.\n\nOpen the Python file. Find the lattice dictionary. Add a new entry. Save. Done.\n\nCall from Python or export lattice to JSON. 3 lines of lookup logic in any language.\n\nLinear. 360 reactions = 1,500ns. 3,600 = 2,000ns. Hash table doesn't care.\n\nYes. `LATTICE[(\"new_action\", \"new_npc\")] = \"new_reaction\"`\n\n. Instant.", "url": "https://wpnews.pro/news/title-show-hn-10-killer-game-apps-o-1-hash-table-lookup-for-game-logic", "canonical_source": "https://big.lain.technology/gameapps/", "published_at": "2026-06-29 20:01:39+00:00", "updated_at": "2026-06-29 20:22:36.107717+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "generative-ai"], "entities": ["Python", "Rust", "C", "Go", "JavaScript", "WASM", "JSON", "Pyodide"], "alternates": {"html": "https://wpnews.pro/news/title-show-hn-10-killer-game-apps-o-1-hash-table-lookup-for-game-logic", "markdown": "https://wpnews.pro/news/title-show-hn-10-killer-game-apps-o-1-hash-table-lookup-for-game-logic.md", "text": "https://wpnews.pro/news/title-show-hn-10-killer-game-apps-o-1-hash-table-lookup-for-game-logic.txt", "jsonld": "https://wpnews.pro/news/title-show-hn-10-killer-game-apps-o-1-hash-table-lookup-for-game-logic.jsonld"}}