Last week of my vacation. I made a little racing game for real-mode DOS that uses ray casting for rendering. There’s not a lot of game logic, except for lap timing and the tiles next to the walls have very high friction.

The tracks are procedurally generated. You can select one from the command line. (I love that concept very much.)

Getting the basic game done wasn’t too hard. I could reuse a lot of code from my little pool billiards game.

But … oh my goodness, the performance? The video was made on my Pentium 133, which is very powerful for the DOS era. And yet, it barely makes it above 25 FPS. I already used a couple of tricks (no floating point in some parts, try to keep an eye on cache locality, …) and I’ve passed on texturing the floor. The hot code paths are those that copy data in memory, like reading a pixel value for a texture and then copying it to the VGA buffer.

I’ve learned to appreciate games like Duke Nukem 3D a lot more now – how on earth can they be so fast? 🤯 I’ve got some homework to do …

https://movq.de/v/18f0d4be8d/MVI_6951.MOV.mp4

⤋ Read More