Feanor
2002.06.18, 01:25 PM
I need some ideas on the size of levels and how to measure them. I am most familiar with Quake, which used an integer value in the map file (used for editing), but might have used a float in the .bsp file (the file actually read by Quake as a level to play) -- documentation is sketchy on this point, so I may resort to browsing the source on that.
Given an 32-bit integer value for world co-ords gives four billion distinct vertex positions in any of the three directions -- this provides the graininess of the map. The finer the detail level relative to the player, the smaller the map. I guess that should be fine for HailStone, but once it's built into the engine, it might make it more difficult to extend the engine to use floating point values later.
The main difficulty of floating point is making sure the various polygons line up nicely. This is alleviated by sharing vertices amongst polygons, but then we can't use OpenGL dynamic lighting, because that depends upon properly oriented normals (and a situation where one vertex would need a separate normal for each polygon it is a part of). Not sharing polygons is also required for the best use of compiled vertex arrays, or so I gather. Anyway, vertex indices use up storage space which may as well simply be allocated to redundant vertex specifications. Dumping indices simplifies a lot of other things, too.
In that case, I have to have a facility to ensure that the map editor produces the vertices properly. It's possible I'll use a shared-vertex system for the editor, and then flatten the shapes for the level file and remove the indices altogether. This would be like the Quake .bsp compilation -- I'll undoubtedly want to create the view hierarchy at that time as well (though I'm not sure if I'm going to use a bsp or a dynamic visibility system).
So the last problem with floating point vertex specifications is making sure that different model pieces line up together. On an integer grid they either do or they don't. With floating point values, precision gets worse as we move away from the origin -- that's not good! If everything is measured local to a map area, or even local to the player position, this might solve that problem.
FÎanor
Given an 32-bit integer value for world co-ords gives four billion distinct vertex positions in any of the three directions -- this provides the graininess of the map. The finer the detail level relative to the player, the smaller the map. I guess that should be fine for HailStone, but once it's built into the engine, it might make it more difficult to extend the engine to use floating point values later.
The main difficulty of floating point is making sure the various polygons line up nicely. This is alleviated by sharing vertices amongst polygons, but then we can't use OpenGL dynamic lighting, because that depends upon properly oriented normals (and a situation where one vertex would need a separate normal for each polygon it is a part of). Not sharing polygons is also required for the best use of compiled vertex arrays, or so I gather. Anyway, vertex indices use up storage space which may as well simply be allocated to redundant vertex specifications. Dumping indices simplifies a lot of other things, too.
In that case, I have to have a facility to ensure that the map editor produces the vertices properly. It's possible I'll use a shared-vertex system for the editor, and then flatten the shapes for the level file and remove the indices altogether. This would be like the Quake .bsp compilation -- I'll undoubtedly want to create the view hierarchy at that time as well (though I'm not sure if I'm going to use a bsp or a dynamic visibility system).
So the last problem with floating point vertex specifications is making sure that different model pieces line up together. On an integer grid they either do or they don't. With floating point values, precision gets worse as we move away from the origin -- that's not good! If everything is measured local to a map area, or even local to the player position, this might solve that problem.
FÎanor