Difference between revisions of "Packaging mods"

From EDukeWiki
Jump to navigation Jump to search
 
Line 47: Line 47:
  setdefname mymod.def
  setdefname mymod.def


The [[setdefname]] command tells Eduke32 where to find your DEF file.
The [[setdefname]] command tells EDuke32 where to find your DEF file.
Note that you could name it whatever you like or put it in a subdirectory
Note that you could name it whatever you like or put it in a subdirectory
and adjust the line above as necessary.
and adjust the line above as necessary.

Latest revision as of 08:53, 30 July 2020

Intro

This guide outlines a scheme for packaging mods, including directory structure, essential files, useful CON commands, instructions on launching packaged and unpacked mods, and tips for working with version control.

This guide assumes you are modding for EDuke32 on Windows; you may need to make adjustments for other games or operating systems.

Unpackaged mods

It's possible to test your mod without ever packaging it, by placing your files in a subdirectory alongside the EDuke32 executable.

Mod directory

First, create a new subdirectory alongside the EDuke32 executable, and name it mymod.

All of your mod's files will live here, including CON scripts, DEF files, maps, graphical and audio assets, and so on. You can name and organize these in subdirectories as you please, with only the following exception.

CON entrypoint

Next, create a CON script named eduke.con directly inside of the mymod directory and add the following line:

include game.con

The game.con here refers to a file in duke3d.grp, not a part of your mod. EDuke32 will automatically load eduke.con if present, or game.con if not. Since eduke.con is loaded in this case, we must load game.con ourselves.

DEF entrypoint

Now, create a file called mymod.def and leave it blank for now. This will contain any DEF_Language instructions your mod needs. In eduke.con, add the following line:

setdefname mymod.def

The setdefname command tells EDuke32 where to find your DEF file. Note that you could name it whatever you like or put it in a subdirectory and adjust the line above as necessary.

Episodes and levels

Finally, fire up Mapster32, create a quick map, and save it in mymod as mymap01.map. Add the following to eduke.con:

definevolumename 0 Episode One
definelevelname 0 0 mymap01.map 01:02 02:03 My Map One

The definevolumename command registers "Episode One" as the name of your first episode. The definelevelname command registers the path to the first map of the first episode, as well as target completion times and the name of the map.

Again, you could name the map whatever you like, or put it in a subdirectory, and adjust the line above as necessary.

Testing your mod

To launch the mod in its unpackaged form, simply run the following command:

eduke32 -j mymod

If you're not comfortable working from the command line, create a shortcut to eduke32.exe, right click it, select Properties, and edit the Target field to add -j at the end:

C:\path\to\eduke32.exe -j

You can now drag your mymod folder onto the shortcut to launch it. If you want the shortcut to be a dedicated launcher for your mod instead of having to drag the folder onto it, add mymod after the -j.

Packaging mods

The easy way

To package your mod, simply zip up the contents of mymod using a tool like 7-Zip. Be sure to zip up the contents rather than the directory itself; the zip file should not include a directory called mymod.

To test the packaged mod, simply drag the zip file onto the EDuke32 executable.

The Git way

Explaining version control is outside the scope of this tutorial, but if you're already using Git, you can use git-archive to package your mod:

# after committing everything...
git archive HEAD -o ../mymod.zip

This will keep Git's dotfiles from getting packaged, as well as anything listed in .gitignore or having the export-ignore attribute.