Jump to content
  • Advertisement
  • 08/01/15 12:06 AM
    Sign in to follow this  

    Memory Markers

    Artificial Intelligence


    Memory is something that is often overlooked in combat games, more often than not when a character becomes aware of you in a combatative action game, they remain aware until dead. Sometimes they may run a countdown when they lose sight of the player and lapse back into their patrol state if that ends before they find them. Neither of these techniques looks particularly intelligent. The AI either looks unreasonably aware of you, or unrealistically gullible, in that they go about their business after they've lost track of you for a few seconds. A memory marker is a simple trick

    ">(The UE4 implementation of which can be seen here) that allows you to update and play with the enemy's perception. It is a physical representation of where the enemy 'thinks' the player is. In its simplest form, it has two simple rules:
    • The AI use this marker for searches and targeting instead of the character
    • The marker only updates to the player's position when the player is in view of the AI
    this gives you a number of behaviours for free. For example, the AI will look as if you have eluded them when you duck behind cover and they come to look for you there. Just from this minor change you now have a cat-and-mouse behaviour that can lead to some very interesting results.
    I was pleased to see that Naughty Dog also use this technique. In this Last of Us editor screen-grab, you can see their enemy marker (white) has been disconnected from the hiding character It is also very extensible - in more complicated implementations (covered in future video tutorials) a list of these markers is maintained and acted upon. This lets us do things like have the AI notice a pickup when running after the player, and return to get it if they ever lose their target.

    So how do we start to go about coding these markers?

    In my experience the most important thing when coding this system in various forms is that your memory markers, in code and their references in script, must be nullable. This provides us with a very quick and easy way of wiping these markers when they are no longer needed, or querying the null state to see if the agent has no memory of something - and therefore if we need to create it. The first pass implementation of these markers simply has two rules:
    1. You update the marker for a character to that character's location when its been seen by an enemy.
    2. You make the AI's logic - search routines and so on - act on this marker instead of the character
    It's worth mentioning that each AI will need one of these markers for every character on an opposing team, and every object they must keep track of. Because of this, it is useful to populate some kind of array with these markers. Think too, about how you can sort this list by priority. When the AI loses track of a target they can grab the next marker in the list which may be an objective, or a pickup they passed. When the list is empty, they fall back to their patrol state.

      Report Article
Sign in to follow this  

User Feedback

Create an account or sign in to leave a review

You need to be a member in order to leave a review

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

There are no reviews to display.

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!