This commit is contained in:
Miloslav Ciz 2024-09-18 20:37:15 +02:00
parent d2cc338141
commit 8604bfc7c0
33 changed files with 1866 additions and 1824 deletions

View file

@ -40,6 +40,8 @@ The game only used [fixed point](fixed_point.md), no [float](float.md)!
The **Doom engine** (also called *id Tech 1*) was revolutionary and advanced (not only but especially) video game graphics by a great leap, considering its predecessor [Wolf3D](wolf3D.md) was really primitive in comparison (Doom basically set the direction for future trends in games such as driving the development of more and more powerful [GPUs](gpu.md) in a race for more and more impressive visuals). Doom used a technique called **[BSP rendering](bsp.md)** (levels were made of convex 2D sectors that were then placed in a BSP tree which helped quickly sort the walls for rendering front-to-back) that was able to render [realtime](realtime.md) 3D views of textured (all walls, floors and ceilings) environments with primitive lighting (per-sector plus diminishing lighting), enemies and items represented by 2D [billboards](billboard.md) ("[sprites](sprite.md)"). No [GPU](gpu.md) acceleration was used, graphics was rendered purely with [CPU](cpu.md) (so called [software rendering](sw_rendering.md), GPU rendering would come with Doom's successor [Quake](quake.md), and would also later be brought to Doom by newer community made engines, though the original always looks the best). This had its limitations, for example the camera could not look up and down, there could be no tilted walls and the levels could not have rooms above other rooms. The geometry of levels was only static, i.e. it could not change during play (only height of walls could), because rendering was dependent on precomputed BSP trees (which is what made it so fast). For these reasons some call Doom "[pseudo 3D](pseudo3d.md)" or 2.5D rather than "true 3D", some retards took this even as far as calling Doom 2D with its graphics being just an "illusion", as if literally every 3D graphics ever wasn't a mere illusion. Nevertheless, though with limitations, Doom did present 3D views and internally it did work with 3D coordinates (for example the player or projectiles have 2D position plus height coordinate), despite some dumb YouTube videos saying otherwise. For this reason we prefer to call Doom a **primitive 3D** engine, but 3D nonetheless. Other games later used the Doom engine, such as Heretic, Hexen and Strife. The Doom engine was similar to and competing with [Build](build_engine.md) engine that ran games like [Duke Nukem 3D](duke_3d.md), Blood and Shadow Warrior. All of these 90s shooters were amazing in their visuals and looked far better than any [modern](modern.md) shit. Build engine games had similar limitations to those of the Doom engine but would improve on them (e.g. faking looking up and down by camera tilting, which could in theory be done in Doom too, or allowing sloped floor and dynamic level geometry).
The game data is stored in so called **WAD files** (short for *where's all the data*). While many things are hardcoded in the engine, such as the total number of levels or types of weapons, most other things such as textures, levels, color palettes, weapons and enemy sprites are in the WAD files and so can be replaced without having to mess with the engine itself. There are two types of WAD files (both however still come with the same .wad extension, they are distinguished only by the file magic number): IWAD (internal WAD) and PWAD ([patch](patch.md) WAD). IWAD is the most important one, representing the base game, so for example Doom, Hexen and Freedoom will all have their own specific IWAD. Only one IWAD is loaded at any time. PWAD allows to add or modify things in the IWAD which makes it possible to easily correct bugs in the game data and make mods. Unlike with IWADs, multiple PWADs can be loaded at any time -- when loaded, a resource that's present in the PWAD will override the same resource in the base IWAD. All resources in the WAD files are stored as so called *lumps* which we may simply see as "blobs of data" or "files". A nice [CLI](cli.md) tool for working with WADs is e.g. [deutex](deutex.md).
Indexed ([palette](palette.md)) mode with "only" 256 colors was used for rendering. Precomputed color tables were used to make dimming of colors faster. Similarly a [look up table](lut.md) was used for [random number generation](rng.md) -- two independent [pseudorandom](pseudorandomness.md) generators are present, one is used for things such as visual effects while the other one is utilized purely for the game simulation so that it stays deterministic independently on graphics etc.
Doom also has a [deterministic](determinism.md) [FPS](fps.md)-independent physics which allows for efficient recording of [demos](demo.md) of its gameplay and creating [tool assisted speedruns](tas.md), i.e. the time step of game simulation is fixed (35 tics per second). Such demos can be played back in high quality while being minuscule in size and help us in many other ways, for example for verifying validity of [speedruns](speedrun.md). This is very nice and serves as an example of a well written engine (unlike later engines from the same creators, e.g. those of [Quake](quake.md) games which lacked this feature -- here we can see how things get progressively shittier in computer technology as we go forward in time).