KennyR wrote:
Line Of Sight is very important in a game like this. Have you got any calculations for it yet?
Implementation of visibility depends very much on the design of the 3D engine. For BSP models there are ray/leaf intersection techniques that are optimised for line of sight.
But BSP is not well suited for terrain.
I have a 3D engine (development suspended atm) for a syndicate style game that has a simplification for line of sight, but it depends on the fact that the world is composed of 3D prefabs - i.e. just like building a 2D map from a set of prefabricated tiles.
Each prefab is a cubic block that contains a list of polygons (that cannot overlap the block).
The blocks have a visibility fraction (0.0 to 1.0) assigned to each face that is precalculated.
This precalculation is performed by estimating how obscured the view through the block is looking through it axially from each face and various diagonals. Nasty gaussian elimination to get it down to six face factor values, but hey, what is precalculation for?
So a totally empty block has a visibility fraction of 1.0 for each face. If there was a solid wall on one face it would have a fraction of 0.0. Varying degrees of obstruction from polygons inside the block result in interim fractions for each face.
At runtime, a sight probability is calculated by simulating ray of light passing through the block. The ray is attenuated by multiplying by the visibility fraction for each face of the block it intersects (easy to calculate).
We trace a line through all the blocks it crosses(algorithm similar to Breshenams line draw) to arrive at our final probability which is then compared to a random value in the range 0.0 - 1.0.
There are several optimisations that skip lots of multiplications. For example the world is composed of repeating prefab blocks. Once we trace the beam through one block, the overall attenuation is cached and recalled each time we cross a matching one. The trace can also early out if the overall attenuation falls below a certian threshold.
This is imprecise but simplifies line of sight calculations immensely and adds a nice touch of unpredictability that was rather fun ;-)