Hello everyone !
I'm starting to work on a RPG similar to the first Final Fantasy games. One of my goal is to load the data dynamically from the SD card so I wont have to worry about the available size of the HEX file.
I managed to create a functional tilemapper that read the data (the map and the sprites) from the SD card. I wrote a converter in lua that packs the data into one .DAT file that must be put in the SD card of the Gamebuino. That allow me to have a total control of the data inside the file, and I also only have to open one single file. The converter also support maps from Tiled. Here is a small gif of a test map I have created.
And now with more animation !
(As always with me, the speed of the gif is not representative of the performance on the real hardware.)
Here you can see a map that is 255*255 tiles on the SD card (well most of it is only water). That represents 65 025 bytes of ram, which would be much harder to do using only the flash storage of the Gamebuino, as you would need some form of compression in order to put all the map into memory.
On the technical side, the routine takes around 12 000 miliseconds to run in the worst case scenario, leaving 38 000 miliseconds for other operations like collision testing, sound and character spirtes drawing. All the data thats need to be used (the sprites and the map) is stored inside the ram in a 512 byte buffer. The map in the ram is cropped so it only uses what need to be displayed on the screen (around 96 bytes of data). The the camera moves, the map data in the ram is shifted and data from the sd card is re-loaded.
Credits for the ASM 8*8 sprites routine goes to Sorunome (The routine does not work properly at the moment , as I have to manually clip the sprites on the bottom of the screen in order to avoid crashes from the console ).
Credits for most of the sprites goes to Oryx (http://oryxdesignlab.com/). It's from an old contest on the tigsource forums. The images aren't hosted anymore, but you can still find them on the original post thanks to the Internet wayback machine : https://web.archive.org/web/20110717060157/http://forums.tigsource.com/index.php?topic=8970.0
Here is the repository of someone want to see how it's done : https://bitbucket.org/valdenthoranar/tilemaptest/src
The project uses petit_fatfs that should be installed with your gamebuino library. If you want to try the program on your gamebuino, you'll have to put the MHQ0000.DAT file in the root directory of your SD card.