PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Game Maps: A theory I could use input on.

Hello there!

I have an idea that I'd like to run by anyone interested in reading it. I'm not sure if this is feasable or not, as I've never programmed on the PPC, and right now it's just a theory. I'm currently in the middle of building the core game engine, as the GUI is already completed. Since I've started with the core engine, I've had ideas floating around, and this is one I'd like to get some input on.

The idea I have concerns the Map itself. I've been thinking about detailed Maps, and I mean absolutely detailed. I began to think about previous games, and if I remember correctly, Baldur's Gate used a single image as the entire background/map. It was hand painted, and boy did it look good. I was thinking of applying this to my game.

The first game I have in mind is a Platformer. Now having a single image as the Map could prove to be a great idea, but only if it works. It could benefit the overall quality of the graphics (as the artist will be able to work freely instead of piecing tiles together), and the performance of the game. The platformer will work off of what are called Rooms. Each Room is a section of the current level. The player will not move from Room to Room (area to area) unless he or she goes beyond the current Room (that is, the "camera" does not move with the player, it holds still focusing on one Room/area at a time). This would allow me to draw the entire Room in a single frame, and only redraw the Room where needed (ie; where the monsters or player move). This would drastically cut down on the drawing needed per frame.

A concern come to mind with this approach:

I will not load a Room until the player enters it. By doing this, it would allow levels to be endless, but only if the player doesn't notice the loading! You know what this also means? The game could "feel" seemless to the player if it's pulled off correctly. How this works is, when a player leaves a Room and enters a new one (remember, Rooms are basically areas of a level), an image the size of the entire screen will need to be loaded, along with the Room Data (ie; areas that are walkable, monster spawn points, etc.). The Room Data will actually be small in size, only a single DWORD per 32x32 area. 7.5 x 10 = 75 DWORDs. 32 bits x 75 data = 2400 bits = 300 bytes to load upon entering a new Room. This of course doesn't include the image.

My main concern here is the size of the single 240x320 image. Loading Room Data should be quick and painless (unless file access on the PPC is painfully slow). Will the image load fast enough to not require a load time? Will the artist enjoy the freedom of building a level in this manner or prefer making tiles and puzzling them together using a map editor? I just don't know, and I'd like some input.

Thanks for your time.
Loading the full 240x320 image is almost instantaneous, unless it's coming from a storage card. Then, it usually takes about 1/2 a second or so. But it also depends on the compression method of the image. A .BMP takes up a ton of space, and will require more bandwidth to load than a .PNG, but it doesn't have to be decompressed. A .PNG has to be decompressed, which takes processing time. Overall though, a .PNG is still faster than a .BMP coming from a storage card, and it takes 1/10th of the space. Also keep in mind that internally each 240x320 image takes up 240x320x2 bytes... 153,600 bytes. So seven of them use about 1MB of RAM if loaded at the same time.

-John
What format would you recommend for both quality and performance? Or are PNG and BMP my only two options? TIF out of the question? I think there was one more format that I've seen used in games, but it evades me at this time.
If you could load a small chunks of the next room - not all at once - well before you needed it, it would work well.

I was going to say to use a separate thread, but I don't think that would helk - unless you wer already loading small chunks.
The standard image decompressor DLL (imgdecmp.dll ?) lets you use .BMP, .GIF, .JPG and .PNG (I think that's it though). You can use .GIF, which is also tiny, but it limits you to 256 colors. .JPGs work well for photo-style images, but are lossy and don't work well for non-photo images. .PNGs are lossless, like .BMPs, and have excellent compression. Also, .PNGs can have alpha-layer transparency, which is awesome.

-John
If you have processing time to spare while the player is in a room, you could pre-load all adjoining rooms using a separate low-priority thread. If you're talking 320x240 bitmaps then you should have plenty of ram to load several rooms at once.

Dan East