Modding

First mod

Create a mod that makes higher-tier drilling rigs extract resources faster. The examples target Evospace 0.22.2; the API reference documents version 0.22.2.

Folder

folder
DrillingRigSpeed/
    info.json
    init.lua

You can choose any folder name. The game identifies the mod by the name field in info.json. It runs init.lua at startup. Use require to load other Lua files from there.

info.json

info.json json
{
    "name": "DrillingRigSpeed",
    "version": "1.0",
    "title": "Drilling Rig Speed",
    "author": "your name",
    "evospace_version": "0.22.2",
    "dependencies": ["Vanilla>=0.22.0", "VanillaLib>=0.22.0"],
    "description": "Halves the extraction time of a drilling rig with every level."
}
FieldMeaning
name Unique mod identifier. This is the only required field; duplicate names are rejected.
version Mod version, used to check dependency requirements.
title Name in the mod list.
author Author in the mod list.
evospace_version Game version the mod was written for.
dependencies Mod names with optional version constraints: >=, <=, =, >, <. Use ? for an optional dependency and ! for an incompatible mod.
description Description in the mod list.

Dependencies determine the load order and which mods you can import with require. This example uses helper functions from VanillaLib to modify blocks registered by Vanilla. The version constraints refer to those mods' versions, which can differ from the game version in evospace_version.

init.lua

This mod halves the extraction time for each increase in drilling rig tier. In the base game, all tiers use the same extraction time.

init.lua lua
local Vlib = require('@VanillaLib')

local DrillingRigSpeed = {}

local function ticks_for(level)
    return math.floor(Vlib.mining.drill.ticks / 2 ^ level + 0.5)
end

function DrillingRigSpeed.post_init()
    for _, proto in pairs(db:objects()) do
        local block = StaticBlock.cast(proto)
        local rig = block ~= nil and block.logic ~= nil and block.logic:is_child_of(DrillingRig.get_class())
        local base = rig and block.logic_init or nil

        if base ~= nil then
            block.logic_init = function(self)
                base(self)
                local drill = DrillingMachineBase.cast(self)
                drill.ticks_per_item = ticks_for(drill.static_block.level)
            end

            print('DrillingRigSpeed: ' .. proto.name .. ' -> ' .. ticks_for(block.level) .. ' ticks per item')
        end
    end
end

db:mod(DrillingRigSpeed)

Loading stages

Every block, item, recipe and research is a prototype in one database. db:mod takes a table with up to three functions that change it. Mods run in dependency order: all pre_init, then all init, then all post_init.

StageWhen to use it
pre_init Runs after JSON prototypes are loaded and before settings are applied. Register settings here.
init Register your own blocks, items, recipes, research and structures. Prototypes of mods you depend on already exist.
post_init All prototypes of all mods are registered. Change prototypes of other mods here.

How the example works

The mod checks each prototype returned by db:objects(). StaticBlock.cast filters out prototypes that are not blocks, then is_child_of checks whether the block's logic class is a drilling rig. This includes every tier of drilling rig and excludes pumpjacks, which use a different class.

For each matching block, the mod replaces logic_init, the function called when a block is initialized. It calls the original function first to set up inventories and connections, then changes ticks_per_item. Here, self is the simulated block and self.static_block.level is its prototype's tier.

Install

Put the folder in Content/Mods inside the game folder, next to Vanilla. The game reads it at startup and names it in the log.

Logs

Mods load once at startup. Restart the game after an edit. Load errors and print output go to the log; print_warn and print_err write at the warning and error levels. The previous run is EvospaceGameplay.log.1.

SystemLog
Windows %LOCALAPPDATA%\Evospace\Saved\Logs\EvospaceGameplay.log
macOS ~/Library/Application Support/Epic/Evospace/Saved/Logs/EvospaceGameplay.log

Common failures, each logged by name: info.json without name; a dependency that is missing or of the wrong version; require for a module of a mod that is not a declared dependency; a hook that is not a function.

API reference

Classes, fields and functions are listed in the Lua API reference. The same list ships as type definitions in Evospace/lua-api: clone it and point luau-lsp at evospace.d.luau, or LuaLS at its library folder, for completion and signatures.

Content/Mods/Vanilla/Blocks holds one file per machine, each of them a logic_init. The prototypes — items, blocks, recipes, research — are JSON in Content/Mods/Vanilla/Generated, the data of the Vanilla mod: a mod that depends on Vanilla has them from pre_init on.

Publishing

Open Mods from the main menu and select your mod folder in the publishing form. Steam creates a Workshop item for the mod. Uploading an update replaces the item's files. Subscribers load the updated mod when they restart the game.

Text and translations

Strings live in .ini files in Loc/<language>/. The language codes are en, de-DE, es-ES, fr-FR, hu-HU, ja-JP, ko-KR, pl-PL, pt-BR, ru-RU, zh-CN. The game reads every .ini file in the folder; file names do not matter. A [section] line starts a table, and each Key=Text line below it adds one string. In Lua, Loc.new("Key", "section") refers to a string.

A translation mod needs no init.lua:

folder
ChineseTranslation/
    info.json
    Loc/
        zh-CN/
            text.ini
info.json json
{
    "name": "ChineseTranslation",
    "version": "1.0",
    "title": "简体中文",
    "author": "your name",
    "evospace_version": "0.22.2",
    "dependencies": ["VanillaQuests", "VanillaTips"],
    "description": "Simplified Chinese for the game, its quests and its tips."
}
Loc/zh-CN/text.ini ini
[machines]
Furnace=加热器

[quests]
Welcome=欢迎来到 Evospace
  • The game loads its own strings first, then the strings of each mod in dependency order. A later string with the same section and key replaces an earlier one.
  • Strings of the selected language are loaded after the English ones. A key with no translation shows the English text. A mod's English string does not replace the game's translation.
  • Quest and tip strings belong to the VanillaQuests and VanillaTips mods. List these mods in dependencies so the translation loads after them; otherwise their strings may replace yours. The rest of the game's strings need no dependency.