AI Visibility in Commandos(1/2)
I was wondering if anyone who was familiar with the game ''Commandos'' knew how the AI visibilty cones worked. I was recently playing the ''Desperados'' demo, which in all essence is ''Commandos'' set in the wild west, and it just occured to me how cool it is(the AI) and more importantly how well it works. How do they get objects to occlude the cone, leaving ''shadows'' within? If you haven''t seen either game, dl the demos to see what I''m refering to. Essentially the world is top-down 2D(iso), ala Fallout, but with what I believe is rough, underlying 3D geometry that they use for the visibility calculation( you don''t see the 3D, but it was implied in a ''making of'' article, though, that didn''t go into any certain depth I was hoping). When one of these visiblity cones are ''looking'' at certain occlusion objects ( i.e. a barrel, mound of dirt, builing )the cone does not pass through these objects, but rather, wherever the cone is occluded, you can see the ''shadow'' of the occlusion object in the cone. Now, wherever the cone does not intersect an object, it simply proceeds on. I may not be explaining this very well, so I''ll try again if you''d like. Ah well, thanks in advance.
Spooty!
Spooty!
I think I understood what you mean, we''ll probably be implementing something similar in our game.
An idea of mine is:
You have a given visibility radius for the unit. Then you find all objects that are in that area, and each of them has some sort of "occlusion box" (similar to a bounding box)
I think it might be best to *subtract* the invisible part from the visible, that should be much easier than adding up the visible part. Anyway, you cast a ray from the unit to each edge of the occlusion box, but it must only be as long as the visibility radius. (or slightly longer so we don''t have to have curves) By doing that for every object you get an invisible area which you could subtract from the visible area. (however that is defined)
I hope this is somewhat understandable, I just got up and am VERY tired![](sad.gif)
I''ll make some sort of diagram I think...
Oh and it''s just an idea I just got, and by no means do I claim that it''s absolutely true! There''s probably some sort of faster/better method.
- JQ
Infiltration: Losing Ground
"Simpson, eh?" -Mr. Burns
"Excellent!" -the above
An idea of mine is:
You have a given visibility radius for the unit. Then you find all objects that are in that area, and each of them has some sort of "occlusion box" (similar to a bounding box)
I think it might be best to *subtract* the invisible part from the visible, that should be much easier than adding up the visible part. Anyway, you cast a ray from the unit to each edge of the occlusion box, but it must only be as long as the visibility radius. (or slightly longer so we don''t have to have curves) By doing that for every object you get an invisible area which you could subtract from the visible area. (however that is defined)
I hope this is somewhat understandable, I just got up and am VERY tired
![](sad.gif)
I''ll make some sort of diagram I think...
Oh and it''s just an idea I just got, and by no means do I claim that it''s absolutely true! There''s probably some sort of faster/better method.
- JQ
Infiltration: Losing Ground
"Simpson, eh?" -Mr. Burns
"Excellent!" -the above
~phil
OK here''s the (crappy) diagram:
![](http://members.nusurf.at/pmjordan/images/visible.gif)
Hope it makes understanding a bit easier
- JQ
Infiltration: Losing Ground
"Simpson, eh?" -Mr. Burns
"Excellent!" -the above
![](http://members.nusurf.at/pmjordan/images/visible.gif)
Hope it makes understanding a bit easier
- JQ
Infiltration: Losing Ground
"Simpson, eh?" -Mr. Burns
"Excellent!" -the above
~phil
Hey JonnyQuest, thanks for the quick reply. Now I understand the concept fine, I was wondering ''code wise'' how it was done. Normally it is easier to do visibilty checks, albeit far more simplified, to do ray intersection tests, maybe multiple vectors at 10'' intervals lets say, supporting a ''cone'' volume. Ray hits target, trigger action...but the cones in Commandos is volumetric. From what I gather you are explaining, the cone is a polygon with subtractive booleans being done to it...therefore, if the polygon does not touch the player, ( hiding behind a rock ) then he is not ''seen'' by the cone. Be as technical as you like! =) Thanks JonnyQuest!
Spooty!
heh glad I could help
- JQ
Infiltration: Losing Ground
"Simpson, eh?" -Mr. Burns
"Excellent!" -the above
![](smile.gif)
- JQ
Infiltration: Losing Ground
"Simpson, eh?" -Mr. Burns
"Excellent!" -the above
~phil
Heh, no...I mean, "go ahead, and describe in greater detail what they may be doing." =) I seriously want to know the design behind the tech. I understood the concept when Commandos first came out, I just never thought to present it to a forum to discuss how it works. If you or anyone can explain the ''code'' design behind it that would be fantastic. I''d like to demonstrate the same effect in my work, and would like a head start on where to begin. So be as specific as you dare! =) Later...
Spooty!
Spooty!
Spooty!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement