From Bytes to 3D: Virtua Racing PICO-8 Demake (2020)

atan21 pts0 comments

From bytes to 3d - Virtua Racing Demake by freds72View all by freds72freds72<br>Follow freds72FollowFollowing freds72Following<br>Add To CollectionCollection<br>Comments<br>Devlog<br>Related gamesRelated<br>From bytes to 3d<br>Virtua Racing Demake » Devlog

6 years ago by freds72 (@FSouchu)Share this post: Share on BlueskyShare on TwitterShare on Facebook

Foreword: I mush say that 3d artists at Sega-AM2 did an awesome job. The tracks are just perfect. Thank you guys!<br>From Flight Sim to Racing "Sim"

Following the work on Tiny Sim I kept working on 3d projects with an old crush of mine: flat shaded polygons.

Virtua Racing was the kind of style I was looking for, so started a 3d engine focusing on effective pruning of geometry.

A basic prototype using standard raycasting (think Wolfenstein) was up and running in little time:

Still eyeing at a Virtua Racing demake, I stumbled accross this old post: http://forums.sonicretro.org/index.php?showtopic=38296 describing the layout of the Megadrive ROM.

That was the trigger: the Megadrive 3d models looked like something that my engine could handle.

Unfortunately, the post detailled the in-memory layout of the running game. After trying to make sense (and failing) of running arcade emulator, I went back to the ROM.

The article clearly mentionned a standard 3d format layout (colors, x/y/z coords). I was hoping the ROM was storing everything uncompressed and built a small app in PyGame to "scan" the data.

This must be what the unfiltered matrix look like!

That said, scanning through the memory addresses - some data did make sense (take that AI :). For ex, see these curves? Looks like indeed some 3d data is around.

I am skipping some tedious comparison of bytes "pack" to match layout with area I was sure contained 3d data and ended up with that:

Tada!! Now time to scale up:

Good news: the various track segments (130) are using absolute positions, will greatly facilitate import to Blender.

A couple of Blender Python lines after:

Mapping color codes (2 x 4 bits colors) to something matching the game:

Ok - that's 5371 vertices, 2839 faces, time to optimize the hell out of the 3d engine!

(and good news - it does fit into 2MB of pico8 RAM - pfew!)

Raycasting quad pruning<br>At this point, there was no turning back - the 3d track was too good to be left as an experiment and decided to stick with a multi-cart game :/

With some more python scripting, I had an automated export toolchain from Blender to data carts (yikes the __sfx__ format!!):

Big Forest: 5 carts / 180Kb<br>Acropolis: 5 carts / 188Kb<br>Ocean: 5 carts / 202Kb

Given I need 1 cart for the game and 1 game for the title screen, that's a total of 17 carts - the export limit being 16!!!!

And that's why the tech demo did not ship with all 3 tracks :/

Next step: investigate compression!

Megradrive ROM trivia

Each face has its own vertices - no sharing accross adjacent faces (I assume due to limited dynamic allocation on console), but man, what a waste of cpu!

Tracks have animal models: horses, birds, duck, ... that no one in the arcade ever saw for sure!

Pit stop animation is set of fixed 3d models, displayed one after the other (matrix skining is for looser :)

Get Virtua Racing Demake<br>Download NowName your own price

Virtua Racing Demake<br>PICO-8 port of the iconic SEGA title

Add Game To Collection<br>StatusIn developmentAuthorfreds72GenreRacingTags3D, PICO-8

More posts<br>Squeezing PICO-8 CPU! Jan 12, 2020

Comments<br>Log in with itch.io to leave a comment.

Brohann2 years ago(+1)<br>is it possible you could upload the 3d models to github or something like that? I am working on a Virtua Racing demake for microsoft makecode arcade

Reply

skywal_l3 years ago<br>Care to share details on the ROM format? Especially the address of the 3D models?

Reply

skywal_l3 years ago<br>Ok I can see an address in your screenshot 0x00138200.

Reply

skywal_l3 years ago<br>So for anyone looking to extract the stages 3D models from the european Virtua Racing ROM, here are the addresses:

beginner: 0x00138200 palette: 0x001d3020

medium: 0x0014c200 palette: 0x001d30a0<br>expert: 0x00164298 palette: 0x001d3120

Reply

Denki3 years ago(-1)<br>This is super impressive. I'd like to try converting this to Scratch. Would it be possible to share the .blend files you extracted for this? Or any more info you're willing to share about the models?

Reply

freds723 years ago<br>I won’t share Blend files and not sure what you expect to do with Scratch???

Reply

Denki3 years ago<br>vOv I've done a number of 3d projects on Scratch and was hoping to get this running too.

Reply

Denki3 years ago<br>Like this... https://scratch.mit.edu/projects/737998848<br>If anyone else comes across this I will post Blend files soon.

Reply

werelax6 years ago<br>Amazing project! Thanks for writing this post.

Reply

yourykiki6 years ago<br>Nice details ! Thanks for sharing !

Reply

gustavopezzi6 years ago<br>Thank you for this.

Reply

itch.io·View all by freds72·ReportVirtua Racing Demake › Blog

years racing reply virtua demake models

Related Articles