Overview
Voxelius the game builds on Voxelius the engine. The engine exposes Lua hooks. Mods use these hooks to define blocks and other content that extends core gameplay.
Namespaced identifiers
The engine uses namespaced identifiers, similar to Minecraft. A namespaced identifier has a namespace and an identifier:
[<namespace>:]<identifier>
The namespace is optional.
- In a mod script, a missing namespace defaults to the namespace of that mod.
- Elsewhere, the parser keeps the namespace empty. The code that reads an engine file passes
builtinexplicitly.
The engine does not check the characters below, and it splits the string at the first :. This set is a convention:
- Latin letters:
A-Zanda-z - Digits:
0-9 - Underscore:
_ - Tilde:
~(not recommended for general use, see below)
On init, if the engine finds a duplicate registry entry (for example mymod:myblock registered twice), it appends ~N and retries. After 9999 attempts it logs a critical message and keeps the original identifier.
Sides
A mod runs on both the client and the server from the same scripts/init.lua. The engine exposes the side as two booleans:
| Value | Description |
|---|---|
core.IS_CLIENT | True on the client |
core.IS_SERVER | True on the server |
Some APIs exist on the server only: world.schedule, world.seed and weather.force. Their table or field is absent on the client, so an unguarded call fails the mod on that side. Guard it with core.IS_SERVER:
if core.IS_SERVER then
dofile("loot_server.lua")
end
World definitions are server configuration, not a Lua API. See World definitions.
| Callback | Runs on |
|---|---|
blocks.on_place, blocks.on_break | Both sides. The client predicts, the server decides |
blocks.on_tick | Server only |
blocks.on_interact | Server only. The engine does not call it yet |
weather.on_tick, weather.on_strike | Server only |
Register content such as blocks, biomes, precipitation types and weather types unconditionally. A definition registered on one side only changes the numeric IDs on that side and desynchronizes the two sides.
Error handling
The mod root script modname/scripts/init.lua can catch its own errors. If an error escapes that script and reaches the init lua_pcall, the engine marks the mod load as a failure.