0
\$\begingroup\$

I was just recently adding the ability for my in-game entities to have their own Frustums, with the intentions of making them able to see enemies later down the road of my development cycle. My custom approach works great, but I find myself left with a suprisingly staggering question. What kind of perspective should my entities have? What is the standard for modern games? Here is a picture to show my implementation in action:

enter image description here enter image description here

The Settings for that Frustum are as follows:

            // Just winging a random projection; worked pretty well, actually!
            Matrix4 entityProjectionMatrix = Matrix4.CreatePerspectiveFieldOfView(0.5f,1f, 0.1f, 50f);
            // Calculated by hand for testing purposes
            Matrix4 entityViewMatrix = new Matrix4(
                -0.02840426f, -0.1789574f, 0.9834467f, 0,
                0, 0.9838437f, 0.1790296f, 0,
                -0.9995965f, 0.005085204f, -0.02794535f, 0,
                50.50341f, 6.017713f, -46.88488f, 1);
            BoundingFrustum entityFrustum = new BoundingFrustum(entityViewMatrix * entityProjectionMatrix);

Now, clearly, those settings are a little lacking in the side-view peripheral department. I also don't think the entities should have a large frustum like players, who can see damn near anything(the player Frustum is absolutely massive). I feel as though something small, yet realistic would suffice, but I don't know if there is already a current standard for how much an entity should be able to see. I'm sorry if this question is broad, but it is a problem, and I am looking for some clarity/literature on the topic.

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

There isn't really a standard - it's going to be dictated by the needs of your gameplay.

For Splinter Cell, determining whether the player (or suspicious evidence) is seen by an AI is the heart of the stealth gameplay. We needed a lot of nuance - consideration of peripheral vision versus direct line of sight, illumination, AI alertness level, movement state, partial occlusion, etc - but we also needed it to be predictable & intuitive enough for players to learn and plan their tactics around.

As recently as Blacklist, our AI used multiple overlapping detection volumes, and designers could fine-tune their sizes, offsets, near and far detection speeds, and tolerance for shadow/occlusion, in order to dial-in the behaviour to just the right difficulty for each case.

Screenshot of vision boxes in Splinter Cell Blacklist

These volumes aren't necessarily frustums either - a perspective camera view frustum gets taller and wider in the distance, but in practice people don't really look up very often, and climbing along ceilings to get a drop on guards is one of the thrills of a Splinter Cell game. So capping the detection height (for guards who haven't been alerted to look up) can make for a better play experience.

Typically our AI had a long narrow "search beam" that would detect quite rapidly in a corridor shape directly ahead of them, peripheral volumes to the sides with shorter range/progressively less sensitive detection, and a small "bump radius" to react to threats in their immediate personal space (which would be missed by a strict frustum-based approach)

I expect you'll need to do some similar case-by-case tuning to find what's right for your project. Try exposing your detection parameters for runtime tweaking if that's supported in your engine, or hot reload them from a configuration file. That way you can play the game, get into a situation where it feels like the AI should / should not see something, then tune the parameters to get that desired result. Repeat until you're happy with their level of perception.

More details about the details of Blacklist's detection scheme can be found in this GDC talk by AI lead Martin Walsh, which is where the image above is from. They're also accessibly summarized in this Game Maker's Toolkit video.

\$\endgroup\$
5
  • \$\begingroup\$ You actually worked on Splinter Cell? Sorry to gush, but I love those games! \$\endgroup\$
    – Krythic
    Commented May 1, 2016 at 17:13
  • \$\begingroup\$ Much appreciated! I did UI design on Blacklist. I can't take credit for any of the techniques above - that was the work of our amazing AI team - but I got to learn about the guts of it when designing the detection feedback systems. \$\endgroup\$
    – DMGregory
    Commented May 1, 2016 at 17:16
  • \$\begingroup\$ I know this isn't the place, but do you think you guys will ever bring back the ui Stealth Slider(shows current light level on player) from Splinter Cell, Pandora Tomorrow, and Chaos Theory? I hate that the new games don't have it. And thermal vision! \$\endgroup\$
    – Krythic
    Commented May 1, 2016 at 17:20
  • \$\begingroup\$ You're right, this isn't the place for that kind of question, and I wouldn't be able to answer it anyway. ;) \$\endgroup\$
    – DMGregory
    Commented May 1, 2016 at 18:20
  • \$\begingroup\$ Understood. Keep doing what you do. \$\endgroup\$
    – Krythic
    Commented May 1, 2016 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .