A high-performance, authoritative multiplayer game engine. Write game mechanics and ANSI graphics, while TuiEngine orchestrates SSH/Web routing, SQLite schemas, real-time loops, and admin control panels.
bun create github.com/thoughtlesslabs/tuicraft my-game
TuiEngine is a blank-slate template configured to get you building terminal graphics immediately.
Playable natively over standard terminal SSH (`ssh localhost -p 2222`) OR in browser using a proxy WebSocket to xterm.js wrapper.
Central action queue that executes inputs sequentially per tick (default 300ms) with auto-saving, state tracking, and idle room sweeping.
Utilizes `bun:sqlite` with predefined schemas for session recovery, bans, keys, chat logs, and hooks to easily register custom gameplay tables.
Beautiful, separate SSH control screen on port 2223 with TOFU public key security to kick/ban users, broadcast alerts, and trigger custom commands.
Built-in AI server allowing LLM agents, players, or developer bots to connect, inspect rooms, fetch logs, and trigger game controls dynamically.
Docker Compose layouts and optimized multi-stage Slim builds containing curve25519 fixes for seamless deployments on Ubuntu/VPS nodes.
Bootstrap a production-ready repository structure in seconds.
import { TuiEngine, BoxRenderable } from "tuiengine";
// 1. Instantiate the TuiEngine
const engine = new TuiEngine({
databasePath: "data/mygame.db",
tickRateMs: 300,
onPlayerSession: handlePlayerSession
});
// 2. Handle the player rendering loop & UI layout
function handlePlayerSession(session) {
const { renderer } = session;
// Draw boxes and controls using OpenTUI components
const box = new BoxRenderable(renderer.root.ctx, {
width: "100%",
height: "100%",
border: true,
title: " Welcome to TuiCraft "
});
renderer.root.add(box);
renderer.requestRender();
}
// 3. Boot the servers! (SSH & Web)
engine.start();