Reality Engine map format

From DoomWiki.org

Revision as of 03:20, 24 July 2022 by Quasar (talk | contribs) (Flag values: Probably more accurate)


The map format used by the Reality Engine to implement the Super Nintendo version of Doom is custom and is created by running a converter program on a vanilla Doom map, implemented as a Motorola 68K assembly program for the Amiga system. The primary source code file for this conversion routine can be found in the DOOM-FX GitHub repository and is named ripdoom3.asm. Certain preparations must be made to the map beforehand, such as removing two-sided linedefs with middle textures and (optionally) replacing them with solid blocking geometry, as the Reality Engine does not support such. Other elements, such as unsupported thing types, are filtered out or remapped dynamically by the converter tool. The results of the tool are stored in 15 separate files, which are linked into the ROM directly as data and addressed using various disparate lookup tables.

This format documentation is not yet complete.

Equivalents to Doom lumps

RL file Doom lump
AREAS SSECTORS
BLOCKMAP BLOCKMAP
BSP NODES
CEILINGS -
DOORS -
FACES SIDEDEFS
FLOORS -
LIFTS -
LINES LINEDEFS
OBJECTS THINGS
REJECT REJECT
SECTORS SECTORS
SEGS SEGS
STAIRS -
VERTEXES VERTEXES

LINES

Offset Size (bytes) C99 type Description
0 2 uint16_t First vertex
2 2 uint16_t Second vertex
4 2 uint16_t Flags
6 2 int16_t Angle[lines 1]
8 2 - Unknown
10 1 uint8_t Action
11 1 uint8_t Tag
  1. Angles are stored as 16-bit BAMs, with 0 being east, 0x4000 being north, etc.

Flag values

Source name Purpose Hexadecimal
rllfSolid Blocks movement 0x0001
rllfMapped Seen on automap 0x0002
rllfUsed Line has been used 0x0004
rllfSecret Looks solid on automap 0x0008
rllfDoor Line is a door 0x0010
rllfDontDraw Invisible on automap 0x0020
rllfFloorH Floor height changes 0x0100
rllfCeilingH Ceiling height changes 0x0200
rllfTrigger Line is a trigger 0x0400
rllfUsable Line is usable 0x0800
rllfTriggerE Enemies can trigger 0x1000
rllfUsableE Enemies can use 0x2000
rllfItem Line is "item" (unknown) 0x8000

OBJECTS

Objects are a variable-length record. The angle field is only present for "angular" object types, which includes player starts, deathmatch starts, and teleport destinations.

Offset Size (bytes) C99 type Description
0 1 uint8_t Flags
1 1 uint8_t Type
2 2 int16_t x position
4 2 int16_t y position
2 2 uint16_t Angle[things 1]
  1. Angles are stored as 16-bit BAMs, with 0 being east, 0x4000 being north, etc. The angle is only present if type has a value between 0 and 5.

Flag values

Source name Purpose Hexadecimal
rlpfSkill12 Present on easy skills 0x01
rlpfSkill3 Present on medium skill 0x02
rlpfSkill45 Present on hard skills 0x04
rlpfMultiPlayer Present in multiplayer 0x10
rlpfMovable Object can move 0x40
rlpfActive Object is present in gamesim 0x80

Object types

The following are valid values for the type field. Note that multiple Doom thing types can be converted into the same object type, as fewer types are supported in the Reality Engine.

Value Source name Corresponding DoomEd numbers
0 Player1Start 1
1 Player2Start 2
2 Player3Start 3
3 Player4Start 4
4 DeathMatchStart 11
5 TeleportSpot 14
6 Soldier 3004
7 Sergeant 9
8 Trooper 3001
9 Demon 3002, 58
10 CacoDemon 3005
11 LostSoul 3006
12 BaronOfHell 3003
13 CyberDemon 16
14 SpiderDemon 7
15 ShotGun 2001
16 ChainSaw 2005
17 ChainGun 2002
18 RocketLauncher 2003
19 PlasmaGun 2004
20 BFG9000 2006
21 RedKeyCard 13
22 BlueKeyCard 5
23 YellowKeyCard 6
24 RedSkullKey 38
25 YellowSkullKey 39
26 BlueSkullKey 40
27 BackPack 8
28 Clip 2007
29 AmmoBox 2048
30 Shells 2008
31 ShellsBox 2049
32 Rocket 2010
33 RocketBox 2046
34 Cell 2047
35 CellPack 17
36 StimPak 2011
37 Medikit 2012
38 HealthBonus 2014
39 ArmorBonus 2015
40 ArmorGreen 2018
41 ArmorBlue 2019
42 SoulSphere 2013
43 Invulnerable 2022
44 Berserk 2023
45 Invisible 2024
46 RadiationSuit 2025
47 ComputerMap 2026
48 LightGoggles 2045
49 Barrel 2035
50 FloorLamp 2028
51 BloodyMess 10, 12, 15, 18, 19
52 DeadTrooper 20
53 DeadDemon 21
54 SkullOnPole 28
55 PillarShortGreen 30, 31, 32, 33, 36, 37
56 Candle 34
57 Candelabra 35
58 FlamingSkullRock 42
59 TreeGray 43
60 FireStickTallRed 44, 45, 46
61 ShrubBrown 47
62 ColumnTechTall 48
63 FireStickShortBlue 55, 56, 57

VERTEXES

The RL vertex format is the same as the vanilla Doom vertex format.

Offset Size (bytes) C99 type Description
0 2 int16_t x position
2 2 int16_t y position