Posted October 25, 2025 by ViciousGames
#doom #procedural generation #gzdoom
This is a post describing how random Doom generator works.....
The core of Random Doom generator is a Zdoom format level with a grid arrangement of sectors that are all tagged from 1-60. Others are added to form a big cross shaped player area with another 1-60 in each quadrant of the cross... Each grid square is 64x64 units, the width of a thin door in doom. Each line is tagged with a line identification linedef type to mark it with a line tag. Only lines not tagged are door tags, non walls that never texture change (like supports, doors, door sides, door tracks, outdoor area lines, etc). When this map is made it is a big empty space with default doom builder textures, so how does the mod actually procedurally generate levels?
ACS scripting is the answer...
I am a programming whiz, so making scripting to actually alter heights of sectors, textures on walls, enemy placement, etc was somewhat easy but time consuming... Each sector in the script that raises sectors to the ceilings to form walls, is chosen randomly 5-6 times in a row. This makes randomized walls when used right.. Another 2 are used to raise sectors to 64 units to form higher but not to the ceiling height walls... these are also chosen randomly...
Another script randomly assigns texture to texture themes, a normal texture and a special one... Another script retextures every line that are solid with one texture. The first texture script applies textures to lower textures of lines that are on surfaces that raise up to form walls or higher areas. One side gets the normal texture, the other gets the special texture.
Another script increments a difficulty variable by 1 if a random number from 1 to 50 is less than 25. This difficulty variable is then is used to determine where to spawn enemies and what types are used. Each difficulty puts in certain enemies and that list varies drastically from difficulty to difficulty to form the difficulties meantioned in the main page text on itch.
The exit teleports teleport the player back to the same map.... This makes a different level, because the random numbers for texture choices, wall placement, heights, enemy placement will re-roll and make a different level. THAT's how it does infinite levels!
Things like weapon placement are done in the editor, so are detailing, etc... However ammo placement is randomized by a script that spawns ammo randomly putting different ammo types in different places each level. All ammo and weapons are spawned in all levels to balance it out. It makes maps too easy too early but later on it is worth it to make that happen, as slaughtermaps appear.