← MekEngine

Making MekEngine Mods

MekEngine mods replace the original game's data with files of your own. You don't need any tools or need to repack anything. A mod is a folder of loose files laid out like the game's data files, and MekEngine uses your file wherever the game would have used its own.

Mods work in every edition of MechWarrior 2 (DOS, Pentium, 3Dfx, Matrox, S3 Virge, ATI Rage, PowerVR, BattlePack…). You don't need to make a separate version for each one.

What can be modded today:

Other kinds of data (sounds, menu pictures, …) will follow the same folder and naming rules as support is added.

Coming soon: models. Models can't be replaced yet, but you can already dump the originals to a standard 3D format and start working (section 6).

Demonstration mods

Two small mods to try, or to pull apart and see how a mod is made:

ModWhat it doesDownload
MoonMusicThe menu music, recorded from the original MIDI scores on a late-1990s Roland Edirol sound module (96 kHz, 24-bit FLAC), looped where the original loops.MoonMusic.zip (226 MB)
GhostBear 2 MoonBunnyReplaces the Ghost Bear clan emblem with the MoonBunny emblem, a high-resolution image with transparency.GhostBear2MoonBunny.zip (439 KB)

Each zip contains a Mods folder. Extract it into the folder that holds MekEngine, so the mod lands in Mods next to the MekEngine folder. Then turn it on from Mods on the Choose Edition screen.

1. Where mods go

Mods live in a folder named Mods that sits next to the folder MekEngine is in:

SomeFolder/
  MekEngine/          <- the game (MekEngine.exe)
  Mods/               <- mods go here
    MyFirstMod/
    AnotherMod/
    loadorder.txt     <- written by the game; you don't need to touch it

Each mod is one folder inside Mods. The folder's name is the mod's ID.

2. Turning mods on and off

On the Choose Edition screen (the first screen at launch), click Mods.

Your choices are saved in Mods/loadorder.txt.

3. Anatomy of a mod

MyFirstMod/
  mod.txt                     <- optional: title and description
  DATABASE.MW2/               <- replacements for things in DATABASE.MW2
    43.flac
    43.loop.txt
  MW2.PRJ/                    <- replacements for things in MW2.PRJ
    CEL/
      L1GOSTBR.png

mod.txt

This file is optional. The first line is the mod's title and everything after it is the description shown in the Mods screen. If there's no mod.txt, the folder name is used as the title.

GhostBear 2 MoonBunny
Replaces the Ghost Bear clan emblem with the MoonBunny emblem.

Mirroring the game's data files

The game keeps its data in a few big files. Inside your mod, each data file becomes a folder with the same name, and things inside it are laid out the way the data file organizes them:

Game data fileFolder in your modWhat's inside it
MW2.PRJMW2.PRJ/one sub-folder per resource type (CEL, …), files named after the resource
DATABASE.MW2DATABASE.MW2/files named by item number (decimal)

Naming a replacement

Name a replacement after the original, then add your file's real extension. For example:

OriginalYour replacement
MW2.PRJ → CEL → L1GOSTBR.555MW2.PRJ/CEL/L1GOSTBR.555.png
DATABASE.MW2 item 43 (has no name)DATABASE.MW2/43.flac

Items in DATABASE.MW2 have no names, so they're named by their item number in plain decimal (43, not 0x2B).

MekEngine checks that your file is a format it can use for that thing. A file in a format it can't use is skipped, and a warning is written to the log.

Don't put two replacements for the same thing in one mod (e.g. both 43.flac and 43.wav). If you do, MekEngine uses whichever file it finds first. The load order decides between different mods, not within one.

Pointer files (share one file, save space)

A file named exactly like the original, with no extra extension, is a pointer. It's a plain text file holding a relative path to the real file:

MW2.PRJ/CEL/L2GOSTBR          <- text file containing:  L1GOSTBR.png
MW2.PRJ/CEL/L1GOSTBR.png      <- the real image

For things with no name (database items), the pointer is the bare number: a text file called 43.

Companion files

Some replacements can have a small companion file named <original>.<something>.txt, such as 43.loop.txt. Companions are never mistaken for replacements. A companion is only read from the same mod that supplied the replacement it belongs to.

4. Shell music

The music in the menus (the "shell") is MIDI stored in DATABASE.MW2. You can replace each song with a recording.

Formats: FLAC, WAV, OGG, MP3. Any sample rate or bit depth works. FLAC is recommended because it's lossless and about half the size of WAV.

Songs:

ItemUsed for
43every campaign, including Trials
44, 45, 46Clan Wolf
47, 48, 49Clan Jade Falcon
MyMusicMod/
  DATABASE.MW2/
    43.flac
    43.loop.txt     <- optional

The song behaves like the original: it loops forever, follows the music volume setting, and pauses when you switch to another program.

Looping: <item>.loop.txt

If there's no loop file, the whole recording loops, with a short 50 ms crossfade from its end back into its start.

For a seamless loop, add a loop file next to the song:

start=11.975
end=117.108

So the best recording is: the song from the very first note, played through past its loop point, with a few seconds of tail at the end. Then put the loop point in loop.txt.

Original loop points (in seconds from the first MIDI event):

Songstartend
43091.492
440124.667
450119.308
4611.975117.108
47093.600
48093.892
49086.400

These only apply if your recording follows the original MIDI timing exactly, starting the instant the first MIDI event plays. If you recorded a different arrangement, a different tempo or your own song, use your own times.

5. Textures

World, mech and building textures are CEL resources in MW2.PRJ. You can replace them with images.

Formats: PNG or TGA (raw or RLE; true-colour, greyscale or colour-mapped).

Where: MW2.PRJ/CEL/

Naming

Every edition names the same texture with a different extension:

EditionsOriginal name
DOS, Pentium, BattlePackA9BLAH01.XEL
3Dfx, Matrox, S3, ATIA9BLAH01.555
PowerVRA9BLAH01.SGL

You can name your replacement any of these ways. It's used in every edition whichever one you pick:

Any size, same shape on the model

A replacement is a drop-in: it always fills exactly the area the original covered on the model, whatever its size. A 1024×1024 image replacing a 64×32 texture is stretched to fill that 64×32 area, keeping its 2:1 shape on the model. It doesn't take a 64×32 corner out of your image.

So draw your image to the same aspect ratio as the original, at whatever resolution you like.

Replacements are drawn with smooth filtering (mipmaps, trilinear, anisotropic). The originals are drawn blocky.

Transparency

Your image's alpha channel is used as transparency. The engine dithers partial alpha, so soft edges come out as dithered coverage. Save as RGBA if you want any transparency. An image without alpha is fully opaque.

Paletted textures (.XEL.png)

If you name the file <name>.XEL.png (or .XEL.tga), the image is treated as paletted, the way the DOS editions' textures are:

MekEngine colours it with the same palette the original texture would get, including the darker palettes of night missions. A paletted replacement follows the mission's time of day; a full-colour one looks the same day and night.

Dumping the original textures

Start MekEngine with the -dumptextures switch to get every texture as a PNG:

bin\MekEngine.exe -dumptextures

(Or add -dumptextures to the target of a shortcut to MekEngine.exe.)

Pick an edition as usual. Before the intro plays, MekEngine writes all of that edition's textures to a TextureDump folder next to Mods. Then the game carries on normally. TextureDump is laid out exactly like a mod:

TextureDump/
  MW2.PRJ/
    CEL/
      L1GOSTBR.555.png
      L1GOSTBR.555.alpha.png
      ...

To use a dumped texture, copy it into your mod's MW2.PRJ/CEL/ folder and edit it. Paint at any resolution you like, as long as you keep the aspect ratio. Rename a .alpha.png file to drop the .alpha (for example L1GOSTBR.555.png, or just L1GOSTBR.png). Delete TextureDump when you're done; MekEngine doesn't read it.

Finding texture names

The easiest way is to dump the textures (above) and look through them. Otherwise:

Texture names are 8 characters, and many follow a pattern. For example, the clan emblems:

TextureClan
L1GOSTBR, L2GOSTBRGhost Bear (small, large)
L1WOLFCL, L2WOLFCLWolf
L1JADEFN, L2JADEFNJade Falcon
L1SMOJAG, L2SMOJAGSmoke Jaguar
L1STEELV, L2STEELVSteel Viper
L1NOVCAT, L2NOVCATNova Cat
L1DSHRK1Diamond Shark
L1INRSFR, L2INRSFRInner Sphere

Not yet replaceable: menu pictures, the mouse cursor, fonts, cockpit HUD art and videos.

6. Models (coming soon)

Model replacement mods aren't supported yet. The -dumpmeshes switch is available now so that artists can get to work early, and help shape how model support is built. If you start on a model, come talk about what you need from the importer on the Discord.

Dumping the original models

Start MekEngine with the -dumpmeshes switch:

bin\MekEngine.exe -dumpmeshes

(Or add -dumpmeshes to the target of a shortcut to MekEngine.exe. It can be used together with -dumptextures.)

Pick an edition as usual. Before the intro plays, MekEngine writes all of that edition's models to a MeshDump folder next to Mods. Then the game carries on normally. Like TextureDump, it's laid out like a mod:

MeshDump/
  DUPLICATES.txt        <- pieces shared by more than one model
  MW2.PRJ/
    BWD/
      <name>.glb        <- mechs, vehicles, turrets, doors, ...
    POLY/
      <name>.glb        <- buildings, props and other single shapes
    CEL/
      <name>.png        <- the textures the models use
      <name>.alpha.png

The models are glTF 2.0 (.glb), which most 3D programs can open. In Blender, use File → Import → glTF 2.0. The textures are separate PNGs that the models find through the CEL folder next to theirs, so keep the folders together when you copy them.

What's in a dumped model

Shared pieces: DUPLICATES.txt

Many models share pieces. For example, several mechs can use the same shape for a part. Each dumped .glb has its own copy, but in the original game it's one shape. DUPLICATES.txt lists each group of models and the pieces they all share.

Delete MeshDump when you're done; MekEngine doesn't read it.

7. Example: replacing a clan emblem

Mods/
  GhostBear2MoonBunny/
    mod.txt
    MW2.PRJ/
      CEL/
        L1GOSTBR.png      <- RGBA image, any size, square
        L2GOSTBR          <- pointer file containing: L1GOSTBR.png

mod.txt:

GhostBear 2 MoonBunny
Replaces the Ghost Bear clan emblem with the MoonBunny emblem.

Turn it on from Mods on the Choose Edition screen and start a Ghost Bear mission.

8. Example: a recorded soundtrack

Mods/
  MoonMusic/
    mod.txt
    DATABASE.MW2/
      43.flac   43.loop.txt
      44.flac   44.loop.txt
      ...
      46.flac   46.loop.txt     <- start=11.975 / end=117.108
      ...

9. Troubleshooting