This is taking a lot of inspiration from Doom, but the actual raycasting engine is more like Doom's predecessors, the most well-known of which is probably Wolfenstein 3D: perpendicular walls, constant floor and ceiling height. Wolf3D didn't have textured floors and ceilings because of performance reasons, but several other similar games had them. Doom and IIRC Duke Nukem as well used a BSP engine which was much more…
Later on, in Shadow Warrior, you could even do that, i think they used portals to implement it and i remeber it was a pain to set up in the editor.
Making Graphics Like it's 1993
141–150 of 169 posts
Re: Making Graphics Like it's 1993
#142It's sad. That's why I never finished playing Wolfenstein 3D - it looks too boring. In the other hand I enjoy playing Doom, mods for it and games using its engine.
I hope the author can still add some improvements to allow such boring look typical for raycaster engines.
Re: Making Graphics Like it's 1993
#143I suggest to use not only darker variants, but also brighter ones - for bright map areas and maybe for some lighting effects like flashlight.
Re: Making Graphics Like it's 1993
#144I don't think someone used this approach in 1993. Textures were drawn by hand. But I think it's still fine to use such modern way of generating textures, since it may produce better-looking result.
Re: Making Graphics Like it's 1993
#145Earlier quoted context omitted.
I'd be surprised if the compiler didn't make that optimisation on its own.
Possibly, but always check the assembly. The even faster version, opts aside, would be to initialize the pointer at y*screenRect.w and ++ at every loop to avoid the addressing arithmetic.
Take a look, GCC and Clang go further than these suggestions by adding screenRect.w to the pointer each iteration to avoid the multiplication: https://godbolt.org/z/YfroqK7T6
Writing anything but pixels[y*screenRect.w + x] in an attempt to be faster, without checking the assembly first, is obfuscation.
(For what it's worth, you can beat the compiler by using *pixels++. I didn't profile the code to check it actually was faster in practice however.)
Re: Making Graphics Like it's 1993
#146Re: Making Graphics Like it's 1993
#147But what really stood out to me is this line.
> a linear frame buffer where each pixel was represented by a single byte indexing into a palette of 256 colors.
Of course this is nothing new, but it just really struck me because I've been working on a blog post about texture representation on modern consoles and it is crazy how complex it has gotten: texture tiles, block compression, non-linear texel ordering (e.g. Morton order), ...
Re: Making Graphics Like it's 1993
#148Earlier quoted context omitted.
The funny thing is that looking backwards, I would never use a grid of squares for a raycaster like wolfenstein3d did. If I were to do a raycaster today, I would use convex sectors with portals, basically like duke nukem, but constant wall heights. You can do drawing very simply by just doing a linear pass across the sector, recursively stepping into other sectors. Then you can at least do arbitrary level geometries.
A grid of squares makes sense for the target hardware at the time though (286 or better CPU)
Btw, 286 played wolfenstein rather poorly. The 386 is rather more appropriate.
Wolfenstein was built in a couple of months by a then 21-year-old Carmack. He didn't focus on optimizing levels until Doom.
Re: Making Graphics Like it's 1993
#149Earlier quoted context omitted.
That would only be true if a row (by which I mean a scanline) would be equidistant in view-space depth across its whole length, which is not quite true. While a column of pixels for a wall is (as long as you dont tilt the camera).
The code exists! https://github.com/id-Software/DOOM/blob/master/linuxdoom-1.... And it looks to me like we are mapping each row with a constant y, calculating the "distance" (thus scale factor) only once using just the vertical slope for the row.
Re: Making Graphics Like it's 1993
#150This is taking a lot of inspiration from Doom, but the actual raycasting engine is more like Doom's predecessors, the most well-known of which is probably Wolfenstein 3D: perpendicular walls, constant floor and ceiling height. Wolf3D didn't have textured floors and ceilings because of performance reasons, but several other similar games had them. Doom and IIRC Duke Nukem as well used a BSP engine which was much more…
> Duke Nukem as well used a BSP engine The Build engine didn't use BSP, it treated connections between sectors as portals and rasterized the walls as (90 degree rotated) trapezoids while performing clipping against those portals. This allowed it to have dynamic wall geometry (e.g. moving trains, rotating light fixtures, etc) as well as "room-over-room" setups as long as you couldn't see both rooms at the same time (i…