Hi all,
I've worked for a while on this personal challenge of making a true 3D engine for the 2600 that can turn into a game in 4KB using only the original HW, no ARM, etc.
After many false starts, I believe I identified a good direction. However, I'm finding I need peer review and also cannot commit the required time to finish this engine alone.
Instead of letting the bits rot on my HD, I'd like to develop the topic in the thread (and share the code). So that the project may come to fruition.
I basically separated the problem of creating a 3D game into game logic and engine (nothing new here), the code contains engine only. I decided on a Portal-based 3D engine where each room on the map may be one or more convex zones with portals connecting them.
The engine is further split into 2 parts:
1. Taking level data (ROM) and player position and performing Backface culling, Rotation, Translation, Clipping and finally Projection into RAM
2. Drawing up to 21 color-textured polygons on screen taken from RAM using the playfield (textures are 16x16 with 16 colors under limitations). Note that the display is rotated 90 degrees to allow the colorful textures. Note that 16 colors are allowed in the textures as the engine uses 8 shades to perform Gouraud shading.
63 bytes of RAM are used to store the 21 polygons, and this list is being refreshed every other frame (30Hz). The blanking time is fully used by the engine every other frame, and left alone for the game logic otherwise.
Information about the level information, RAM storage format, etc. is in the source file. Most math is done using 8 bit fixed point (multiply and divide using fast tables, obviously).
There's not much to see if you compile and run it. I need to squash a few bugs to get the basic single zone (simple convex room) to work.
Clipping to frustum is not working yet. Entering and exiting Portals also not handled (I need to get a single room working properly first).
I'm sure the coding Ninjas on the forum can drastically improve the code, allowing more room for the eventual game.
If I see you're interested I could go much deeper to explain and work with you on the different parts.
Enjoy!
aMAZE4K.asm