Skip to content

Modding support

Nikolai Wuttke edited this page May 24, 2021 · 19 revisions

Like the original DOS executable, Rigel Engine supports replacing individual files from the game's data pack file (NUKEM2.CMP) with external files. For example, when a file called L1.MNI is found next to the .CMP file, it will be used instead of the version found inside the .CMP. This makes it possible to use existing patches and mods, like the sunglasses patch.

On top of this, Rigel Engine features enhanced modding support: Sprites, tile sets, backdrops, sound effects, and music can be replaced with files in modern formats. The game looks for replacement files in a folder called asset_replacements next to the .CMP file. For each file that's found in that folder, the game will load that file instead of the version in the original game data.

Type Naming scheme Supported formats Notes
Tile sets tileset<N>.png PNG <N> must match the (hexadecimal) number of the tileset to be replaced. E.g. tileset2.png to replace CZONE2.MNI, tilesetA.png to replace CZONEA.MNI, etc.
Backdrops backdrop<N>.png PNG Just like with tile sets, backdrop1.png replaces DROP1.MNI etc.
Sprites actor<N>_frame<F>.png PNG <N> is the actor ID and <F> is the animation frame. For example, the blue guard enemy has ID 159. To replace all animation frames of that sprite, files named actor159_frame0.png up to actor159_frame12.png should be provided.
Sound effects sound<N>.wav Wave <N> is the sound effect number, starting at 1.
Music see notes Ogg, Mp3, Flac, Opus, Wave, various module formats To replace music, the filename needs to match the name of the game's original music file, but with one of the supported formats' extensions instead of IMF. E.g. kickbuta.mp3 to replace KICKBUTA.IMF. A variety of file formats is supported, essentially any format supported by the SDL_mixer library. This includes tracker module formats supported by ModPlug.

Notes on image size and aspect ratio

Replacement graphics have no restrictions w.r.t. color, the full RGB spectrum can be used. Files can contain an alpha channel, and will be rendered accordingly. Replacement graphics can either match the resolution of the original graphics, or be higher resolution. The only requirement for high-res replacement files is that the size is an integer multiple of the original size, otherwise the result will look incorrect. This means that e.g. double or triple resolution is fine, but 2.5x is not.

The original game's art assets appear as 16:10 aspect ratio when rendering with square pixels, but will be stretched vertically to appear as 4:3 (non-square pixels). This was how the original game ran on period-appropriate CRT monitors, and RigelEngine reproduces this by stretching graphics accordingly. If you want your replacement graphics to be rendered without this vertical stretching, you can choose appropriate sizes that don't need to be stretched.

For example, let's say we want to replace one of the backdrops. The original art is in 320x200. If we replace with a graphic where the size was scaled by the same amount along both axes, like 640x400, the replacement will be stretched vertically. But if we use a 4:3 replacement like e.g. 640x480, 1280x960, or similar, there is no stretching, and the aspect ratio of our replacement art will be preserved.

If you want to up-scale the original art to use as a basis for a high-res replacement graphic, I recommend scaling by 5 horizontally and by 6 vertically. This gives you a higher res 4:3 equivalent to the original graphic without introducing any artifacts, since both axes are scaled by integer multiples.