This repository is a modding kit that can be used to create mods for the game Tower Networking Inc. Modding support for the game is implemented with Godot Sandbox using libriscv.
Mods are created in C/C++, however this repository also contains the official LuaJIT support mod. Lua mods are preferred as they are easier to develop and are naturally source-available.
Note that modding for the game is still in early design/implementation stage, and any feedback/suggestions is encouraged to make modding the game fun!
If you want to use a Lua based mods, you will need to manually add the luajit support mod first. This may be improved in the future.
You can find the mod in the github releases, or click here for the latest stable release. Download the luajit file and place it in your mods folder. Refer to Loading the mod for further instructions.
If you are using the beta branch of the game, you'll likely want to use the "Continuous (gnu) - beta" release instead.
There is a beta github branch which should work with the game's beta branch on steam.
Changes to the modding-kit go through the beta branch first.
Examples are your friend. To get started, take a look at the following examples:
The 2x BW switches mod doubles the bandwidth of every switch when spawned in. The store display the original value!
The Template mod is a template that contains the common use scenario for writing a mod in c/c++.
The LuaJIT support mod adds Lua based mods. It is much more complex but may help with things the template doesn't have.
Mods in the game will be loaded from the user's game directory in alphabetical order.
-
Windows:
%APPDATA%\Godot\app_userdata\Tower Networking Inc -
Linux:
~/.local/share/godot/app_userdata/Tower Networking Inc
On the user's game directory, you'll observe directories like saves/ and logs/. Place your mod in the mods/ directory.
For example, to install the tni-mod-template mod, place .zig/tni-mod-template to mods/ such that mods/tni-mod-template/entry.elf exists.
If you'd like to use Lua instead, you can download the pre-built luajit.elf mod from the releases section and place it as mods/luajit.elf (directly in the mods/) directory. This enables loading of .lua mods.
The engine will always first try to load the luajit.elf before all mods, so you do not need to worry about the naming.
Check out the librisc-v docs for more information.
To clone and initialize the repository locally;
# Ensure you have `git` installed.
git clone https://github.com/treefarmer741/Tower-Networking-Inc-modding-kit.git --branch main
git submodule update --init --recursiveMake sure the following is installed:
- git (version control system, used to clone the repo locally)
- CMake (generator for build systems)
- Ninja (build system)
- ZIG (RISC-V cross-compilation)
Then in the root of this project, run the command:
zig.cmd
The built output (a .elf file) will be in the .zig/<name-of-your-mod>/entry.elf directory.
Make sure the following is installed:
git(version control system, used to clone the repo locally)CMake(generator for build systems)Ninja(build system)g++-riscv64-linux-gnu-14(GNU RISC-V compiler)
# For Debian based systems like Ubuntu;
sudo apt install git cmake ninja-build g++-riscv64-linux-gnu-14Then in the root of this project, run the command:
./build.cmd