Sight checking for many units

Started by
11 comments, last by SimmerD 19 years ago
Just a wacky thought.....but I think you can break down the problem by simply implementing a scene graph or using a scene graph. I know Scene graphs are usually used for rendering purposes to to object culling etc, but won't object culling help in visibility as well?

I haven't looked into the stuff on scene graphs closely, but then from a rendering pipeline point of view, doing object culling from the purspective of each usit will simply resolve most visibility issues. Its just a thought off the top of my head, not tested yet.

Also, if your units travel in close groups, then you can test just one person in the group's visibility of enemies. If one person in the group can see it, especially someone standing near the center, then you know most of your group should be able to see it. This of course is assuming that visibility is judged only by distance. So, you do 1 distance check from the center of the group to all enemies, then do view angle checks only for each individual unit. So, basically, only test visibility with units within range of the group's average visibility range. Something of the sort.

Most of these are just thoughts off the top of my head. But I feel using information from the scene graph, if any, and the rendering pipeline , may be an interesting approach.
Advertisement
First of all, everybody thanks for the tips!

@WeirdoFu
Sharing info like distance could help. Units are moving indeed in groups (5 or 6 men). So in common, they will be close. However, the AI and game allows a squad to split up (flanking or sending some scouts forward). In that case sharing the information wouldn't be accurate enough. I could make a flag to share or not but that might bring some overhead because I need to check if all squad members are close enough to each other then.

I never heard of these Scene graphs so I should take a look at that. I already thought about stuff like Octree or BSP but there's a slight problem though, the terrain objects are dynamic. Trees can be removed, moving vehicles should block the sight as well and buildings can be placed or destroyed any time. So pre-computing the visibility isn't really possible, except for the (static) terrain itself. But the terrain collision check itself is really fast and simple. Howeverm if these 'Scene Graphs' can be updated fast (remove a tree something) and don't eat too much memory, it could work.

[EDIT]
I saw something about those graphs (on gamedev.net of course). I guess I'm already using something like that with the usage of cells. Each cell contains a bunch of objects that can be checked by stuff like raytracing or bullets. Packs of objects like a vehicle ( chassis, wheels, turret etcetera) are handled as 1 group as well.
I plan to have a blackboard approach. Basically, anytime someone does a LOS check, he stores from what area to what area the check was in, ( I already have rectangles for the navigation map ), and what time the check was made, and the success of the check.

So, if you are looking for a good shot at the enemy, you may choose to move to the same square as your friend who did a successful LOS at him recently. Or, you may use that info to move elsewhere, in order to surrround him.

I want enemies to waste some shots, and hit near the character, so having a sloppy LOS can be good, too. Like treat the player has having a bounding box 50% bigger than normal for the sake of the LOS check. That way it can be sloppy. Another way to slop it up is to not shoot the LOS from exactly the enemy's head or gun, but rather a nearby random location.

This topic is closed to new replies.

Advertisement