ghast-viewer
A bot screen for bots built on ghast: a live 3D view of the bot's world in the browser (first person, third person or a free camera), plus recordings, a dash cam and replays on the same page.
- Read-only. The viewer wraps your behaviour and reads the bot in
after_tick; it never writes to the game connection. The page can only send clock pings, flow-control ACKs and playback controls. - Free while nobody watches. No frames are built and no columns copied until a page is open; the server stops itself after an idle timeout.
- One per bot. Each bot serves its own page on its own port, on
127.0.0.1by default, optionally protected by a token. - No game assets in the crate. Textures and block models are built at run time from the
vanilla client jar, downloaded from Mojang's servers into a local
.cache/ghast-viewer(featuredownload, on by default), or read from a local copy (ViewerConfig::client_jar). - 1.8.9 and 26.1 sessions are drawn (26.1 with the
v26_1feature, on by default). The page draws with the 1.8.9 assets: a 26.1 world is mapped onto them (blocks and items 1.8 has keep their state, newer ones become a look-alike, seeghast_viewer::v26_1), and the page shows the 256 rows of the dimension around the bot (it moves the window and redraws when the bot leaves it). Entities are listed from the 26.1 tracker (mob models where 1.8 has the mob, else a box of the entity's size; dropped items show their stack); other entities' held items and armour, chest lids, particles, weather, experience and other players' block cracks are 1.8-only. Text is never a stand-in: the header names the game ("26.1 (drawn with 1.8.9 assets)") and the real height, the top panel names the held item and the armour, each hotbar slot's tooltip has the real name, count, enchantments, durability and id; stand-in icons carry a "≈" mark, durability bars come from the real damage, and entities or dropped items drawn with a stand-in get a name tag with their real name.
Use
Through the facade crate:
or on its own: cargo add ghast-viewer.
use ;
use ;
let viewer = new;
let addr = viewer.start.await?;
println!;
let client = new
.world_config;
let mut behaviour = viewer.watch;
client.run.await?;
The integration guide (INTEGRATION.md) covers ports, tokens, recordings, the dash cam and costs. The wire protocol between server and page is in docs/protocol.md.
Examples
Web client
The page (TypeScript, WebGL2) lives in web/; its built files in web/dist/ are committed and
embedded in the crate, so cargo build needs no Node. See web/README.md to
rebuild or test it.
Licence
MIT OR Apache-2.0.