Pseudo-3D Engine
|
I have been developing a pseudo-3D engine for the Gameboy Advance that combines the fairly straightforward "Mode 7" hardware technique (used in games both for the Gameboy Advance and the Super Nintendo) with a more sophisticated raycasting engine. The end result is a pseudo-3D game where I have much more control over the display (such as the ability to change the pitch of the camera) than typical Mode 7 games.
Currently the engine features the following:
- Camera can freely adjust pitch, zoom, point-of-interest and rotation
- Accurate fog effect
- Tileable backdrops that scroll with camera movement
- Animated background tiles (check out the water)
- Map VRAM memory management capable of handling maps much larger than what the GBA can normally handle
The largest map size on the GBA is 128x128 tiles, which consumes a quarter of the GBA's VRAM dedicated to maps (not including the actual tile data, which consumes another quarter of the VRAM). This demo currently uses a map that is 256x256 tiles - four times the size of that - and it can go much larger still, while consuming only a quarter of the VRAM that the largest map size does. It seamlessly handles any camera movements, including sudden cuts elsewhere on the map.
- Gradient "sky" effect (can be any colour)
- Scripted camera movements that can combine any type of motion
- A high-level object management system that extends the VRAM for sprites well beyond the GBA's limits (although this is not evident from the demo, which has only one unique "character")
- A sprite keyframe animation system that allows non-uniform keyframe motion, with each sprite on its own individual timer
- Sub-pixel sprite movement; adjustable sprite velocities
- A modular map file format and palette management routine that allows combining and sharing of tilesets, while optimizing colour usage
- All time-critical functions optimized in assembly
|
Screenshots:
Basic overhead view
Camera pitch adjusted upwards
Rotation of landscape
Sprites are scaled, positioned and corrected for direction
The tiles and sprites are not my own design, but have been borrowed for development purposes from "Secret of Mana" by Square.
|
Want to try the ROM out for yourself?
Download it!
The ROM is configured for emulation, and should be run in an emulator such as VisualBoy Advance.
If you wish to run it on an actual GBA using a Flash cart, your linking software may have to adjust the game's headers. It will not run on multiboot.
Demo controls:
- Control pad moves the character
- R and L adjust the pitch of the camera
- A and B zoom out and in on the camera's focal point
- Start and Select rotate the camera in either direction
Originally it was free rotation, but now each press of Start or Select will slowly rotate the camera by 45 degrees. This is in order to demonstrate an aspect of the scripted camera movement.
Things to try:
- There are currently two other characters on the map, although they don't do much. One is at the top-left corner of the map, and the other is near the centre (down and right from where your character starts). They are animated using their own VRAM and individual animation timelines.
- Your character will be stopped at the top or left border, but if you attempt to cross the far right or bottom border you will "warp" to the opposite end of the map. I did this to test my camera scripting: if you try it the camera will literally fly to the other end to catch up with you.
Things remaining to be done:
- Too many to list. This is still very much in the advance stages of development; I am merely putting it online to showcase what I have done so far.
Prospective employers interested in seeing the source code should contact me for release arrangements.
About the Maps
I developed my own in-house tool to create the maps that constitute the landscape (and the backdrop). Originally I designed it as a Web application in PHP for simplicity's sake, but it seems most Web browsers get fussy when you try to load over 16,000 8x8 images onto a page. (I tried using server-side images as well, and this proved to be similarly problematic.)
In the end, I went and learned Objective C just for the sake of coding a map-editor. The program runs on Jaguar (Mac OSX 10.2) and is pretty nifty. It manages all of the tile and map data, and outputs them to the necessary C files in such a way that I can just refer to a map by its variable name, and my GBA program will automatically load the necessary tiles, palette entries and map data.
Screenshot (click to enlarge):
Among other things, it features dynamic brush sizes, and click-and-drag painting or area filling.