Example

Raster Racing Game

7

nwallen 2020-10-25 17:13

Something I was working on but lost interest in.
Uses Raster line effects to simulate movement.

Inspired by onelonecoder Youtube channel's racing example.

Basics: On each frame X offsets and colors are calculated for each raster line and stored into an array. In the raster function just apply the values. Doing the calculations in the function were taking too long(cycles).
Road is loaded in from data.
I did not figure out how to do hills.

Very basic just car and road. No obstacles, no other cars, no timer.

Racing.nx | Open in app
2020-10-25 17:13

G-9 2020-10-25 18:33

Its nice, but why you did
GAMEPAD 2
Are you planning on 2 player mode ?


nwallen 2020-10-25 18:53

No actually. Was leftover code I was using game pad 2 for debugging/experimenting. Was using it to directly change the values of the raster lines using up/down to cycle through and left/right to change value. I needed to quickly check how the effect will look. Writing the code then playtesting was taking long.


was8bit 2020-10-26 03:23

Way cool :)


Timo 2020-10-26 19:43

Hills would be scrolling up and down, but it's probably more complicated to find values which look good. Actually lots of old racing games failed at it. I have Out Run for the Game Gear and the hills look really wrong.


nwallen 2020-10-27 12:19

I think to sell the illusion it takes a combination of moving the background up and down as well as moving sections(raster values) of the road as you go over the hill. And you are right it also takes playing with the values to look believable, the tutorials I found say that at the end.


nathanielbabiak 2021-01-06 05:11 (Edited)

Most raster racing games jump into graphics coding immediately, without appreciating (or perhaps understanding) the 3D projection math that allows the illusion to work. I think this is because true 3D projection math used too many clock cycles when raster racing games were popular in the 1970s and 80s. Thus the illusion was artistic by necessity, and there wasn't much written on the subject. (Or at least much that survived to the internet - I'm sure it's written in a book somewhere!) Then the industry turned to true 3D rendering, and the knowledge was lost. Here's a sampling showing low clock-cycle and/or artistic implementations, that ultimately harm the illusion for one reason or another:

I also found these, both by the same author, who seems to have followed a similar process to develop true 3D math, but isn't using a system with limits like LowRes NX:

I wasn't able to find any online source for the perspective-correct 3D projection math, but I was able to derive it myself. It's getting late though, I'll put up a forum post sometime later this week. :-)


nwallen 2021-01-06 18:18

"Thus the illusion was artistic by necessity," what I was going for lol. Started off by mirroring the "code it yourself" tutorial. Trying to get the feel of Poleposition/enduro on atari and Radracer on NES. The hills in RadRacer were not the most realistic but gave the feeling of going up and down a roller-coaster IMO.

"wasn't much written on the subject." yea I came across the same tutorials you have there. Seems like this skill was only necessary for a small part of gaming history. Even with OutRun etc Sega was using super scaler technology.


nathanielbabiak 2021-08-24 04:14 (Edited)

So I'm finally ready with that forum post I promised in January... took a bit longer than I thought it would. I've had the math done for EIGHT MONTHS now, just haven't had time to incorporate it into a fully-developed algorithm. It's here if you want to check it out.


Log in to reply.