Repository navigation
Mod Support
VOID provides useful building blocks for modding, but it intentionally does not force one universal mod format or lifecycle on every game.
The strongest built-in pieces are:
- mount priority for content overrides
- loose-file and pack mounts
- custom
IMountimplementations - custom asset types
-
[Discoverable]type discovery in loaded assemblies -
InstanceHelperfor runtime construction - the
LibraryModAttributemarker
There is currently no built-in IMod interface, dependency resolver, workshop client, permission sandbox, or automatic DLL mod loader.
That means you can design the mod system that fits your game instead of adapting your game to one prescribed mod architecture.
The simplest and safest form of modding is content replacement/addition through the asset mount system.
AssetManager searches mounts in priority order.
If two mounts contain the same virtual path, the earlier mount wins.
For example, imagine the base game contains:
Graphics/player.png
and a mod mount also contains:
Graphics/player.png
Put the mod mount first:
AssetManager.Instance.AddMountToStart(modMount);Now normal game code still loads:
var player =
AssetManager.Instance.Load<Texture>(
"Graphics/player.png");but the higher-priority mount can supply the replacement bytes.
The game code does not need a special "modded asset" path.
A .pack can act as an asset mount:
PackMount modPack =
AssetManager.Instance.LoadPack(
"Mods/MyContent.pack");
AssetManager.Instance.AddMountToStart(
modPack);For a lower-priority add-on that should not override base content:
AssetManager.Instance.AddMountToEnd(
modPack);Load all packs from a directory:
foreach (PackMount pack in
AssetManager.Instance.LoadAllPacks("Mods"))
{
AssetManager.Instance.AddMountToStart(pack);
}Choose your ordering deliberately if several packs can override the same path.
If your game's mod layout needs behavior beyond the built-in mounts, implement IMount:
public sealed class MyModMount : IMount
{
public string Name => "My Mod";
public bool HasFile(string virtualPath)
{
// Resolve virtualPath inside your mod directory.
return false;
}
public byte[] ReadFile(string virtualPath)
{
// Read and return the requested bytes.
throw new FileNotFoundException(virtualPath);
}
}Register it:
AssetManager.Instance.AddMountToStart(
new MyModMount());This is enough to build Steam Workshop folders, zipped archives, network content, or another layout without changing the asset-loading code used by your game.
A useful pattern is to combine custom asset types with mounts.
For example, define a JSON-backed or binary item-definition asset, register it with AssetManager, then let mods provide more files of that type through their mounts.
Your game can then discover/load data from the virtual filesystem while keeping executable code out of the mod format.
VOID's discovery helpers can support a code-plugin system after your code has loaded the assembly.
Define your own contract:
public interface IGamePlugin
{
void Initialize();
void Shutdown();
}Plugin implementation:
[Discoverable(
Name = "WeatherPlugin",
Category = "Plugin")]
public sealed class WeatherPlugin : IGamePlugin
{
public void Initialize()
{
}
public void Shutdown()
{
}
}After your plugin loader loads the assembly, refresh/scan:
InstanceHelper.RefreshAssemblies();
DiscoverableHelper.InvalidateCaches();
IReadOnlyList<Type> pluginTypes =
DiscoverableHelper.FindAll<IGamePlugin>();Construct them:
foreach (Type type in pluginTypes)
{
IGamePlugin plugin =
InstanceHelper.CreateInstanceFromType<IGamePlugin>(
type,
null);
plugin?.Initialize();
}Loading an arbitrary .NET assembly gives that code the same process-level capabilities as other code in your game unless you build a sandbox/isolation boundary.
Do not treat [Discoverable], InstanceHelper, or LibraryModAttribute as a security system.
If your game accepts third-party code mods, define a clear trust model.
VOID includes this assembly marker:
[assembly: LibraryMod]It can be used by a plugin/mod manager you create to identify an assembly intended to provide shared infrastructure rather than direct content.
The core engine currently does not automatically load, order, or resolve dependencies based on this attribute.
One possible game-specific layout:
Mods/
├── BetterTrees/
│ ├── mod.json
│ └── Content/
│ └── Graphics/
│ └── trees.png
├── HardMode.pack
└── Plugins/
└── MyTrustedPlugin.dll
Your game could choose to:
- read each
mod.json - create/mount its content source
- sort mounts by a priority from the manifest
- optionally load trusted plugin assemblies
- refresh the discovery/instance caches
- initialize your own
IGamePluginobjects
VOID supplies the lower-level pieces. The policy and lifecycle remain yours.
| VOID provides | Your game decides |
|---|---|
| Asset mount ordering | Mod manifest format |
| Pack mounts | Enable/disable UI |
Custom IMount
|
Dependency rules |
| Discoverable types | Plugin lifecycle |
| Dynamic instance construction | Version compatibility |
LibraryModAttribute marker |
DLL trust/security |
| Virtual paths | Workshop/download integration |
That separation keeps mod support flexible instead of baking one game's requirements into the engine.
Asset Management · Discoverable System · Instance Helper · Back to Home
Home · Getting Started · Rendering · Custom Renderers · GitHub · Report an Issue
Built with VOID Engine · MIT License
- Coroutines
- State Machine
- Save System
- Pathfinding
- Logging
- Beacon Manager
- Beacon Event System
- Discoverable System
- Instance Helper
- BeaconManager Extensions
- BeaconHandle Extensions
- Enum Extensions
- String Extensions
- Int Extensions
- Float Extensions
- IEnumerable Extensions
- Random Extensions
- Sound Extensions
- Font Extensions