!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
This is an older work-in-progress version! Play the completed released version here.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
This is a little scaled-sprite 3D graphics engine inspired by the old classic game Power Drift.
Still work in progress. Needs some basic game-play rules (laps, win/lose etc) and some difficulty balancing. But it's playable.
Update
- Fixed bug in saving tracks to external cart.
- Added a little bit of steering assist to help line up the jumps.
- Some other tweaks I forget :)
Update 2
- 2 tracks
- Track selector
- Trees generate in the same place
Update 3
- New track
- (Slightly) better physics/collisions
- Finish line and corner signs
Update 4
- New larger test track
- Performance optimisations. LOD system. More aggressive view volume culling
- Tweaked the steering
Update 5
- More performance tweaks
Update 6
- More performance tweaks, thanks to @freds72
- Updated physics to support driving upside down!
- New track with loop-the-loop (to test driving upside down :)
Update 7
- AI cars. WIP. No collisions yet. Difficulty will probably be scaled down a bit eventually.
- Moved editor to separate cart.
- I tried to draw a palm tree.
Update 8
- Different AI car colours.
- Fixed flip-Y logic when AI cars are upside down.
*Update 9
- Basic car collisions
- AI cars now steer around each other (and you)
Update 10
- Cockpit graphics with animated front wheels.
- Main menu
- Race start sequence
Update 11
- Fix wheel animation when frame rate <30
- Fix NPC cars getting stuck on hills
Update 12
- Lap and position displayed on screen
- Race finishes after 5 laps
- Note: Difficulty level logic is not hooked up yet!
Update 13
- Hook up difficulty levels
- First attempt at engine sounds
- "Ramps" logo :)


Not for the faint of heart :)
Still has some CPU issues. The main bottleneck is sorting the billboards from back to front. It's currently just using an insertion sort - which actually works pretty well most of the time, because the data is mostly sorted from the previous frame - but every now and then the camera turns far enough to flip a bunch of billboards into different order and the sort alg struggles.


For sort performance, have a look at radix sort. I forked a version from James: https://twitter.com/fsouchu/status/1212352497865674752?s=21
(might need a fix - can’t check atm)
Other than that, what about rendering road sprites as rectfill (with proper color) above a certain distance?
Or reducing track precision at distance?


@freds72 thanks, I'll give that a go. I tried a pivot sort before but couldn't get it fast enough.
@dw817 stunt car racer had a cool wreck system too. It all depends on having enough tokens though. I'm starting to consider having a separate track editor cart and game cart to fit it all in.


@freds72 looks quite clean actually.
I tried a version that was just rectfills, and found that if I also disable the sorting the CPU stays under 100% all the way around the track. (Although without the sorting it does strange things to my brain..). I think the sort is still the bottleneck right now.


Suggestions:
-
Try to stop thinking in degrees and think in turns instead. Not only does it suit PICO-8's API better, but it's often a much more convenient way to express angles, since the angle in turns is just the number you slap in front of τ (or 2π) to send to trig functions on big-boy platforms. But mainly you want to eliminate all of the multiplying and dividing by 360, 180, 90, and other non-power-of-2 numbers.
-
Maybe round off the top/outside corners of your road chunks. You already round off the ramps a bit. It'll help the road look less blocky.
- Try a somewhat-wider FoV. It's discouragingly-hard to see what's coming around corners with the narrow p8 screen
[Please log in to post a comment]