Image Based AI Detection

I’m sick of how modern game AIs being too smart, or too stupid, or simply just blind or born with gift of X-ray vision.

I don’t know if this already been done or anything. Just had a serious thought about this the other day, and realized I’d share this with the world. I hope the idea isn’t anywhere a secretly copy-righted blahblahblah.

How I assume normal AI Vision works:

When game AI want to see you, they usually do a ray-trace from the AI’s eye position to your character position, if there is a vision block/collision in between the ray-trace, then it fails, and AI won’t see you. If the ray-trace is successful, then it detects you and start killing you.

This is the solution, and it’s working. But wait until you hide behind a dense foliage, with no collision, but you should be perfectly blocked out by the foliage from the enemy’s sight. And you got detected anyway, how, because the foliage has no collision. Or, there are transparency gaps on the foliage, and the AI ray-trace just incidentally went through the open area of the transparecy, and successfully traced you, and your stealth failed.

The AI happens to recognize you as a threat, behind one centimeter open gap from 20 meters away. No human being can do that. Of course that’s why It’s AI.

But AI are suppose to simulate Human activity, if I am not wrong. X-ray vision isn’t human capability.

So, Pixel/Image based AI Vision system (AI image G-buffer???):

It’s based on a power of 2 resolution image, like a camera. So the when it’s activated, the AI shoots an image or a short video at your character of grayscale image, or pure 2 bits bool 0 and 1 image. So the subject that AI is looking for, will be posed as 1, white, and everything else is posed as 0, Black. So whether in realtime, or post-shot, the image or video consists of 0s and 1s will be calculated/processed. Basically, averaged. And this averaged value can determine if the subject should be visible. 32 by 32 pixels might just be enough for general AI visions.

For example, a player behind foliage, 5 percent of his body is visible to the enemy, ray-trace without collision will obviously detect player, and ray-trace with transparency might detect, and might not. So AI took a shot of image at player. 5% of his body is actually seen, but the averaged image color is just 5%, and the detection threshold is 50% gray, so not detected.

It’s going to cost some performance, so it doesn’t have to always enabled for every AI at anywhere. Just when player gets close to the AI, or specify which AI can snipe from miles away.

No more vision blocking volume. Don’t need it. But you need to make sure all assets are not being culled on the back face(Back faces are considered invisible).

Make use of custom G buffer, so maybe it can also be used as Player’s vision, for custom vision tools like NightVision Google, thermal Google, etc.

nVidia’s Vechicle GPU kinda had the power to do so with 720p cameras, 12 of them? Maybe games can utilize 1/20 of the resolution, and also 12 of them? I don’t know.

Better way to simulate AI with real human vision? maybe.

I don’t think this is suitable for games. You’d have to render the scene from the POV of every AI entity, which would lower performance by an extreme amount.

If I’m correct, one of the newer stealth games (Assassin’s Creed or Metal Gear Solid or something else, not sure) allows the player to hide in bushes. I don’t know how they’ve implemented this, but personally, I’d go with creating a trigger volume that makes the player “invisible” when he’s inside the object.

Torque 3D has an AI solution that allowed you to set the overall background colour of a level and essentially you were invisible from AI when hiding behind foliage and stuff of this colour … the problem was that you could only set one colour and you had to set it per level.

Now for the problem at hand … the solution is remarkably simple … a empty box that is not rendered and has no collision but blocks line-of-sight from the AI. You could then push this forward by allowing the player to have a cloaking device and in essence rendering this box or plane in front of them … they would essentially be blind to AI from the front … but could still be seen behind.

This is how I would tackle this problem … all the happiness of AI not seeing you with none of the performance hits or restrictions from other solutions.

This is exactly how it should be done. You can use the “Trace Channels” in the collision settings to set “Visibility” to “Block”, then you do a “Line Trace by Channel”. I actually go into my collision settings in the Project Settings to add in a custom visibility channel for blocking my AI’s vision called “Game”.

I don’t think you’d need the extra geometry - just manipulate the trace channel of the character at runtime for your cloaking effect, or use a bool to manipulate AI behavior based on player = cloaked. Traces are much much more efficient than any image recognition solution and get you most of the benefits of the solution you suggest. Your example of the bush can easily be solved by making sure the assets have trace blocking set up properly. You could even set up a lightweight silhouette recognition setup where after a valid trace the AI traces to 3-4 hitboxes on the character that represent the head, body, arms, etc. and only ‘sees’ the player if most of the character is visible.

Man… for small studios, or one man studios, the mind power is pretty limited. Having too many channels and invisible stuff is bad for the general health of the studio, and the game code. Pfffffff LOL

I encourage more simplicity on usability side of things with a little cost of performance instead of having worse usability, complications and trouble with a minimal amount of performance boost.

nVidia graphic cards are seemingly capable of getting a lot of buffers so… why not make a use of it.

Maybe channels are the ultimate solution. I don’t know and I can’t tell if any way is better or worse. Pros and Cons always come together as whole. Just want to know what people think.


this has been used in some game before but I can’t remember which one. I can find out if needed :slight_smile:

So take a look at this. It is just illogical for AI to behave that way. (Except cardbox. I love cardboxes, everyone should, too)

I’m not here to debate a way to achieve what we do, we already have plenty way to do such things. I’m here to talk about the possibility of the future, and what might be the most functional, and understandable way of design.