logo
home
links & info
project
the stuff
coding
the team
join
navbar end
Gremlin header

Gremlin Engine Articles


Area file type


separator


14/02/02

In this article I will explain the current (1.10 beta) area file type.

First of all, what's an area file? An area file is the sandard Gremlin Engine's game screen: it contains all the information that the program needs to draw a 320x320 pixel window composed by 100 32x32 pixel bitmaps in 10 rows and 10 columns.
To do this, the current version of area file uses a BeOS API class named BMessage.
This class acts as a data container and provides a lot of functions to add, replace, remove and read the data or "transform" it to a raw stream that can be easily wrote in a file.
However, we are now covering the file type itself, so let's see what kind of data is being saved into the files.
The first (but less important) data member is an integer variable named objects that is currently unused by the engine.
It will contain the id numbers of the interactive objects that must be loaded from separate files because of their big size.
Then, we've got an important part: 100 boolean variables containing the status of every tile of the area.
Each variable is saved with the same sxy patter: s for status, x for the horizontal coordinate and y for the vertical coordinate.
These are used for collisions: if the engine receive a moving request from the user he first check this variable: if it's true it draws the character in the correct position while if it's false it does nothing.
Finally, there are 100 strings containg the bitmap name of every tile and named with the same pattern of the status variables, but with b instead of s becuase they're bitmaps.
This name will be used to load a given bitmap from the "tileset": a file containing all the bitmaps needed by the adventure.

So every area file contains these:
- 1 int32 "objects"
- 100 bool "sxy"
- 100 char * "bxy"

I will soon include another integer type variable named "object-number" to allow more than one object.
In fact, if more than one variable is stored with the same name in a BMessage, it treats that name like an array, so we need to know the number of data members under the same name to be able to read the data correctly.
However, the current area file works very well for now.

Rafael Romo


separator


Back to Rockman's page







Made under BeOS Optimized for NetPositive Made with StyledEdit


This site looks best at resolutions of 800*600*24 or higher ones.
This site is still under construction. It will take me a few weeks to complete it.

SourceForge.net Logo