
I got a bit sidetracked on my DS project, but still making some good progress. The 3D world now renders correctly on the hardware. The sprite was showing up as all black with a transparent background, or color with a black background depending on whether or not I used the DECAL shading mode. Turns out it needed a fake material (emit=100%) and a normal vector.
You can also move around, collide with walls, and collide with sprites. These are using simple bounding box/bounding circle tests. A big box for the room bounds, and smaller boxes for obstacles. And circles for sprites. I also have an additional circle called the "interaction radius" where something can light up on the GUI and you can press a button to interact with it. This will be useful for interacting with sprites, and environmental features.
Then I started getting off track... first of all, I could not find a way to convert 8 bits/channel color images to 5 bits/channel (NDS format) using GIMP, ImageMagick, or PIL. So I wrote my own converter in python, using floating point and floyd-steinberg dithering. It's incredibly slow, but that doesn't really matter. The blue background of the example image has been run through that program.
Then I started looking at compression, since the output of my image depth crusher is in 16bpp NDS framebuffer format... very large. I originally used the LZ77 decompression routines that are conveniently in the BIOS. But unfortunately:
- They only seem to output to VRAM or WRAM, which is inconvenient.
- I switched emulators to no$gba in wine, which doesn't emulate that without a copy of the NDS ROM.
So I ended up with zlib instead. Despite some intimidating documentation and header files, there is a handy
uncompress() function that does all the work. So that background image is zlib compressed framebuffer data, while the font is a zlib compressed PCX.
The font stuff is an extension of my earlier HexxagonDS text renderer. I nudged it over to C++, added some basic line-wrapping, and now it can draw 2-color fonts (an outline and a fill color).
Next: putting these together to have a 3D demo where you interact with stuff via text boxes!