After a recent all nighter, I got a lot of stuff done for the NDS version of MazeMania.
| Intro Screen | |
|---|---|
![]() |
|
| Level | |
![]() |
|
| Death areas and Walls | |
![]() |
|
| Question round | |
![]() |
|
| Game Over | |
![]() |
|
| Credits | |
![]() |
|
My Projects
After a recent all nighter, I got a lot of stuff done for the NDS version of MazeMania.
| Intro Screen | |
|---|---|
![]() |
|
| Level | |
![]() |
|
| Death areas and Walls | |
![]() |
|
| Question round | |
![]() |
|
| Game Over | |
![]() |
|
| Credits | |
![]() |
|
According to the PAlib examples, reading from files via FAT is supposedly pretty easy, as depicted by this code (shortened for space):
#include "PA9.h" Â Â Â Â Â // Include for PA_Lib
#include "fat.h"Â Â Â Â Â Â // Include for FAT read/writes
int main(int argc, char ** argv)
{
...
fatInitDefault(); //Initialise fat library
FILE* testRead = fopen ("FATTest.txt", "rb"); //rb = read
char filetext[30];
fread(filetext, 30, 1, testRead);
fclose(testRead);
PA_OutputSimpleText(1, 1, 7, "FATTest.txt contains:");
PA_OutputText(1, 2, 8, "%s", filetext);
...
return 0;
} // End of main()
(Apologies that the code tags don’t seem to work in this theme…yet)
Well this code seems to appears to work on the emulator, and it’s really hit or miss on the actual DS. So I began to delve into this problem. After about 8-9 hours of trying to debug this problem by myself and with the assistance of Dr. Malloy trying many different things we didn’t really come to any finite conclusions.
Luckily, other students in my class are also reading from files and have found that FAT is no longer supported in this version in PAlib and have been using Embedded File System (EFS) Library to deal with file reading. So, that was a bunch of time wasted.
This is the EFS example that I found (shortened for space):
#include "PA9.h" // Include for PA_Lib
#include "unistd.h"
#include "efs_lib.h" // include EFS lib
int main(void) {
// init EFSlib & libfat
if(EFS_Init(EFS_AND_FAT | EFS_DEFAULT_DEVICE, NULL)) {
PA_OutputSimpleText(1, 0, 0, "EFS init ok");
PA_OutputText(1, 0, 1, "found NDS path: %s", efs_path);
struct stat st;
FILE* file;
u8* buffer;
int size;
// open a text file and read its contents
file = fopen("/test.txt", "rb");
if(file != NULL) {
stat("/test.txt", &st);// get file size using stat
size = st.st_size;
buffer = (u8*)malloc(size);
fread(buffer, 1, size, file);
buffer[size-1] = '\0';
PA_OutputText(1, 0, 4, "/test.txt content: '%s'", buffer);
PA_OutputText(1, 10, 5, "size: %d bytes", size);
free(buffer);
fclose(file);
}
} else {
PA_OutputSimpleText(1, 0, 0, "EFS init error!");
}
...
return 0;
}
(Again, apologies that the code tags don’t seem to work in this theme)
This works fine on both the emulator and the DS, except it only seems to work for doing it once, otherwise I get “EFS init error!”. So, at first I thought I would have to read each map and question into separate arrays at the beginning of the program. This, of course, is a horrible idea, not only would it increase load time by a significant amount but it would hog a ton of memory. So I began to try and figure out this problem. After a few more hours of investigation and debugging, I finally find out the problem. It turns out that the statement “
if(EFS_Init(EFS_AND_FAT | EFS_DEFAULT_DEVICE, NULL))"
will fail every time after the first call. It will fail because they have already been initialized. So that was a simple fix. I just modified it to this:
EFS_Init(EFS_AND_FAT | EFS_DEFAULT_DEVICE, NULL);
FILE* file = fopen (filename, "rb");
if ( file != NULL){
After more time being spent trying to figure out this new library, I think I finally have it figured out. EFS puts all of the files that you put into the “efsroot” folder in your program is loaded onto the NDS file and needs to be recompiled to have changes made to the file, be included in the NDS to be read. This kind of defeats the purpose of dynamic maps and questions on the files if they don’t have the source to recompile the NDS. Questions and maps will still be read from the files, in hope that reading and writing from files will become more dynamic in the future. Another thing is that EFS read works on the emulator but not EFS write. However, both work on the DS. So, after probably 12ish hours trying to trouble shoot the simple thing of file reading, it is finally solved and reading my maps into a 2d array to be rendered onto the screen.
There won’t be much text to this post, but there’s a lot of content! You can find my contract for the NDS version here. You can find my story board here (apologies for breaking the layout) or here (missing the awesome flow chart). All of the general level designs are screen shots from MazeFinger and can be seen here. At the end of the slides with the levels, there is my first screen shots of MazeMania on the DS! It may not look like much but it’s a step in the right direction.
Like I said, not a lot of text, but check out the links!
I have chosen to do a maze game based off of the popular iPhone application, Maze Finger, with some new features. Included in those features are its new name (MazeMania), ecology related question rounds, new user input (the almighty mouse), and much more.
I have chosen to a similar game for the Nintendo DS, as I think there is a lot of potential in the touch screen and stylus. This game will be different in that the questions will be geared toward helping high school students prepare for the English part of the SAT by using old test questions.
I have also talked to my teacher, Dr. Malloy, and we are thinking of writing a paper to present at the Games+Learning+Society Conference based on the differences of the two very different platforms, education in games, and a future user study. The abstract can be found here. This played a pretty big role in why I am doing very similar games for each platform.
In my CpSc 372 class, introduction to software development, taught by Dr. Malloy, we will be writing a game for the PC using Python and the PyGame library. Soon, 2 different clients will come in and present on what kind of general idea they would like in their games.
In my CpSc 481 class, educational gaming, also taught by Dr. Malloy, we will be writing a game for the Nintendo DS (dual screen) using C and a library that assists with the programming on the DS. In this area there are 2 main libraries, PAlib and libnds. With regard to the 2 libraries it is said that PAlib is easier and faster to learn than libnds, but libnds has more capability. I will be using PAlib, so I can learn the language and program the game within the semester. This game is open ended, as far as the content, with the catch that it is educational in some way.
More on these 2 games coming soon.