Effective Level Storage

Started by
3 comments, last by Webbster 19 years, 3 months ago
My game levels are to be constructed out of multiple cuboids of different dimensions. I was wondering how I could effectively store my levels as binary files. Are there any tutorials on the internet that focus on creating unique file formats? I had the idea of creating a Cuboid class (im using C++) and having my map files simply be an array of cuboid classes each object containing specific deatils of the cuboid such as position and dimensions. This doesn't seem on paper to be very efficient but i could be wrong! What should I look into, in order to make the outcome as fast as possible and not be to greedy with processing power or required storage size.
Advertisement
Depending on how your cubes are different from eachother (size, textures, color, etc.) you can either make a class/structure where you specify each cube attributes, and then save that list (list as in an array of that structure) to the disk.
For example, you need the following attributes:

x,y,z position
x,y,z rotation
lenght
face_1 texture
face_1 color
....
face_6 texture
face_6 color


You can also go the 'raw' way, where you just save the vertices/normals/u,v/etc. in a file. If you don't have that many cubes this way would be faster.
There would be quite a few cuboids, several hundred in most complex levels.

However there would be no texture data to store, so would saving an array of these cuboid objects to disk be the best bet and use some form of culling when it comes to sending specific cuboids to the rendering process?

Thanks for the reply
Well, storing on disk and storing in memory (for rendering purposes) is two different things.
However, in your case, if you have under 1K untextured cubes, there is little need to do any culling and such, since this is very little geometry and fillrate even for low end video cards.
Thanks, great help!

This topic is closed to new replies.

Advertisement