Game Bots

I have a budding idea about a FPS AI system that I'll never get around to writing. The inspiration comes from playing Nova Logic's Joint Operations games — particularly on downloaded community-made missions where insanely accurate enemy NPCs are placed to snipe (often with RPGs) from inside or behind dense foliage. We tend to call that "cheating."

My initial response was to cheat in kind, and modify the foliage textures to be completely transparent, thus letting me see the game essentially the way the bots do. However, that is cheating. I'd prefer a much more awesome solution. My idea is this: let the bots see what we see.

Let us have an AI that renders a display essentially the way players do (albeit probably much at lower resolution and complexity) and uses image analysis techniques to play roughly the way people do.

That is: a bot entering the game may know the shape of the terrain surrounding it, so it can map the pixels of its frame to the terrain. Then it can move in a predictable fashion, so that any pixels* in subsequent frames that don't move as though they're attached to the terrain can become foreground. It could use geometry to determine shapes of and distances to foreground objects. By moving around, the bot would be able to build up a basic spatial map of terrain and static objects. After developing a certain world awareness, the bot could detect movement that doesn't correspond with the static world; then ideally it would build a basic picture of the thing that is moving, categorise it (friend, foe, person, vehicle, etc) and respond appropriately.

* we could assume that the green pixels of a leaf will remain greenish as we move, so we can recognise it as the same object. Dynamic textures/lighting/etc. could be very confusing.

On a contemporary PC like mine, I'm guessing I could only host a single bot (dedicated), rendering frames at a low resolution like 640x480x8bpp. The majority of the work would be in image processing (rather than rendering — although my AGP card also limits the size of the image that can be passed back to the CPU in reasonable time), although for the most part I guess it would mostly be a case of detecting changes between images, and comparing them to predicted changes, which may not be too messy.

The first step could be to render the world in three colours: black for neutral/static, green for friendly, and red for foe. A concentration of red pixels probably means you're seeing an enemy up close, so you might like to shoot.

Both of these solutions (the awesome AI one and the dodgy shoot-at-red-stuff) make the seeing-through-foliage issue redundant, as the bot sees basically the same thing people see. However the former adds a new dimension: effective camouflage. Imagine wearing a ghillie suit, laying down near a bush, and the AI not hammering your position from 200 metres with a PKM! Or even from 2 metres! How awesome.

... Matty /<

Matthew Kerwin

CC BY-SA 4.0
development, games, software

Comments powered by Disqus