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.

My Talk on Mystery Dungeon for Roguelike Celebration

They haven’t broken the talks apart into individual videos yet, but in the meantime you can see my presentation overview of the 31, give or take a couple depending on precise definition, games in the Mystery Dungeon series here, queued up to the proper starting point in the 8+ hour video. The talk portion is about half an hour long (with a couple of interruptions due to the router I was on being a bit flaky).

Here’s an embed, but note that WordPress doesn’t seem to accept the link for embedding with the time code linking directly to my talk, so you’ll have to skip ahead yourself to 6:10:18 to get to it. Or you could watch some of the other very interesting talks on the way there! Either way!

Episode 3 of BS Shiren the Wanderer Recovered

The Mystery Dungeon series of Japanese roguelikes, which includes the Shiren the Wanderer games, has a fair number of obscure entries. There’s “The Rainbow Labyrinth,” a mobile entry that toyed with adding F2P features and never made it out of beta. There’s a few other mobile remakes of early titles that can’t be obtained or played now due to their platforms being discontinued. And back on Super Famicom, one of the very first Mystery Dungeon games, a spinoff and modification of Furai no Shiren, was released for Nintendo’s Satellaview add-on.

Most Satellaview titles are extremely obscure now, with their only remaining remnants that aren’t languishing in a vault somewhere inside Nintendo (if they even exist there) being saved data files on aging flash memory cartridges in the possession of diehard Nintendo players and collectors in Japan. Satellaview was treated as a way of distributing disposable software, games and other programs that were tied to a specific date or time, so there are a good number of lost items for it, and many will probably never be recovered.

Entropy and bitrot are huge problems with computer software of all types, and it’s shocking how little most companies, even Nintendo themselves sometimes, seem to think about recording essential parts of their past. So any successful reclaiming of old data from the land of howling hungry ghosts is good.

Image from Satellablog

That’s why I’m remarking here that Satellablog, dedicated to recovering and making playable as much old Satellaview software as they can, has managed to obtain a copy of Episode 3, of the Satellaview version of Shiren the Wanderer, “Save Surara” or “Save Surala” depending on the tastes of the person romanizing the title. That means episodes 2, 3 and 4 have been found, leaving only the first episode.

Save Surara was a Soundlink title, like the releases of BS Legend of Zelda. That means they were intended to be played at the same time as a special audio broadcast, and contained events that were timesynced with that broadcast. Without the broadcast (which are usually lost now), Soundlink games can’t be entirely played as originally intended, but it’s still better than nothing.

Here is video of Episode 3 in action. It’s about 49 minutes long. It’ll have to be modified to get it into a state where people who aren’t into romhacking will be able to play it themselves:

With three episodes recovered, there’s still hope that someone in Japan saved a copy of Episode 1 on a forgotten flashcart resting in a closet somewhere. Frog bless all of you awesome hardware horders over there!

Shiren 6 Main Dungeon Completion

Whew! At around 3:30 AM last night, I finally was able to play Shiren the Wanderer 6: The Mystery Dungeon of Serpentcoil Island. Five hours later I finished it on my first attempt, with no deaths. I had six Revival Herbs in inventory at the end. (There is a story battle against the boss at the beginning that you’re supposed to lose. I don’t know, maybe there’s a tricky way to finish it? I gave it a good try.)

I did this on my rarely-used Twitch channel. I’ve put the recordings of the play in a video collection, which you can see here.

I’m not going to say this means the game is easy. I can finish Super Famicom Shiren on one try too. I’ve been playing roguelikes for, oooh, over 30 years now? Shiren 6 falls a lot closer to the first Shiren games than Shiren 4 and 5, and I couldn’t be happier about that. I plan on written a full review later, after I’ve recovered from staying up all night playing this game.

I’m sorry that this isn’t more generally interesting, but I’m pretty jazzed!

Shiren the Wander 6 is Out in February!

Chunsoft has announced a new Shiren the Wanderer game, Shiren the Wanderer: The Mystery Dungeon of Serpentcoil Island, for Nintendo Switch, due out on February the 27th! Some of the most popular columns from @Play on GameSetWatch were the screenshotted play I demonstrated of the fan translation of Super Famicom Shiren, and if the comments on the trailer are something to be trusted, there’s still a diehard group of fans out there.

Interestingly, the theme of this one is “back to basics,” suggesting that some of the greater mutations of the more recent games, like the Night rules, equipment experience and such, will be pared back. Some of those rules I like and some I don’t, but I have said that more recent Shiren games, while fun, feel like they’re lacking something. Some of the series enhancements starting from around Shiren 4 (which never got an official English release) I have issues with, particularly, monsters always going straight through blind intersections if they have no knowledge of Shiren’s location, allowing the player to take advantage of the AI to avoid conflict; and that Shiren’s healing rate actually decreases, not just relative to maximum HP but in absolute terms, as he gains experience levels. These are relatively minor qualms though, and most players won’t even notice them.

Here is that trailer:

Some noteworthy elements are the return of Shiren’s lady friend Asuka (who despite appearances is several years older than him), and of giant-sized boss battles, possibly using some of the engine enhancements done to facilitate large Pokemon in Rescue Team DX. I also appreciate that the story appears to be a naked grab for loot! It’s always felt to me that a wanderer’s life is, or should be, a hard-scrabble existence, and while our rogueish characters may affect the fate of the world, they’re still usually in it for themselves. That way, if they fail (and they fail often), you can laugh at them more than feel sorry for them.

I keep trying to do more @Play columns but other work continues to get in the way. I have a fair number of subjects to write about now though, not the least of which being my ill-advised decision to buy the super-skeevy Omega Labyrinth Life on Switch. I feel like paying money for that might have gotten my name on a list somewhere, so I might as well get some column inches out of it!