Original Post
Hi, Probably you guys have experience with memory, since good old isometric games often had to be as small as possible on old systems. I'd like to know if there are some ways to bring down the size of my level files. A level is a 3D grid of 'cubes', kinda like GTA1/2. Each cube holds 5 faces (top,left, etc.), where each face has its own material. Furthermore, the cube uses a byte that describes the shape. Besides cubes, there are also slopes, walls, pillars, etc. The terrain is divided into what I call 'cells'. Each cell has 1 or more cubes stacked upon each other. So a cell has a byte that tells the height, and an array of cubes. When it comes down to the code, it looks something like this:
TFace = record
material : Word; // unsigned int 16
end;
TCube = record
meshType : byte; // cube, slope, etctera.
face : array[0..4] of TFace;
end;
TCell = record
height : byte;
stores : array of TCube; // height tells how big the array is
end;
TRaster = array of array of TCell; // 2D array with cells
It's Delphi code, but I think you get the idea. Now I'd like to store this stuff into a file, as small as possible. Now the size depends how many boxes are stacked. But let's say we have only 1 layer, the ground. And the raster is 100 x 100 cells. That would bring me to:
cube_size = 5 faces(2 bytes each) + 1 byte = 11 bytes
cell_size, with 1 cube(store) = 11 + 1 = 12 bytes
raster = 100 x 100 x 12 = ~117 kilobyte
It's not that much, but since these files need to be downloaded from internet, size really matters. I don't know how, but I have the feeling that it can be done smaller. I looked at some GTA2 levels (which are pretty big) and they were smaller in filesize I think. And probably those GTA2 'cubes' even had more properties, like the texture rotation. Most types are bytes, except the material. But probably there gonna be more than 256 materials. I could go bit-wise and remove some bits at some types... but I still don't think I can match with the GTA2 level sizes. How to shrink this? Greetings, Rick