SpaceBalls

Primarily a tech demo where I played around with pre-rendering 3D views and managing 3D transforms on the GBC.
Pursue and attack the enemy ship while dodging its laser fire.
Controls:
LEFT / RIGHT: Roll
UP / DOWN: Pitch
A: Fire lasers
B: Cycle Shield Configurations
B + UP/DOWN: Increase/decrease engine speed

There were a lot of technical challenges involved in getting this to run at 60Hz, so a lot of ideas are only partially developed, or left on the cutting room floor. For example, I just began working on the enemy AI this morning :P
Some points of interest:
- Pay attention to the location of the Sun when you are flying around. I chroma key the highlight color of the cockpit based on the Sun position, to give a lighting effect
- While working on this project, I became convinced that there is a lot more possible in 3D with pre-rendering. Here, I am leveraging the rotational symmetry of spheres to reduce the amount of ROM usage. With clever design of model geometry and some restrictions, I think certain polygonal models are viable.
- The limiting factor is getting pixels into VRAM. I wanted to explore pre-fetching, since we should be able to predict adjacent views (or build a graph) with high-confidence but didn't have time to play with it.
- I messed with using hblank_copy for updating the render buffers within a single frame, but ultimately decided on a simple lazy-update scheme for moving tiles to VRAM, i.e. upload "x" tiles per frame, and flip buffers when the upload is complete.
- Other tricks for reducing load are to design object motion and gameplay around the constraints of the system.
- Setting this in space means that I can define the player as origin and cut out a transform, as well as approximating an arbitrarily large playfield. Also, I am dropping precision in the 3D calculations like crazy, with the expectation that player and enemy movement will dominate that precision loss.
- There is a lot of headroom left for general math improvements and optimizations. I didn't touch assembly for this project, or even use log tables for multiplication/division!
- Carefully choosing the for precision of each calculation is critical for balancing performance against numerical stability. I mostly just played it by feel because of time constraints, but there is a lot more benefit to be had.
Rendering
Brief overview of the rendering procedure

- Offline, I generated evenly distributed views of the enemy ship for each scale, from 2px diameter to 32px.
- Select scale from view distance. Pre-calculated a table for this.
- From the set of tables for the selected render scale, select a view by normalizing the gaze vector and picking from the xyz values from the table.
- object has rotational symmetry around the gaze vector, so can get away with 3DOF for this step
- Put the tile ids onto a work queue
- Each frame, load 4 tiles into the back buffer in VRAM
- When the tiles are completely loaded, swap buffers and display our new view
Glitches
- We've got 'em!
| Status | Released |
| Platforms | HTML5 |
| Author | fingerflinger |
| Genre | Action |
Download
Download
spaceballs_jam.gbc 512 kB



Comments
Log in with itch.io to leave a comment.
Really fun and immersive dogfight. So impressed with the UI. Very intuitive. Well done!
Very impressive 3D effect
indeed very impressive !! i defeated 2 enemies but then i die.
The text on the screen was buggy I couldn't read it :/
very impressive
Reminds me of Privateer/Wing Commander. Super impressive on Gameboy! But I dont think I ever saw an enemy or understood if I was shooting one. I shot at a planet maybe?
Did you use the radar, it wasn't too bad if you did.
i aligned the dot and saw a red circle appear in front of me, but shooting it did nothing
Hmm, it should flash blue if it still has shield and flash red if you are damaging it.
I’m sure there are tons of bugs though, maybe you found one!
I could never win at Privateer either, maybe its just me :D
The right radar is behind you. The left is in front.