How did f-1 Race work?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

DementedPurple
Posts: 318
Joined: Mon Jan 30, 2017 5:20 pm
Location: Colorado USA

How did f-1 Race work?

Post by DementedPurple » Sat Apr 22, 2017 3:16 pm

I'm really curious how they were able to pull of the 3d graphics in f-1 race on the NES. It's rather impressive how they did the turns on the road. How did they do it?

tepples
Posts: 21946
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How did f-1 Race work?

Post by tepples » Sat Apr 22, 2017 3:22 pm

Pole Position works by drawing the road as a triangle toward a vanishing point on the horizon, then scrolling each individual scanline of the road to warp that triangle. The road in F-1 Race is drawn the same way, as is the floor in Street Fighter II and NBA Jam. Rad Racer additionally vertically squashes and stretches parts of the triangle to simulate hills.

adam_smasher
Posts: 271
Joined: Sun Mar 27, 2011 10:49 am
Location: Seattle

Re: How did f-1 Race work?

Post by adam_smasher » Sat Apr 22, 2017 3:41 pm

This page is a good reference on the technique.

User avatar
rainwarrior
Posts: 7804
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How did f-1 Race work?

Post by rainwarrior » Sat Apr 22, 2017 7:45 pm

Here's some info on Rad Racer I posted a few years ago:
https://forums.nesdev.com/viewtopic.php?f=2&t=8588

DementedPurple
Posts: 318
Joined: Mon Jan 30, 2017 5:20 pm
Location: Colorado USA

Re: How did f-1 Race work?

Post by DementedPurple » Wed Apr 26, 2017 7:39 am

Wait, with CHR-RAM couldn't you render 3d polygons? (With crappy frame rate)

User avatar
tokumaru
Posts: 11646
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: How did f-1 Race work?

Post by tokumaru » Wed Apr 26, 2017 7:42 am

DementedPurple wrote:Wait, with CHR-RAM couldn't you render 3d polygons?
Yes.
(With crappy frame rate)
Which's why nobody did it.

DementedPurple
Posts: 318
Joined: Mon Jan 30, 2017 5:20 pm
Location: Colorado USA

Re: How did f-1 Race work?

Post by DementedPurple » Wed Apr 26, 2017 7:47 am

Isn't that how they did FaceBall 2000 on the GameBoy?

tepples
Posts: 21946
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How did f-1 Race work?

Post by tepples » Wed Apr 26, 2017 8:11 am

And how Elite for PAL NES works.

But Game Boy also has a fairly long horizontal blanking period when VRAM can be written.

User avatar
tokumaru
Posts: 11646
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: How did f-1 Race work?

Post by tokumaru » Wed Apr 26, 2017 8:19 am

I don't know, but the Game Boy is better at dynamic patterns than the NES. The patterns are not in a separate bus, for one, and since the screen is smaller, less patterns are needed to cover the same percentage of screen space. The small resolution also means that there's more time every frame to manipulate patterns. Even with all these advantages, FaceBall is still annoyingly slow.

The NES just wasn't built for real-time 3D polygons, and most developers stuck with using the regular features of the system. The NES did see some attempts at real-time polygon graphics, like in Elite, but IIRC that was PAL only, only drew wireframes, and was still fairly slow.

User avatar
zeroone
Posts: 932
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: How did f-1 Race work?

Post by zeroone » Wed Apr 26, 2017 1:01 pm

I understand road drawing algorithm for F-1 Race, but how exactly did Elite work?

lidnariq
Posts: 9301
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: How did f-1 Race work?

Post by lidnariq » Wed Apr 26, 2017 1:12 pm

Elite is actually doing 3D projection, line drawing, and hidden line removal.

User avatar
zeroone
Posts: 932
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: How did f-1 Race work?

Post by zeroone » Wed Apr 26, 2017 1:29 pm

lidnariq wrote:Elite is actually doing 3D projection, line drawing, and hidden line removal.
How does it render the lines?

User avatar
Memblers
Site Admin
Posts: 3820
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: How did f-1 Race work?

Post by Memblers » Wed Apr 26, 2017 5:49 pm

zeroone wrote:
lidnariq wrote:Elite is actually doing 3D projection, line drawing, and hidden line removal.
How does it render the lines?
Writes them into CHR-RAM and maps them into the nametables somehow.. I still think that game is impressive as hell. I don't know how well it runs on a PAL NES, but I remember playing it on NESticle long ago and I thought the performance was just fine (though I was probably speeding up the emulated CPU or something).

One of the authors of the Elite made an NES demo with similar graphics, and he also released the source code.
http://www.iancgbell.clara.net/nestank/
I remember looking at it when I was first learning to program, and I couldn't make any sense out of it at all. Maybe I'd do a little better now but I'm still horrible at math.

User avatar
zeroone
Posts: 932
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: How did f-1 Race work?

Post by zeroone » Fri Apr 28, 2017 8:14 am

Memblers wrote:Writes them into CHR-RAM and maps them into the nametables somehow.. I still think that game is impressive as hell.
Here's my guess (without doing any research; so, it might be completely wrong):

They created a frame buffer in RAM with a bit depth of 1; i.e. each byte represents 8 pixels. To display the frame buffer, they created 256 tiles, such that each row of every tile are colored per the binary representation of that tile index; meaning, the tiles look like colored vertical lines since the same colored row is repeated 8 times. Finally, during horizontal blanking (PPU dots > 255), the nametables are updated for each successive row.

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: How did f-1 Race work?

Post by thefox » Fri Apr 28, 2017 10:35 am

zeroone wrote:Here's my guess (without doing any research; so, it might be completely wrong): ...
It is.

I believe Elite draws the lines in CHR-RAM, allocates the tiles dynamically (i.e., only the tiles that have non-empty CHR data will have non-zero nametable entries), and uses palette switching to get double buffering.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

Post Reply