Amazing project! Thanks for writing this post.
From bytes to 3d
Foreword: I mush say that 3d artists at Sega-AM2 did an awesome job. The tracks are just perfect. Thank you guys!
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!)
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
- Acropolis: 5 carts / 188Kb
- 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 :)