a bare-bones limbo server in rust (mirror of https://github.com/xoogware/crawlspace)
1# crawlspace
2a tiny limbo server
3
4for now, this only supports a very tiny subset of the minecraft protocol, and will generally be kept up to date with the latest major changes as it's intended to be behind Velocity with ViaBackwards.
5it's possible that it'll work on older minecraft versions but honestly I am not intentionally trying to support that
6
7(i don't know rust! this is a work in progress and will be rewritten many times to be More Correct! gimme a sec let me cook!)
8
9> [!IMPORTANT]
10> For now, Crawlspace is **extremely** limited in the functionality it provides.
11> It is NOT intended to be a fully-featured Minecraft server; in fact, it's quite the opposite.
12> Crawlspace does **not** implement a full entity tick loop or anything of the sort; instead, it is first and foremost meant to be the **bare minimum** required to keep a player connected.
13>
14> Crawlspace is intended to be optimized for maximum player count above all else, and only secondarily as a storytelling medium for XOOGWARE.
15> This means that Crawlspace can currently **only load worlds that have been specially prepared for it**: currently, only the End is supported, and chunks are loaded **immediately** and sent to the player, so world size should be kept as small as possible (between chunks -10 and 10 on both axes, inclusive).
16
17# Running
18Download a precompiled binary, if available, or [build from source](#build-from-source).
19You can also [use a container image](#use-a-container-image).
20
21## Build from source
22Clone the repo:
23```bash
24git clone https://github.com/xoogware/crawlspace
25```
26Ensure you have a compatible version of Rust installed. The toolchain we use can be found in [rust-toolchain.toml](https://github.com/xoogware/crawlspace/blob/master/rust-toolchain.toml).
27If you use Rustup this will be installed automatically when you run any Cargo command.
28
29Then, simply:
30```bash
31# build
32cargo build
33# ...or run
34RUST_LOG=info cargo run path/to/your/world
35```
36
37Crawlspace also has profiles to enable stripping and LTO:
38```bash
39cargo build --profile=release-strip
40cargo build --profile=release-lto
41```
42
43## Use a container image
44Nightly builds of Crawlspace are pushed to GHCR, and tagged version releases will be as well.
45Pull using either `nightly` or a commit short hash as the tag:
46```bash
47podman pull ghcr.io/xoogware/crawlspace:nightly
48```
49then run with the world mounted read-only:
50```bash
51podman run --rm --read-only -v=./tmp/DIM1:/world:ro,Z -e="LIMBO_WORLD=/world" -p=8006:25565 crawlspace
52```
53
54# Configuration
55Crawlspace supports multiple modes of configuration. In order of priority, with first being the highest:
56
571. Command line flags (run `crawlspace --help` for more info)
582. Environment variables (see [Environment Variables](#environment-variables))
593. (TO BE IMPLEMENTED) Lua Scripting API (see [Lua Scripting](#lua-scripting))
60
61## Environment Variables
62Environment variables can be provided to configure basic Crawlspace functionality.
63Please note that **environment variables will be overridden by command line flags if passed.**
64
65- `LIMBO_ADDRESS`: The address to host the server on. Defaults to `[::]`.
66- `LIMBO_PORT`: The port to host the server on. Defaults to `25565`.
67- `LIMBO_MAX_PLAYERS`: the hard player limit. connections will be refused past this
68- `LIMBO_WORLD`: the directory to load the map from. Should be DIM1, or the equivalently named folder.
69- `LIMBO_SPAWN_X`, `LIMBO_SPAWN_Y`, and `LIMBO_SPAWN_Z`: The coordinates to spawn the player at. Defaults to (0, 100, 0).
70- `LIMBO_BORDER_RADIUS`: The radius of the world border, in blocks, centered on the spawnpoint. Defaults to 10 chunks.
71
72## Lua Scripting
73**To be implemented.**
74Crawlspace will feature a Lua scripting API to configure things such as map loading, spawning, etc. along with reactions to basic player events such as movement.