Game media and TMaps

BlitzMax Forums/BlitzMax Programming/Game media and TMaps

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

All my data is stored in a map. When the engine is loaded, the game is then loaded and all files from the game directory (there is a difference between application directory and game directory) are indexed and these become the only files accessible to the game. You cannot read files above the game directory (e.g., application directory, C:\WINDOWS, C:\TMP, etc.). All files can be searched for glob-style, extensions aren't necessary to load media (e.g., models and textures- the best format is chosen when there are multiple choices). If the game writes data, the file must be in a directory that is considered writable (for example, saves/).

I was originally using a hash table but decided to go for a TMap instead just because 1) it's already there and 2) collisions won't occur in most situations. It took me a long time to come up with something that could get a collision, but that I could do it means anyone could have, and that just wasn't good enough. Plus I didn't feel like writing a new hash function.

All data is kept in a package that is more or less a modified .PAK format. Each file is individually compressed (I'm thinking about changing this such that each file is made up of small, compressed chunks to make reading/decompression easier for larger files that would be processed over time.

Shaders, materials, etc. are done using my SParse format, which is more or less a complete ripoff of Quake 3's shader format in terms of syntax. I'd considered using XML, but honestly, that's just bloated and ugly. Neat toy back when I was playing with it, but it slowly becomes more and more obvious that it's really, really stupid to use most of the time.

Doubt any of that made sense.