How the AI Works in Pokemon Mystery Dungeon Rescue Team Red and Blue

Despite the words’ lack in the title, the two videos linked here, both made by Some Body, are all about roguelike behavior, and likely have implications for Chunsoft’s Mystery Dungeon engine generally, from which the Rescue Games derive.

In terms of depth, this post is rated 4 out of 5: highly detailed information for obsessed fans and game designers.

The first (28m):

And, the second (44m), it goes further into the weeds and is longer:

So, here’s a tl;dw overview of the first video. Despite the length, this is really only a brief summary! Some Body got their information by reverse engineering the games’ code, so it should be considered authoritative.

PMD has three times of actions, moving, attacking and using items. First they try to use an item–if there is no item to use, or the situation isn’t appropriate, or there’s a random component and they choose not to, they fall through to attacking. If there’s no one appropriate to attack, they fall through to moving or wandering. If they’re not pursuing a target and aren’t wandering, they wait in place.

Awake Pokemon try to reach a target: team members try to reach the leader (you)*, enemies try to reach a party member of yours. If they are following someone, they try to reach the target by default moving diagonally before moving orthogonally. This is good to know, and an effective strategy, since it’s harder to escape a cardinal-adjacent Pokemon than a diagonal-adjacent one. If a Pokemon has a target in sight but can’t move towards towards it, it doesn’t move.

(* Note: for teammates, this assumes the “Let’s Go Together” tactic is in effect. Generally, tactics settings are covered in the second video.)

No Pokemon can move towards a target they can’t see. Sight in Blue & Red Rescue Team is two spaces around them, or throughout a lit room they are in plus one space into corridors. Of course, invisible targets can’t be seen, even if they’re nearby. Note, a quirk of the Mystery Dungeon series generally: when standing in the first space of a corridor, you can only see slightly into the room, but everyone in the room can see you. While your default sight range in darkness is two spaces in the PMD1 games, instead of MD’s standard 1 space, you’re still a bit blind when moving into rooms. Notably, that two space distance around you is a square, so in corridors with bends in them you get a bit extra sight distance.

Now comes the interesting part (to people who are as obsessed with roguelikes as I am): what happens if a Pokemon loses sight of its target? In PMD1, it considers the last four locations the Pokemon was in, and tries to go to the one it was visible in most recently. Note in bent corridors, it becomes harder for a character to lose its target.

If the target is four turns outside of the follower’s sight, it has lost track of it, and the follower begins wandering randomly. This can happen if the Pokemon has never had a target (none has come into sight), or the target or follower teleports, the target moves over terrain the follower cannot cross, or the target moves away when the follower is occupied, or, due to the variety of events that can happen in the Mystery Dungeons, other ways.

Followers without targets wander randomly. When they spot a target, they cease moving randomly and pursue it. But if still wandering, in rooms, they pick a random exit, go to it and go down the corridor. In a corridor, they follow it until they reach a room (then entering it), or they reach an intersection. At an intersection, we see an interesting behavior: PMD1 occured before Chunsoft switched over to making wanderering monsters pick random directions at corridor intersections! In later Mystery Dungeon games, including later Pokemon Mystery Dungeons, wandering monsters go straight in intersections if they can. This is behavior that can be relied upon, but not in PMD1.

Outmatched Pokemon can decide to flee, essentially, moving away from their targets instead of towards. In rooms, they pick the exit furthermost from their pursuer, unless they moves them towards that pursuer; then they just try to get away as best they can, likely remaining in the room. A quirk of this: sometimes a fleeing monster breaks for an an exit that is more distant from the target, but not away from at attacker, giving it a free hit. The circumstances around this are complicated: the explanation begins at 7:16 in the first video.

For attacking, Pokemon have up to four moves, and a normal “attack.” This generic attack is not part of the main Pokemon game series. It was present in the first two PMD games, but after that became less effective. In the fourth and fifth PMD games, the normal attack only does five points of damage, and in the Switch remake of Rescue Team, it does no damage at all; it’s only a tool for passing time. But we’re still in the realm of PMD1, where “normal attacks” are not only useful but frequently used, because they don’t consume any PP.

Attacks are chosen based on a weighted average of all the usable moves. Each move has its own weight value; the normal attack weight’s varies according to the number of other moves available.

Ranged attacks are an interesting case. If a Pokemon has a ranged attack, and an enemy that can be attacked at a distance, it triggers the attack routine, where it picks a move from those available, but then only actually performs the move if the attack can reach its target. This can result in an attacker passing up opportunities to attack while an opponent approaches it. Out of fairness, room-range attack moves are only used by the AI when adjacent to an enemy.

Items have a bunch of minutiae associated with their use by the AI, but a lot of it is pretty ordinary. A few highlights: teammates can throw held negative status equipment at enemies, wild Pokemon start using items at Level 16, and there is only one Orb that wild Pokemon can use, and teammates can’t use it: the Rollcall Orb, for them, summons a number of other wild Pokemon into adjacency with them.