Difference between revisions of "Mod Creation"
GoogleFrog (talk | contribs) |
GoogleFrog (talk | contribs) |
||
Line 13: | Line 13: | ||
For LuaUI changes you will need to enabled local widgets and load local widgets first through the advanced settings in <code>Settings/Interface/Misc</code>. Completely new widgets can also be added and loaded. | For LuaUI changes you will need to enabled local widgets and load local widgets first through the advanced settings in <code>Settings/Interface/Misc</code>. Completely new widgets can also be added and loaded. | ||
− | == | + | == More Significant Changes == |
− | Changing animations, unit behaviour, game mechanics or statistics is a little trickier than cosmetic changes. These types of changes affect everyone in a multiplayer game (as opposed to local interface changes) so require the creation and distribution of a game archive. | + | Changing animations, unit behaviour, game mechanics or statistics is a little trickier than cosmetic changes. These types of changes affect everyone in a multiplayer game (as opposed to local interface changes) so require the creation and distribution of a game archive. Entirely new games for the Spring engine can be made with this method. |
− | === | + | === Mutators === |
− | + | A mutator is a mod archive that can add and override files relative to a base archive. Mods that make relatively small changes to Zero-K should be made with a mutator, as this keeps filesizes low and allows the mod to stay up to date with fixes or changes to other parts of Zero-K. Even large projects should probably start out as mutators, as it enables the project to build up to handling every aspect of creating a full game archive. | |
− | [[File: | + | is to make a mutator, this is a game package that includes modified files but otherwise uses the files of the base game. Here is an example mutator [[:File:BaseMod.sdd.zip|BaseMod.sdd.zip]] to get you started. Unzip it in Zero-K/games, and yes, the folder should be named with the extension ".sdd". Your file stucture should look like this. |
− | |||
− | [[File: | + | [[File:baseModFile.png]] |
Any file found in the mutator and the base game will be overridden by the version found in the mutator. New files can be added too. | Any file found in the mutator and the base game will be overridden by the version found in the mutator. New files can be added too. | ||
− | === | + | === Downloading the Zero-K repository === |
− | + | Maintaining a local development copy of Zero-K is very useful as poking around the repository can reveal a lot about the required structure for mutators, the names of files to override, and provides a place to trace errors. Clone the game repository as seen on the [[Developing]] page. The fork step can be skipped for now if you are just intending to take a look. Be sure to keep your local copy up to date by regularly using git to pull changes. With a local repository you can eventually open pull requests and push content to be included in the base game (if you're keen). | |
+ | |||
+ | === Running your mod - Singleplayer === | ||
+ | Open a skirmish via the singleplayer menu and click 'Adv Options'. | ||
+ | |||
+ | [[File:AdvOptions.png]] | ||
+ | |||
+ | Click 'Select Mod' and select your mod from the list. The example above is called 'Zero-K Base Mutator v1'. Click Apply. | ||
+ | |||
+ | [[File:SelectMod.png]] | ||
− | + | The text beneath the Adv Options button should change from 'Zero-K vX.Y.Z.W' to the name of your mod. | |
− | |||
− | Start | + | Click 'Start' to start. Note that friends invited via skirmish coop will not be able to join the game unless they have a copy of your mod. |
− | === Running your mod | + | === Running your mod - Multiplayer === |
* Enable developer mode. Do this by creating an empty text document "devmode.txt" in the same directory as Zero-K.exe. You may need to restart the lobby. | * Enable developer mode. Do this by creating an empty text document "devmode.txt" in the same directory as Zero-K.exe. You may need to restart the lobby. | ||
* In the Settings menu a new tab appears: Developer. Edit the Singleplayer setting to be Zero-K Dev. | * In the Settings menu a new tab appears: Developer. Edit the Singleplayer setting to be Zero-K Dev. |
Revision as of 01:09, 19 August 2020
Zero-K runs on the Spring engine, which supports a lot of modification of game files. The most advanced mods may amount to creating an entire new game. The Spring engine wiki is a valuable resource for game and mod development using the engine, especially the gamedev page.
Familiarity with the game repository or main menu repository is important for modding and downloading a searchable version is advised. See Developing#Getting_Sources for how to download a local version of the repository.
Contents
Cosmetic and UI changes
Some changes can be made just by adding files to your install directory. The following subfolders of the game repository should support this (feel free to attempt more): unitpics, sounds, unittextures, bitmaps, anims, icons and LuaUI. Replace a file by perfectly matching its name and path.
Here's an example config replacement for team colour config that you can place in LuaUI/Configs/LocalColors.lua
.
Everything in the main menu repository can be overridden.
Widgets
For LuaUI changes you will need to enabled local widgets and load local widgets first through the advanced settings in Settings/Interface/Misc
. Completely new widgets can also be added and loaded.
More Significant Changes
Changing animations, unit behaviour, game mechanics or statistics is a little trickier than cosmetic changes. These types of changes affect everyone in a multiplayer game (as opposed to local interface changes) so require the creation and distribution of a game archive. Entirely new games for the Spring engine can be made with this method.
Mutators
A mutator is a mod archive that can add and override files relative to a base archive. Mods that make relatively small changes to Zero-K should be made with a mutator, as this keeps filesizes low and allows the mod to stay up to date with fixes or changes to other parts of Zero-K. Even large projects should probably start out as mutators, as it enables the project to build up to handling every aspect of creating a full game archive.
is to make a mutator, this is a game package that includes modified files but otherwise uses the files of the base game. Here is an example mutator BaseMod.sdd.zip to get you started. Unzip it in Zero-K/games, and yes, the folder should be named with the extension ".sdd". Your file stucture should look like this.
Any file found in the mutator and the base game will be overridden by the version found in the mutator. New files can be added too.
Downloading the Zero-K repository
Maintaining a local development copy of Zero-K is very useful as poking around the repository can reveal a lot about the required structure for mutators, the names of files to override, and provides a place to trace errors. Clone the game repository as seen on the Developing page. The fork step can be skipped for now if you are just intending to take a look. Be sure to keep your local copy up to date by regularly using git to pull changes. With a local repository you can eventually open pull requests and push content to be included in the base game (if you're keen).
Running your mod - Singleplayer
Open a skirmish via the singleplayer menu and click 'Adv Options'.
Click 'Select Mod' and select your mod from the list. The example above is called 'Zero-K Base Mutator v1'. Click Apply.
The text beneath the Adv Options button should change from 'Zero-K vX.Y.Z.W' to the name of your mod.
Click 'Start' to start. Note that friends invited via skirmish coop will not be able to join the game unless they have a copy of your mod.
Running your mod - Multiplayer
- Enable developer mode. Do this by creating an empty text document "devmode.txt" in the same directory as Zero-K.exe. You may need to restart the lobby.
- In the Settings menu a new tab appears: Developer. Edit the Singleplayer setting to be Zero-K Dev.
- Your skirmish/campaign games should now use your modified local copy of zk.sdd. In this mod, the Lotus has 10 times its normal range.
Advanced mutator creation (offline only?)
- Download and extract the ZK mod template to your Zero-K folder. It should create the folder
Zero-K/games/newmod.sdd
. - Enable developer mode (see above). Go to the Developer tab in Settings and edit the Singleplayer setting to 'Zero-K New Mod'.
- Your skirmish/campaign games should now use the contents of newmod.sdd. You can change this folder's contents to mod your game.
- To rename your mod or change the version number, change
Zero-K/games/newmod.sdd/modinfo.lua
andZero-K/LuaMenu/configs/gameConfig/newMod/mainConfig.lua
.- Make sure
zkBaseConfig._defaultGameArchiveName
in mainConfig.lua matches the name and version in modinfo.lua. - The folders games/newmod.sdd and LuaMenu/configs/gameConfig/newMod can also be renamed, if you wish to distribute your mod.
The images and links on this page may be broken at the moment. The cache on this page points to the test wiki. Please purge the cache to try to restore images and fix those links.
This will work only if the page is not on the test server (where this box should appear for now even when cache purging is not needed), which may lack the actual images. This page thinks that it resides on test.zero-k.info right now.
- Make sure