Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Danny Kurniawan

How to draw roads in old racing games

This topic is 6081 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there anybody knows how to draw roads in older racing games like in "Top Racer" SNES game?? I know this is old tehnique but I can''t find anyone who could explain to me how to draw those roads... If anyone knows please tell me or may be you can tell me where I can find such algorithm... thx

Share this post

Link to post
Share on other sites
I don''t know about this either, but I''ll give you some of my thoughts...

Only half of the screen is filled with the road. Think of the road as the pixel scanlines it''s built out of. If the road starts to turn, you skew the scanlines to the left or the right depending on where the road is turning.

The farther away a scanline is (the higher on the screen it is), the more you skew it. I don''t know the correct algorithm for how much to skew each scanline, but try this one:


// How many pixels to skew for each line

skewing_distance = turning_amount;

// Loop from bottom to middle of screen

for (i = 0; i < screenHeight/2; i++) {

// Where to skew?

if (turning == NONE) currentSkew = 0;
if (turning == RIGHT) currentSkew = screenHeight/2 - i;
if (turning == LEFT) currentSkew = -(screenHeight/2 - i);

// How much to skew?

currentSkew *= skewing_distance;

// Copy displaced scanline

copy(display, scanLines[i * scanLineWidth] + currentSkew, scanLineWidth);

To complicate the whole thing, you might want to make artificial slopes, by lowering the horizont... But that''s up to you

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!