PiFox: bare-metal ARM assembly language Star Fox

Here’s something rather special, which should resonate with those of you over a certain age.

PiFox

Star Fox was a Nintendo game for the SNES, released back in 1993 with fast, 3D gameplay – the player travels at high speed along a bounded path, avoiding and shooting obstacles and enemies, while picking up power-ups. Those obstacles were filled 3D polygons, which was very unusual at the time (and hard to render).

At the start of the week, I was sent this video. It’s from a group of first-year undergraduates (first-year undergraduates!) at Imperial College in London, who wrote a version of Star Fox from scratch for the Pi, in 5900 lines of ARM assembly language. This is so good that when Lance saw it, his immediate reaction was that it must be a port. It’s not.

They’ve got everything you need in under 6000 lines: a rasteriser in software, 2d elements and 3d objects, DMA sound, a utility and maths library, and input from a NES controller.

You’ll find all the source code on GitHub – along with useful stuff like a pinout for the NES controller.

If Team PiFox are interested in taking things a little further (or if someone else fancies forking their repo), we’d encourage them in the direction of using the Pi’s GPU as a hardware rasteriser, which would allow for an HD remix. If you need pointers, it’s still early days for Eric Anholt’s full Mesa/Gallium graphics stack on the Pi, but he’s adding to it all the time and there’s already a lot of meat in there. The VideoCore IV graphics documentation that Broadcom released back in February makes it possible to use the GPU as a “dumb” 2d polygon rasteriser as in Scott Mansell’s example.

If you make the attempt, please let us know; we’d love to see what you come up with.

16 comments

Alex Bradbury avatar

Imperial undergrads have thrown down the gauntlet. Will the Cambridge undergrads rise to the challenge?

Liz Upton avatar

I’ve got another project from the same Imperial cohort to talk about later on as well; there’s obviously something going very *right* with that course!

Eben Upton avatar

Every time an Imperial student does something this cool I die a little inside :)

Tim Rowledge avatar

I hope NuScratch still counts as cool…

Imperial graduate (twice)

Bryan Hogan avatar

While this is very cool, I can’t help thinking a certain Mr Braben’s Zarch had more impressive graphics, and that was on an 8MHz ARM back in 1987!

Zarch on a Pi is funny, it runs at over 700fps :-)

Imperial graduate (only once)

Mike avatar

Is this the project you are talking about?
https://www.youtube.com/watch?v=hTqKRdcKZ9k

Liz Upton avatar

Might be.

Duncan White avatar

Actually, that youtube video is for a different project done by the same cohort of first year undergrads at Imperial’s Computing department, dual player tetris (with homebrew interpi networking via 6 wires connecting two breadboards).

Here’s the pifox video on youtube:

http://www.youtube.com/watch?v=-5n9IxSQH1M

Bryan Crotaz avatar

I had the chess-pi group in as interns last Xmas and they were stunningly smart. Dropped them in the deep end of OpenMax with no waterwings and they got it working!

James Adams avatar

So. Cool.

Every CS course should have a project involving writing a 3D rasteriser. Great fun well done Imperial ;-)

Robert Smith avatar

Thais is so cool! Starfox is one one of my favorite Nintendo video games, I’m so happy now to see an open source clone of that awesome.

Ian Deal avatar

I noticed an untidy breadboard with wires running from the gpio pins to the board.

On a new kickstarter project called “Cake Board”. An interesting through hole breadboard compatible with ‘LEGO”, which can be also stacked in layers like a cake. With this particular unique design all the Raspberry Pi GPIO pins can be plugged straight into the board.

Project link: https://www.kickstarter.com/projects/252587878/cake-board-new-solderless-breadboard-connectable-t?ref=discovery

Such a breadboard would make for a very tidy and neat wiring set up for various Raspberry Pi projects.

Scot avatar

Do a barrel roll!

AndrewS avatar

Can’t let you do that, Pi Fox!

mrpi64 avatar

That’s awesome!

Andrew Iobst avatar

Can someone please change the faces and get more enemies in there? It would be so much better.

Comments are closed