Memory Markers
Inspired by the 'Simplest trick I know' series of GDC talks, I've begun to document all the small code and design tips and tricks I've picked up on my way through the industry
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

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:- You update the marker for a character to that character's location when its been seen by an enemy.
- You make the AI's logic - search routines and so on - act on this marker instead of the character
Related Tutorials
What To do If Your Game Received a Copyright Complaint
This tutorial explains how to respond to copyright complaints and why you shouldn't be scared of Apple's emails. It inc…
Video Game PR Basics
A brief guide to the very basics of video game public relations.
Felicia McEntire
Building a Discord
Mega Cat Studios walk us through the journey the followed in setting up their Discord server.
Mega Cat Studios
Publishing 103 - What Publishers Look For in Games
A detailed look at what publishers want from a game, and the materials that you as a developer should have prepared.
Publishing 102 - How To Find The Best Publisher For You
In this article, I will be detailing the tactics you should use while you are on the search for the best publisher. It’…
A Guide to DIY Market Research for Indie Game Devs
Ah, market research. Just seeing those words probably sent shivers down your spine. Market research for indie game devs…
Discussion