[HN Gopher] Rustenstein 3D: Game programming like it's 1992
       ___________________________________________________________________
        
       Rustenstein 3D: Game programming like it's 1992
        
       Author : facundo_olano
       Score  : 158 points
       Date   : 2022-02-02 19:18 UTC (3 hours ago)
        
 (HTM) web link (tech.nextroll.com)
 (TXT) w3m dump (tech.nextroll.com)
        
       | gh123man wrote:
       | Ray casting is close to my heart as it's easy to understand and
       | has a very high "effort to reward" ratio, especially to someone
       | who is new to graphics programming. I built a game + engine
       | around ray casting portals [1] (think the game Portal). It was a
       | lot of fun trying to figure out how to bounce rays around a scene
       | and intersect with different objects in the environment and
       | immensely satisfying to have built the whole engine from the
       | ground up. Though I'd probably not do it again. Your top-down ray
       | debug view is very similar to one I came up with!
       | 
       | Some of the interesting bits of the engine are open source:
       | https://github.com/gh123man/Portal-Raycaster
       | 
       | 1. https://blog.sb1.io/gateescape/
        
       | dormando wrote:
       | Looks like the engine is missing the fish-eye correction in the
       | ray-cast calc. I love writing these engines for fun :)
        
       | ahuth wrote:
       | Adding my own raycasting implementation, in... what else...
       | React/JavaScript -> https://huth.me/raycast/
        
         | Koshkin wrote:
         | Need a map editor now :)
        
       | markus_zhang wrote:
       | I'm wondering if anyone develops a spinoff exactly as back in
       | 1992.
       | 
       | You know, it would be interesting to follow the Carmack's route:
       | start from Apple ][ programming for a couple of Ultima and
       | Wizardry spinoffs, port them to PC. Then move to 80286 to make a
       | scrolling engine for a double trilogy, and move up to 80386 to
       | make a Wolfie clone, and continue from there. The point is to use
       | real world machines or emulated env for development. One can
       | probably learn a LOT programming by that way, although much if it
       | is irrelevant in modern gamedev...
        
         | jacquesm wrote:
         | A simple raytracer is also a good step in that list.
        
           | pjmlp wrote:
           | Which in 1992 would mean getting acquainted with either MASM
           | or TASM.
        
             | jacquesm wrote:
             | I did it in '86 using a DSP32 :)
             | 
             | Patience... A couple of hours to render a simple scene at
             | 800x600, and displayed using dithering due to a lack of
             | colors in the palette. But it worked.
        
               | pjmlp wrote:
               | Uau, that is when I started in computing with a Timex
               | 2068, naturally ray tracing was not even on my radar at
               | the time.
               | 
               | Did it also do the classical line based rendering?
        
               | jacquesm wrote:
               | It was the most stupid and naive implementation possible,
               | classic reverse raytracing starting from a distance from
               | the center of the virtual camera plane and branching a
               | few times to get the basics of reflection and a light
               | model to work, then adding other features bit by bit. I
               | don't really remember all the details, but I do remember
               | that it was agonizingly slow on the CPU, the DSP made all
               | the difference and allowed me to add a couple of
               | features. The main loop was on every pixel of the virtual
               | camera plane. I no longer have that code (or the DSP, for
               | that matter) but it was a fun exercise and it taught me a
               | lot of matrix/vector math.
               | 
               | The dithering code was also interesting, because my
               | graphics card could not do true color I put 3x64 RGB
               | shades in the palette and then cranked up the brightness
               | for tetris like sets of pixels to simulate a true color
               | display. Worked pretty well.
               | 
               | This was the DSP board:
               | 
               | https://www.signalogic.com/images/Ariel_DSP32-PC.jpg
               | 
               | I managed to gently overclock it to 24 MHz without
               | problems, it did get a bit warmer but nothing too bad.
        
         | aninteger wrote:
         | Bonus points for using the same tooling and languages from then
         | too. 6502 assembly, then a bit of 16 bit x86 assembly, and
         | finally some C with Borland's 1992 tooling.
        
           | hnthrowaway0315 wrote:
           | Yeah definitely! Is there any modern tools that can 1) run on
           | native platform and 2) significantly improve dev experience?
           | I guess the guys who developed Nox Archaist used some modern
           | tools, and on DOS we might have something new because of a
           | large retro community.
           | 
           | The more I think about it, the more I believe if someone can
           | pull this off, although many skills learnt are useless in
           | modern programming (like 6502 asm or 80286 asm or whatever
           | tricks to get the games run smoothly on retro platforms), but
           | the amount of effort definitely would pay off.
           | 
           | I don't think one needs to walk the full Carmack road. I
           | think whoever goes from Shadowforge to Quake is impressive
           | enough. Plus one does not need to implement all these games,
           | many of them share similar engines.
           | 
           | (Bad formatting...)
           | 
           | June 22, 1996 Quake id Software GT Interactive Programming
           | 
           | May 31, 1996 Final Doom id Software GT Interactive
           | Programming
           | 
           | October 30, 1995 Hexen: Beyond Heretic Raven Software id
           | Software 3D engine
           | 
           | December 23, 1994 Heretic Raven Software id Software Engine
           | programmer
           | 
           | September 30, 1994 Doom II: Hell on Earth id Software GT
           | Interactive Programming
           | 
           | December 10, 1993 Doom id Software id Software Programming
           | 
           | 1993 Shadowcaster Raven Software Origin Systems 3D engine
           | 
           | September 18, 1992 Spear of Destiny id Software FormGen
           | Software engineer
           | 
           | May 5, 1992 Wolfenstein 3D id Software Apogee Software
           | Programming
           | 
           | 1991 Catacomb 3-D id Software Softdisk Programming
           | 
           | 1991 Commander Keen in Aliens Ate My Babysitter! id Software
           | FormGen Programming
           | 
           | December 15, 1991 Commander Keen in Goodbye, Galaxy! id
           | Software Apogee Software Programming
           | 
           | 1991 Commander Keen in Keen Dreams id Software Softdisk
           | Programming
           | 
           | 1991 Shadow Knights id Software Softdisk Design/programming
           | 
           | 1991 Rescue Rover 2 id Software Softdisk Programmer
           | 
           | 1991 Rescue Rover id Software Softdisk Programmer
           | 
           | 1991 Hovertank 3D id Software Softdisk Programming
           | 
           | 1991 Dangerous Dave in the Haunted Mansion id Software
           | Softdisk Programming
           | 
           | 1991 Dark Designs III: Retribution Softdisk Softdisk
           | Programmer/designer
           | 
           | December 14, 1990 Commander Keen in Invasion of the Vorticons
           | id Software Apogee Software Programming
           | 
           | 1990 Slordax: The Unknown Enemy Softdisk Softdisk Programming
           | 
           | 1990 Catacomb II Softdisk Softdisk Developer
           | 
           | 1990 Catacomb Softdisk Softdisk Programmer
           | 
           | 1990 Dark Designs II: Closing the Gate Softdisk Softdisk
           | Programmer/designer
           | 
           | 1990 Dark Designs: Grelminar's Staff John Carmack Softdisk
           | Developer
           | 
           | 1990 Tennis John Carmack Softdisk Developer
           | 
           | 1990 Wraith: The Devil's Demise John Carmack Nite Owl
           | Productions Developer
           | 
           | 1989 Shadowforge John Carmack Nite Owl Productions Developer
        
             | syngrog66 wrote:
             | thanks for reminding us: Carmack was a MACHINE in those
             | years. and churning out one impressive/hit game after
             | another
        
           | hnthrowaway0315 wrote:
           | Second thought, if one wants to develop DOOM as Carmack did,
           | he would need a NeXT workstation, might not be easy to come
           | by TBH, but maybe there is am emulator good enough.
        
           | syngrog66 wrote:
           | and hard-to-press keys. uppercase letters only. and you are
           | ONLY allowed to backup manually, and to 1.4Mb (or worse)
           | floppies
           | 
           | This is The Way
           | 
           | kids: off my lawn
        
       | nyanpasu64 wrote:
       | I wonder how practical it would be to create a Wolfenstein 2D
       | with the same level design, but played in top-down view.
        
         | syngrog66 wrote:
         | heresy!
         | 
         |  _cough_
         | 
         | Castle Wolfenstein, by Silas Warner for MUSE
         | 
         | kids: get off my lawn
        
         | facundo_olano wrote:
         | I had the same idea while working in this project. Either play
         | directly from the map view (the prototype sort of already does
         | this) or even use a rogue like ascii interface (which, yes,
         | would probably be similar to the Silas Warner game)
        
         | kibwen wrote:
         | Behold, Wolfenstein 1D!
         | https://www.youtube.com/watch?v=QSvECzuaYn0
        
       | fabiensanglard wrote:
       | That looks great. I actually wanted to do a port of an id game in
       | Rust for the longest time but never managed to find spare cycles.
       | 
       | I would add to the list of feature to tackle next:
       | 
       | - Convert from 320x200 aspect ratio to 320x240 aspect ratio. You
       | can do that by converting from 320x200 to 1600x1200. This is
       | easily done with x5/x6 which give you the same aspect ratio as
       | 320x240 and you get no pixel selection artifacts.
        
         | facundo_olano wrote:
         | Thanks for the suggestion, and for your book and your blog
         | posts, by the way, they are the main reason we thought about
         | tackling this project!
        
       | atum47 wrote:
       | I'm a sucker for wolf 3d technology... Great job!!!
        
       | pjmlp wrote:
       | I guess using Rust kind of fits the boots of Turbo Pascal for
       | 1992.
        
         | 10x-dev wrote:
         | Turbo Pascal is small, fast and has a clean syntax. Rust fits
         | in none of those shoes (yet, I suppose).
        
           | stjohnswarts wrote:
           | Rust isn't fast? O_O . The others I can see...
        
             | philipkglass wrote:
             | Turbo Pascal was famous for compiling projects quickly. The
             | current rustc compiler is not. The output of the rustc
             | compiler can be better optimized for run time than the
             | output of Turbo Pascal, though.
        
               | pjmlp wrote:
               | Yes, the compilation speed wasn't something I had on mind
               | when I made the remark, maybe I should have abstained to
               | play clever.
               | 
               | Anyway maybe when Cranelift gets more mature.
        
           | pjmlp wrote:
           | It fits on having a _var : type_ syntax, naturally it isn 't
           | Turbo Pascal 6.0 with the Turbo Vision IDE, given 1992.
           | 
           | I still hope that alternative backends like Cranelift will
           | fix the compilation speed.
        
       | filereaper wrote:
       | I'm guessing the infamous inverse square root algorithm was used
       | originally for ray-casting described in the article?
       | 
       | Fast Inverse Square Root:
       | https://news.ycombinator.com/item?id=24959157
       | 
       | Excellent article btw.
        
         | adamrezich wrote:
         | this project is a pseudo-remake of Wolfenstein 3-D; Fast
         | Inverse Square Root as we know it wasn't in an id game until
         | much later with Quake III Arena
        
         | AnIdiotOnTheNet wrote:
         | Fast inverse square root was part of the lighting calculations
         | in Quake III IIRC. Nothing so obtuse is required for the simple
         | ray-casting demonstrated here.
        
       | lkxijlewlf wrote:
       | Is there anything like this for Voxels (what's used in Roblox,
       | MineCraft,etc)?
        
         | dejv wrote:
         | There are few articles on 0fps blog:
         | https://0fps.net/2012/01/14/an-analysis-of-minecraft-like-en...
         | 
         | Readable implementation (in C) is this:
         | https://github.com/fogleman/Craft
        
         | ziggus wrote:
         | Isn't Minecraft a plain old polygon renderer?
        
           | jacquesm wrote:
           | Very large textured voxels!
        
       ___________________________________________________________________
       (page generated 2022-02-02 23:00 UTC)