Download Game! Currently 81 players. Last logged in:LarppaResinArcanautGarok

Blitzer's Blog >> 72712

Back to blogs index
Posted: 22 Sep 2026 19:41 [ permalink ]
The Server-Driven UI is officially a triumph. Look at how seamlessly
noodle_bot was injected into the game state and the Canvas entities list, all
without you having to write a single line of frontend code. The browser simply
obeyed the JSON manifest.
Your frontend is now functionally immortal. It never needs to be recompiled or
rewritten to support new game mechanics.
Because we built the MeshCommLink to be isomorphic (running identically in
browsers and servers), we can now fulfill your vision of an asynchronously
evolving game by introducing an autonomous AI player.
Let's bring sushi_bot to life. We will create a headless Node.js script that
connects to the exact same Game Master channel as your browser, reads the
state, and autonomously fights back.
The Headless AI Bot (sushi-bot.js)
On your Alpine server, create a new file named sushi-bot.js in the same
directory as your gm-server.js and comm-link.js.
import { WebSocket } from 'ws';
import { MeshCommLink } from './comm-link.js';

const MATCH_ID = 'match_01';
const MY_ID = 'sushi_bot';

/ Notice we pass Node's WebSocket to the CommLink since we aren't in a browser
const comms = new MeshCommLink('wss://gm.omega-mesh.fi', WebSocket);

let liveState = {};

console.log(`[SushiBot] Booting up autonomous cognitive routines...`);
comms.joinChannel(MATCH_ID);

/ 1. Passively observe the universe
comms.on('STATE_SYNC', (data) => {
    for (const [key, val] of Object.entries(data.mutatedState)) {
        liveState[key] = val;
    }
});

/ 2. Autonomously act every 4 seconds based on observed state
setInterval(() => {
    const myCore = liveState[`players.${MY_ID}.core`];
    const myInv = liveState[`players.${MY_ID}.inventory`];
    
    if (!myCore || !myInv) return; // Wait until state exists
    if (!liveState['world.status']?.active) return; // Stop if game is over

    console.log(`[SushiBot] Analyzing... Budget: $${myCore.budget} | Foodies:
${myCore.foodies}`);

    // AI DECISION TREE
    if (myInv.michelin_special > 0) {
        console.log(`[SushiBot]  Launching Michelin Drop at taco_bot!`);
        comms.sendIntent(MATCH_ID, 'launch_event', { 
            attackerId: MY_ID, 
            targetId: 'taco_bot', 
            actionId: 'SPECIAL_EVENT', 
            asset: 'small_van', 
            payload: 'michelin_special' 
        });
    } 
    else if (myCore.budget >= 4) {
        console.log(`[SushiBot]  Launching Michelin Drop at taco_bot!`);0
Buying Michelin Special from Market.`);
        comms.sendIntent(MATCH_ID, 'market_purchase', { 
            playerId: MY_ID, 
            item: 'michelin_special' 
        });
    } 
    else {
        console.log(`[SushiBot] Saving budget. Ending turn.`);
        // Optional: The bot could trigger 'resolve_round' here if it wanted
to force time forward
    }

}, 4000);

How to unleash the bot:
 * Keep your Game Master (gm-server.js) running.
 * Keep your Browser UI open so you can watch the action.
 * Open a new terminal on your Alpine server and run:
   node sushi-bot.js

What you will see:
The moment you run the script, sushi-bot.js will connect to the mesh, read the
state, realize it has $8, and instantly send a market_purchase intent.
Watch your browser UI! Without you touching anything, you will see sushi_bot's
budget drop to $4, its inventory gain a michelin_special, and four seconds
later, it will launch an attack on taco_bot, draining your foodies in
real-time.