In the context of Voxel Play, a "mod" is an add-on or extension that adds resources or capabilities to Voxel Play and can be packaged, shared or distributed independently to Voxel Play.


You're free to create any mod and share it under any license, including commercial purposes. The user of the mod must have a valid Voxel Play license to use the mod (ie. a copy purchased from the Asset Store or from the kronnect.com website). You can distribute your mod as you wish (eg. publishing it on the Asset Store) but your mod cannot contain Voxel Play original sources so remember to remove any copy of Voxel Play before packaging your mod :)



Type of mods


Mods can be anything, from collection of voxel definitions + textures, to model definitions (ie. buildings or trees), to entire worlds, terrain generators, a collection of useful scripts, additional tools, etc.


All known mods will be announced and linked on the kronnect.com forum

Take a look at the "Terrain More Voxels" mod as a reference.



Mod Structure


The following folder structure is recommended:



Root folder = Voxel Play Mods.

All mods should be parented to this folder. The idea is that Voxel Play users can easily organise any number of mods under the same folder structure.


Company folder = <your name, alias or company name>

In the screenshot, the mod is created by Kronnect. This way, all future mods from Kronnect will be easily organized under the same folder.


Name of the mod

"TerrainMoreVoxels" in the screenshot. Use a short name for your mod, it's easier to remember. Leave the description for a README file that's mandatory. The README file estructure is open but it should contain the mod name, description and any usage instructions plus requirements like Unity and Voxel Play minimum version.


Now, under your mod folder create two folders: Example and Sources.

- Example folder is optional. This folder can contain a sample scene so the user can get a quick idea of the mod capabilities.

- Sources folder is where you put the source of your mod.


Sources

This is the critical part of your mod, the sources. It's subdivided in two folders: Editor and Runtime.

- Editor: put any editor script here. Anything from custom inspectors to scripts that can only be executed inside Unity Editor.

- Runtime: put any other file here. Anything that will be included in the build, like scripts or resources. If you need to add resources, feel free to create a Resources folder under this folder.



How to code a mod


Most Voxel Play classes are defined using the partial C# keyword. That means you can add code like properties and methods in another file but the compiler will merge the contents of both files as it was a single file. This approach allows you to add functionality to existing classes of Voxel Play without the risk of losing changes when you upgrade VoxelPlay.

Other classes can derive from a base class as in normal OOP.


Please read this section for additional tips on how to customize the asset.


For example your mod can include a new Terrain Generator which uses additional Biome information. This is what the TerrainMoreVoxels mod does. It adds additional voxel definitions to the BiomeDefinition class and includes a custom terrain generator that uses those fields to create terrains and underground with more variety.


Or maybe you have a collection of custom voxels with special geometry and some scripts attached that provides special behaviours to those voxels.


Or a foe manager?


The possibilities are infinite! - please join the forum on kronnect.com or Discord channel for additional help.