Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
fctorial

Question about wad format

Recommended Posts

This is the sequence of lump names:

 

 "PLAYPAL"
 "COLORMAP"
 "ENDOOM"
 "DEMO1"
 "DEMO2"
 "DEMO3"
 "E1M1"
 ... map specific data
 "E1M2"
 ... map specific data

 

Original doom identified map lumps by their names. How do the source ports identify map lumps, since they don't put any limitation on map name?

Is it by `0` size? Looking for names which aren't used by the engine?

Share this post


Link to post

That's not entirely correct but I'm not sure how you came to that conclusion from that wiki page, which looks all right to me.  The first lump of a map has to be the map slot tag, but WADs can contain other data than maps, hence the IWAD having other things in it.  ZDoom mods tend to put that other data in PK3 directories and use WAD format only for maps which may be the reason for the confusion?

Ports that allow map names outside of the E?M? or MAP?? style typically achieve that by having some sort of auxiliary map listing data, for ZDoom that's MAPINFO/ZMAPINFO.

Share this post


Link to post

I believe some ports also look for the required level lumps (THINGS, LINEDEFS, SIDEDEFS, VERTEXES, etc.), and once it finds these, it knows that the lump right before them is a map marker.  Or if not some ports, then at least that's how some editing programs find maps.

 

Regardless, each map has a set of these lumps, and between map markers, these are the only lumps allowed.

 

I've bold-ed the map markers here:

Spoiler

LEVEL42
THINGS
LINEDEFS
SIDEDEFS
VERTEXES
SEGS
SSECTORS
NODES
SECTORS
REJECT
BLOCKMAP
LEVEL69
THINGS
LINEDEFS
SIDEDEFS
VERTEXES
SEGS
SSECTORS
NODES
SECTORS
REJECT
BLOCKMAP

 

You can determine the map format as well.  Like if, while searching for map, you find BEHAVIOR in the block of expected lumps, it's probably a Hexen format map.

 

Also, offhand, not all map lumps (E1M1, MAP69, whatever) are necessarily 0 bytes in length, but the vast majority are.  A few ports store things in there, like I remember Doom Legacy stored FraggleScript data in those.

https://doomwiki.org/wiki/Lump

Share this post


Link to post
On 3/2/2020 at 12:28 PM, Remilia Scarlet said:

I believe some ports also look for the required level lumps (THINGS, LINEDEFS, SIDEDEFS, VERTEXES, etc.), and once it finds these, it knows that the lump right before them is a map marker.  Or if not some ports, then at least that's how some editing programs find maps.

sourceports aren't usually interested in getting a full set of "map definitions" from the wad. when the port needs to load a map, it looks for a lump with the given name (for advanced sourceport it can be any lump, thanks to MAPINFO), and then it checks if that lump is followed by the lumps you mentioned. they should come in a strict order, and without any other lumps inbetween.

Share this post


Link to post
On lundi 2 mars 2020 at 10:10 AM, fctorial said:

Original doom identified map lumps by their names. How do the source ports identify map lumps, since they don't put any limitation on map name?

Is it by `0` size? Looking for names which aren't used by the engine?

O size for the marker would not be a reliable way to detect maps. Three reasons:

  1. Hexen. If you have that game, open the IWAD and look. All the map markers have content. Not really useful content (it's just the string "version 2.3" which was presumably left there by their level editor; the game itself ignores it), but it gives them a non-zero size.
  2. FraggleScript. This is a scripting language that puts script data and map metadata in the marker lump. Any map with FraggleScript will have a non-zero size for its marker.
  3. Other markers. Namespaces are delimited with marker lumps like S_START or F_END. The IWADs also feature other such markers that are, technically speaking, not necessary, such as separating resources by episode (F1_START, P1_START, etc.) even though the engine will just ignore them. Assuming a zero-size lump is a map header will get you a lot of false positives.

Share this post


Link to post

ZDoom based ports identify maps by checking the lumps following the label.

For binary maps, THINGS, LINEDEFS, SIDEDEFS, VERTEXES and SECTORS need to be present. SEGS, SSECTORS, NODES, BLOCKMAP and REJECT are optional. BEHAVIOR is needed for Hexen maps and used as an identifier.

 

UDMF maps require TEXTMAP and ENDMAP to be recognized.

 

And like Ketmar said, identification is done when a map gets loaded, not at game start. BTW, Doom.exe just assumes that the map label is valid and loads the following lumps without checking their names. That led to a small number of old maps where some jokers renamed all content lumps to something nonsensical to prevent the maps from getting opened in an editor.

Share this post


Link to post
4 hours ago, Graf Zahl said:

BTW, Doom.exe just assumes that the map label is valid and loads the following lumps without checking their names. That led to a small number of old maps where some jokers renamed all content lumps to something nonsensical to prevent the maps from getting opened in an editor.

Huh, I didn't know this, but this is very good to know.  

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×