The Maze Escapist Version 3
In the third and final version, I fixed the major issue of screen lag and made the final version very smooth. These intelligent techniques were taught to me in my class. Page flipping, a type of double buffering technique used in computer graphics to remove this flickering or tear, made sure that this issue was removed. I had two video buffers where the data for the screen is written. While one video buffer was being displayed, the other video buffer was being written on. Both of these buffers are capable of being displayed (both are in video RAM or VRAM). When drawing is complete, the roles of the two are switched. This technique was achieved by modifying the value of a pointer to the beginning of the display data in the video memory. Another technique I used for increasing the efficiency was reducing the size of colors available/used for every pixel by reducing the number of colors available. Initially every color in GBA was 15 bits in the form RRRRRGGGGGBBBBB giving 2^15 combinations or 32768 colors. For this, I used a palette of colors created using enumerated data type which had 256 colors in it where I defined the values for colors in the palette as shown in the code below:
|
|
#define PALETTE ((u16 *)0x5000000)
enum {REDIDX=240, GREENIDX, BLUEIDX, CYANIDX, MAGENTAIDX, YELLOWIDX, WHITEIDX, BLACKIDX};
Even though the number of colors reduced significantly, there was not much difference in the graphics and the speed increased significantly. These two major fixes in this code made sure that the game was displayed properly without any tear or flickering, providing a smooth user experience.
You can watch a brief tutorial of the game in the Video Tutorial page. You can download the zipped version of the code and the game here:
enum {REDIDX=240, GREENIDX, BLUEIDX, CYANIDX, MAGENTAIDX, YELLOWIDX, WHITEIDX, BLACKIDX};
Even though the number of colors reduced significantly, there was not much difference in the graphics and the speed increased significantly. These two major fixes in this code made sure that the game was displayed properly without any tear or flickering, providing a smooth user experience.
You can watch a brief tutorial of the game in the Video Tutorial page. You can download the zipped version of the code and the game here:
|
|