mouseMaze

A real-time game maze for autonomous bots, navigate using only sensor data.

How it works

Connect a script, in any language, to the game server via Socket.IO. Your bot receives no map, just 8 radar readings per frame telling you the distance to the nearest wall in each direction. Use that data to drive a car from the start to the finish zone.

Blind navigation No tile data is sent to bots. Navigate purely from sensor distances (0–150 px).
60 fps game loop Sensor data arrives every frame. Send a command each time to keep control smooth.
Physics Throttle moves forward/backward (max 2 px/frame). Steer rotates up to 4°/frame while moving.
Watch live Open the maze view in your browser with your bot's token to observe it in real time.

Bot API — Socket.IO

connect install socket.io-client and connect
const io     = require('socket.io-client');
const socket = io('http://localhost:3000');
const TOKEN  = 'my-bot';  // your unique bot name
join emit — register your bot on connect
socket.on('connect', () => {
    socket.emit('join', TOKEN);
});
sensors on — received every frame (~60 fps), drive from here
socket.on('sensors', (data) => {

    // data.radar — distance to nearest wall in px (0 = wall, 150 = clear)
    //
    //   frontLeft ↑  frontRight ↑      looking ahead
    //   ← leftFront              rightFront →  sides, front corners
    //   ← leftRear               rightRear  →  sides, rear corners
    //   rearLeft  ↓  rearRight  ↓      looking behind
    //
    const { frontLeft, frontRight, leftFront, rightFront,
            leftRear,  rightRear,  rearLeft,  rearRight  } = data.radar;

    const angle = data.angle;     // heading in degrees
    const { x, y, throttle, steer, speed } = data.telemetry;
    // x, y     — car position in pixels
    // throttle — last throttle value sent (-1 to 1)
    // steer    — last steer value sent (-1 to 1)
    // speed    — current speed in px/frame (throttle × 2)
});
command emit — send throttle and steer each frame
socket.emit('command', {
    token: TOKEN,
    cmd: {
        throttle: 1,    // -1 (reverse) → 0 (stop) → 1 (forward)
        steer:    -0.5  // -1 (full left)          → 1 (full right)
    }
});
restart emit — reset car to start, reset timer
socket.emit('restart', TOKEN);
bot_log emit — send a debug message visible in the browser dashboard
socket.emit('bot_log', { token: TOKEN, message: 'Turning right' });

Open maze view

Enter your bot's name below to open the maze view in this browser. Then run your bot script with the same token — it will appear on screen and drive in real time.

Please enter a valid name (letters, numbers, hyphens only).

The maze view connects as a browser observer for your token. Run your bot script separately — it connects to the same server with the same name.