Jump to content

DOOM Unity Port WAD Development and Information Guide


Arsinikk

Recommended Posts

Doom Unity Port WAD Development and Information Guide

 

 

What Is This Guide?

This is a WAD development and information guide that goes into the nitty gritty details on the features and limitations for creating and/or converting WADs for use in the Unity Port.

 

The main advantage of converting your already Vanilla / limit-removing supported WAD to the Unity Port is that it allows for the WAD to be played on consoles.

 

There doesn’t seem to be much documentation going fully in depth on how to convert / make WADs for the Unity Port and/or much information on the extra features that the Unity Port supplies map makers. The Unity Port can almost be seen as a Vanilla+ Port.

 

While not quite as fickle as Vanilla Doom can be, the Unity Port can be quite particular about how certain lumps are in the WAD, easily leading to a crash. This guide will hopefully help map makers learn more about the intricacies of the Unity Port and make their Unity conversion of WADs an easier process.

 

 

WAD Lump Order

Just like in Vanilla, it’s good to use a specific lump order to avoid the Unity Port (+ Vanilla Doom) from crashing. The following is the lump order that I use in my Unity supported WADs:

FF_START
[list of all new/replaced flats]
F_END
SS_START
[list of all replaced sprites]
S_END
[this is where I put all my graphics, DEMOs, Code lumps, TEXTURE1, PNAMES, Midis, and basically most other lumps]
PP_START
[list of all new/replaced patches]
PP_END
[MAP lumps go here]

Honestly the most important sections to be on the top are the FF_START….F_END, and SS_START….S_END. You can omit these sections if you do not have any new flats and/or sprites in your WAD.

 

In the section between S_END and PP_START, it really doesn’t matter what lumps you place there, as the Unity Port will only read lumps that it supports (i.e. TEXTURE1, PNAMES, TITLEPIC, DMAPINFO, etc.)

 

 

Replacing Sprites

In the original DOOM2.EXE, if you loaded a WAD replacing a sprite like TROOA1, it would actually crash Vanilla Doom. This is because for some reason if Vanilla Doom sees you replacing one sprite, it expects all of the sprites of Doom 2 to be replaced as well. Obviously we don’t wanna do that because of copyright infringement and WAD size bloat.

 

One of the ways Vanilla Doom mappers would get around this was by loading a DEHACKED file that actually replaced the sprite name with something else. Something like TROOA1 -> TROZA1. Unfortunately, the Unity Port does not support these DEHACKED sprite name entries.

 

So while the Unity port does not support the renaming of sprites, it actually does support just replacing sprites directly. So in your Unity version of the WAD, you can just use the TROOA1 sprite name and it will replace that sprite without crashing the Port.

 

 

Adding Widescreen Assets

One of the coolest new features for the Unity Port is the added support for Widescreen graphics. These can be backgrounds for the titlescreen, intermission, credits, and even the status bar.

 

Unfortunately the way that widescreen assets are implemented can be a bit confusing, especially with other modern source ports drawing them differently than the Unity Port.

 

Here’s a good graphic to explain how the Unity Port draws widescreen graphics:

unity-statusbar.png

 

It’s worth noting that some source ports just simply ignore status bar offsets and just centre it on the screen. This is actually how modern source ports draw widescreen background graphics, they completely ignore the graphics offsets and just vertically centre the background.

 

The Unity Port draws graphics differently. It instead draws background graphics from the top left corner of the screen following a 16:9 ratio.

 

unity-titlepic.png

 

DO NOT use graphics that are larger than a 16:9 ratio (426x200), or the Unity Port will crash. The same goes with the status bar; ONLY use a 16:9 ratio (426x32), else a crash will ensue.

 

 

DMAPINFO

DMAPINFO is actually one of the coolest new features that the Unity Port provides. It allows for you to control where certain maps go to and add extra secret maps. However, there’s also not alot of documentation on how certain things work (or don’t work).

 

I will pull some information from the DoomWiki page, but also add more info that currently isn’t present there:

 

DMAPINFO is cut up into 3 blocks: MAP, EPISODE, and ENDSEQUENCE.

 

Map Block

Map blocks defines a level in the game. Each map block has four required parts: a lump name, a display name, and valid mapnumber and episodenumber properties. All other fields are optional, and will fallback to vanilla behavior if not present.

map "<lump>" "<displayed name>"
{
    next = "<map lump>"
    secretnext = "<map lump>"
    par = <par time in seconds>
    music = "<music lump name>"
    episodenumber = <1-indexed episode number>
    mapnumber = <1-indexed map number within episode>
    endsequence = "<id of end sequence>"
    sky1 = "<sky lump name>", <sky scroll speed>
    map07special
}

 

- next:

  • When a level is completed, the next field tells the game which map to load next.
  • If not present, the game returns to the main menu. This is typically used on the last level of the episode, to end the game.
  • It’s worth noting that you can reference other maps in other episodes. Say you had a MAP03 with episodenumber = 1, and also a MAP36 with episodenumber = 2. You can have MAP03 go to MAP36 or vice versa with no problems.

 

- secretnext:

  • When a level is completed through a secret exit, the secretnext lump name is used to send the player to this level instead of the next one. If not present, the regular next map is used.
  • It’s worth noting that you can reference other maps in other episodes. Say you had a MAP36, with episodenumber = 2 and mapnumber = 3.Say you had a MAP03 with episodenumber = 1, and also a MAP36 with episodenumber = 2. You can have MAP03 go to MAP36 or vice versa with no problems.

 

- par:

  • Sets the par time of the level to be shown to the player, in seconds.

 

- music:

  • If set, use the music stored at this lump name instead of the default. Currently, music lumps must be in MUS or MIDI formats.

 

- episodenumber:

  • This is a required field, and allows the level select UI to attach a map to an episode in a defined order. The value is an integer, and corresponds to the defined episode.
  • If you are converting or have a normal Doom 2 megawad, all 32 maps should be in episodenumber = 1. This is so it can use the default Doom 2 text screens in between.
  • episodenumber = 2. should be used for extra maps not using the main Doom 2 episode format (i.e. text screens after completing MAP06, MAP10, MAP15 (secret), etc).
  • episodenumber is what the Unity Port uses when showing the episodes in the “new game” episode select screen.

 

- mapnumber:

  • This is a required field, and allows the level select UI to order the maps in a set order. The value is an integer.
  • This value does not have to be equivalent to the map lump name. For example, you can have MAP02 have mapnumber = 3 and MAP03 have mapnumber = 2. What this will do is reverse the order of the maps on the episode select screen.

 

- endsequence:

  • Play the end sequence with the given ID at the end of the level. After the sequence ends, the next or secretnext maps will be loaded next.
  • I highly suggest not using endsequence for normal Doom 2 WADs, as you can’t use a specific sequence for only a secret exit. (So it’s impossible to have a text screen only for MAP15 secret exit).
  • I suggest to not use endsequence at all for episodenumber = 1 if using the main Doom 2 episode structure. You can make custom text screens in the DEHACKED lump instead.
  • I would only suggest this for episodenumber = 2, or for custom episode structures without secret map text screens.

 

- sky1:

  • Override the sky with the specified sky lump.
  • You can also use an optional integer to set the speed of sky scrolling. Check out this example video.

 

- map07special:

  • Enables special sectors 666 and 667 to be active for this map when playing DOOM II WADs.
  • NOTE: this ONLY works in MAP07 specifically. Any other map that has this value in the MAP block will not use the map07special. IMO this makes this value kinda useless.

 

Episode Block

episode "<lump of first level>"
{
    name = "<displayed episode name>"
}

Episode sections are currently only used by the UI in order for level selection. No other properties except name are currently supported.

 

Endsequence Block

endsequence "<id>"
{
    text = "this is an example text"
    "This is how you do line breaks"
    ""
    "Fourth line"
    flat = "<lump of background flat>"
    music = "<music lump>"
}

Endsequence sections are used to override the built-in text screens, allowing map authors to place them after any map, with custom text, music, and textures. They are triggered after beating a map that has an endsequence option inside a map section.

 

I will repeat what I said earlier:

  • I highly suggest not using endsequence for normal Doom 2 WAD, as you can’t use a specific sequence for only a secret exit. (So it’s impossible to have a text screen only for MAP15 secret exit).
  • I suggest to not use endsequence at all for episodenumber = 1 if using the main Doom 2 episode structure. You can make custom text screens in the DEHACKED lump instead.
  • I would only suggest this for episodenumber = 2, or for custom episode structures without secret map text screens.

 

DMAPINFO Order / Format

From my testing the order of certain blocks in DMAPINFO matter alot, and if not put in the right order, can actually crash the Unity Port.

 

Here’s an example of a good formatted Doom 2 WAD DMAPINFO:

episode "MAP01"
{
	name = "200 Line Massacre"
}

map "MAP01" "[Redacted]"
{
	next = "MAP02"
	sky1 = "SKY1"
	music = "D_RUNNIN"
	par = 15
	episodenumber = 1
	mapnumber = 1
}

map "MAP02" "Halls of Eden"
{
	next = "MAP03"
	secretnext = “MAP36”
	sky1 = "SKY1"
	music = "D_STALKS"
	par = 30
	episodenumber = 1
	mapnumber = 2
}

......

map "MAP32" "Kitty"
{
	next = "MAP16"
	secretnext = "MAP16"
	sky1 = "SKY3"
	music = "D_ULTIMA"
	par = 140
	episodenumber = 1
	mapnumber = 32
}

episode "MAP33"
{
	name = "Credits + Bonus Zones"
}

map "MAP33" "Bonus Zone I"
{
	next = "MAP34"
	secretnext = "MAP34"
	sky1 = "SKY3"
	music = "D_BONUS1"
	par = 90
	episodenumber = 2
	mapnumber = 2
}

map "MAP34" "Credits"
{
	next = "MAP33"
	secretnext = "MAP35"
	sky1 = "SKY3"
	music = "D_CREDIT"
	par = 20
	episodenumber = 2
	mapnumber = 1
}

......

map "MAP36" “Bonus Zone III"
{
	next = "MAP03"
	secretnext = "MAP03"
	sky1 = "SKY3"
	music = "D_BONUS3"
	par = 20
	episodenumber = 2
	mapnumber = 4
}

......

 

It’s very important that you put the episode block before the map block that it’s referencing. Also it’s important to put the map blocks in order (MAP01, MAP02, ..., MAP35, MAP36), even if that’s not the same order as mapnumber.

 

Take a look at my example of MAP33 and MAP34. Note that MAP33 is actually mapnumber = 2, and MAP34 is mapnumber = 1. So MAP34 shows first in the episode select, but in the DMAPINFO, it’s after MAP33. If you put MAP34 before MAP33 in the DMAPINFO, it may result in a crash.

 

It’s worth noting that you can use next and secretnext to maps that are in a different episodenumber.

 

 

DEHACKED Support... Mostly

One of the coolest features of the Unity Port is that it mostly supports DehackEd. I will get into why I say “mostly” later. Vanilla Doom users used to have to use a separate program (DEHACKED.EXE) to create a special version of DOOM2.EXE (DOOMHACK.EXE) that applied DehackEd changes from a separate DehackEd file with the suffix .deh that came with the .wad.

 

The Unity Port simplifies this process by parsing the DEHACKED directly from an internal lump called DEHACKED included in the WAD file. It’s worth noting that you can’t load more than one file with the Unity Port, so if you want the DEHACKED to be read, you must include a DEHACKED lump in your WAD.

 

The DEHACKED parser is actually better than the DEHACKED.EXE parser, as it actually has the ability to skip certain lines it doesn’t understand, whereas DEHACKED.EXE would throw an error and be unable to compile a patched EXE if there was a line it didn’t understand.

 

While the DEHACKED parser is pretty good, there are also certain lines and/or functions it does not support, which I wanted to cover in this guide.

 

Thing Blocks

Here is an example of some DEHACKED thing code:

Thing 13 (Demon)
Hit points = 100
Gib health = -70
Exploding frame = 773
Speed = 12
Blood color = 0
Retro Bits = CASTSHADOW+CRUSHABLE+NOLIQUIDBOB+FOOTCLIP
#$Editor angled = true
#$Editor category = Monsters

Lines that the Unity Port will skip (i.e. not crash):

  • “Blood color”
  • “Retro Bits”

 

Lines that will crash the Unity Port:

  • “Gib health”
  • Any flag starting with “#$” usually being used for Ultimate Doom Builder

 

It’s sorta fine to keep in lines that the Unity DEHACKED port will skip, but if the port is crashing, it may be from a certain non-Vanilla DEHACKED line that it doesn’t support.

 

Frame and Pointer Blocks

From my testing, if you use Vanilla only codepointers and frame properties, the Unity port will not crash.

 

Weapon and Ammo Blocks

From my testing, weapon and ammo blocks will not crash the Unity port.

 

Misc 0 Block

The Misc 0 section will ALWAYS crash the Unity Port. I don’t know why it doesn’t support it, but if you have anything under this block, the Unity Port will crash when loading a map guaranteed.


dehacked-misc.png

 

Text Blocks

The Unity Port generally supports most of the text blocks such as story text, messages, text screen backgrounds, map names, even if the port doesn’t use all the Vanilla text blocks.

 

It is worth noting that if you use a certain trick that I use for maps above MAP32 to show automap names in Chocolate Doom, that these lines will crash the Unity Port (not immediately, but once you load a new map after the intermission):

Text 14 14
level 1: congoMAP33: Bonus I
Text 22 14
level 2: well of soulsMAP34: Credits
Text 14 15
level 3: aztecMAP35: Bonus II

 

Sprite Blocks

As said earlier, The Unity Port won’t crash if you include replacing sprite blocks:

Text 4 4
TROOTROZ

However, the Unity Port will skip over them and not read them.

 

Strings and Pars Blocks

The Unity Port will successfully skip over Boom [STRINGS] and [PARS] blocks, so it’s fine to keep them in the DEHACKED.

 

 

Map Format Compatibility

The Unity Port generally supports Vanilla maps, however there are a few things I’d like to cover. There are some interesting issues that can cause Vanilla maps to crash the Unity Port.

 

Stuff in maps that the Unity Port supports:

  • Just like in Vanilla, the Unity Port will ignore linedef actions that it doesn’t understand (i.e. MBF or Boom).

 

Stuff in maps that will crash the Unity Port:

  • The Unity Port will crash if a map includes linedefs that have no sector assigned to their front side.
  • If a map includes an unknown Thing ID, just like Vanilla, the Unity Port will crash. FYI You can reassign thing IDs via DEHACKED.

 

 

Conclusion and Links

Hopefully this guide will help anyone trying to make Unity Port versions of their WADs and troubleshoot issues that arise.

 

Check out some of my WADs with Unity Exclusive Versions:

 

Check out these threads for more Unity Compatible WADs:

 

If you found something that is incorrect, or have more to add to the guide, don’t hesitate to comment below!


 

Thanks for reading!

Arsinikk

 

Arsinikk Profile Icon

Edited by Arsinikk

Share this post


Link to post
5 minutes ago, Arsinikk said:

Stuff in maps that will crash the Unity Port:

  • The Unity Port will crash if a map includes linedefs that have no sector assigned to their front side.
  • If a map includes an unknown Thing ID, just like Vanilla, the Unity Port will crash. FYI You can reassign thing IDs via DEHACKED.

 

Is this why Perditions Gate/Hell to Pay/Eternal Doom don't work?

 

Thanks for looking into all this btw. For a while it seemed I was the only one trying to understand the port, and im far from knowledgeable about all of Doom's limits and mechanics.

 

Did you actually get Map 33 onwards to work? Nothing I ever did got them to work, resulting in some hackery by utilising 'ML1 to 'ML21' to get extra maps working. In Ultimate doom, I found that any map outside of E1M1 to E4M9 would load, but crash the port upon hitting an exit switch, no matter the formatting.

Share this post


Link to post
On 12/7/2022 at 9:30 PM, Devalaous said:

Is this why Perditions Gate/Hell to Pay/Eternal Doom don't work?

Possibly, I'd have to look at the maps to see. I do know that Eternal Doom did some weird tricks with linedefs and alot of self-referencing sectors. But tbh alot of my maps from 100/200 Line Massacre use alot of fancy vanilla tricks / self-referencing sectors and they work in the Unity port, so I'm not sure.

 

I did find that Unity is very strict on TITLEPIC, INTERPIC, and STBAR sizes. If your graphics are not exact, it can easily crash. Same goes for DMAPINFO and DehackEd.

 

On 12/7/2022 at 9:30 PM, Devalaous said:

Thanks for looking into all this btw. For a while it seemed I was the only one trying to understand the port, and im far from knowledgeable about all of Doom's limits and mechanics.

Tbh I was annoyed about the lack of documentation about the intricacies surrounding the Unity Port, and since I work with making compatible versions often, I thought I'd whip up what I know about it here :)

 

On 12/7/2022 at 9:30 PM, Devalaous said:

Did you actually get Map 33 onwards to work? Nothing I ever did got them to work, resulting in some hackery by utilising 'ML1 to 'ML21' to get extra maps working.

I did, DMAPINFO can be a bit tricky. The Unity port really doesn't like when the DMAPINFO isn't in a very specific format. Tbh, your conversion of Memento Mori II was quite useful in me figuring out how to get a second episode working well in DMAPINFO.

 

You can take a look at both 100 Line Massacre and 200 Line Massacre's DMAPINFO. Both of them use MAP33+ maps. 100lnm's second episode is more normal, whereas 200lnm's second episode is more bizarre.

 

Obviously you probably know that there's no way to force maps to use new CWILV graphics past MAP32.

 

On 12/7/2022 at 9:30 PM, Devalaous said:

In Ultimate doom, I found that any map outside of E1M1 to E4M9 would load, but crash the port upon hitting an exit switch, no matter the formatting.

I have not tried doing any DMAPINFO for any Doom 1 mapsets, so I can't really comment on this :/

Edited by Arsinikk

Share this post


Link to post

Very strange. Your DMAPINFO for 200 Lines Massacre looks no different than what I originally had for Memento Mori 2, Alien Vendetta and D2TWID, yet Map 33 onwards shows up, and apparantly you got the secret exits working. For me, Map 33 has never once showed up on the episode selection, and any attempt to access a Map 33 has crashed. Even when utilising the ML1 trick, Hexsoil was never reachable via an exit switch, nor could it transition back to MAP03. Similarly I could not integrate Valley of Echoes into the regular progression, nor could I emulate MM2's Secret Operations original behaviour of going to MAP03 once the two extra maps were done. I would try again to see if things can be more 'accurate' but ive screamed at SLADE enough with those unofficial add-ons; they work as they are and ive gotten no complaints over bugs, so eh.

 

The only real use I would have for Doom 1 having the extra map slots working, would be to have Death Tormention Trilogy and 2002 ADO having all maps, instead of cutting some out. Episode 5 wont have an intermission screen anyway, it appeared once in DTWID Lost Episodes testing, and it was a black void.

Share this post


Link to post

This is massively helpful, thank you! I too have been frustrated by the lack of available documentation, and some of the stuff in here will be a great resource. If I find anything additional while messing around with the port, I'll be sure to share it here!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...