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.

Sundry Sunday: Microcomputers: An Introduction

Sundry Sunday is our weekly feature of fun gaming culture finds and videos, from across the years and even decades.

From Periscope Films, a video preservation group that rescues niche short subjects from destruction and obscurity to be enjoyed by all. Many of their videos are of old army training videos or newsreels or the like, but there’s a deeper variety of subject there, waiting to be found. And one of them was a cartoon fro 1982, to introduce kids to the idea of microcomputers.

A microcomputer is an old name for small (compared to mainframes, and desktop-size minicomputers) computing devices made for home use in the 70s and 80s. You still see it once in a while, but it’s given way to just the term “computer,” especially since even some gigantic information companies mostly use clusters of consumer-class PCs, or else pay Amazon to use simulated computing power of that type. The word “microcomputer” was most often applied to machines like the Apple II, the Commodore PET or the like.

In this cartoon (17m), Jennifer is a girl living on a farm and has a gigantic chunk of microcomputer sitting on her desk, and introduces its use to her technologically-clueless visiting city cousin Jack.

It’s amazingly cringey, and perfect to show to friends and acquaintances, both students of what the Subgeniuses call badfilm, and more normal types who have been suitably psychologically altered.

Jack has bigger problems than scoffing at technology, like getting his eyes to focus.
Jack would grow up to become Jon Arbuckle
“Keep looking! It’s back there somewhere!” Jennifer then sneaks off to smoke weed.

In addition to Jennifer helping Jack learn how to use a computer that has 64K of RAM, tops, they also use it to catch a bank robber, by trapping her in their completely automated dairy barn (that contains no cows).

A Youtuber Scraped Info From The Entire Steam Catalog

It’s been up for five days now but is at over 300,000 views, the owner of the Youtube account Newbie Indie Game Dev performed a six-day scrape of the Steam catalog back in October, and not only made a video of interesting observations, but even opened a Github project where you can download CSV files of their data. I predict that certain people will find this information very useful, or interesting, or valuable. Maybe you’re one of them?

The video (11 minutes):

Sundry Sunday: The Animations of WiggleWood

Sundry Sunday is our weekly feature of fun gaming culture finds and videos, from across the years and even decades.

WiggleWood is a Youtube channel that produces humorous short videos with an old-school computer vibe. They could be cutscenes from an old Sierra adventure. None are very long (the longest us under two minutes), but are entertaining enough to have a look at. Here are all five to date:

The Wizard’s Gummy (43s), what is the nature of his system of divination?

Magician’s Brick (31s), who is “Wormdal?” Later videos imply that he’s a wizard too.

The Dark Summoning (45s), here’s Wormdal. He doesn’t seem to be exceptionally evil though, just lonely.

The Magic Lamp (1m43s): The barbarian and the wizard again. It’s best to watch your tongue in matters concerning genies.

And the last one currently, The Cursed Throne (1m47s). Wormdal and the demon lady seem to have reached an accord of sorts. It’s nice to see old enchanters making new friends.

Sundry Sunday: Moving In

Sundry Sunday is our weekly feature of fun gaming culture finds and videos, from across the years and even decades.

In Breath of the Wild, Link can buy and furnish a house on the edge of Hateno Village. In Tears of the Kingdom, it’s revealed that in the interim between games Zelda’s moved into that house in the absence of Hyrule Castle. But it doesn’t seem that Link lives there anymore (he can construct a new house outside of Tarry Town). How did that happen? What went down between the two games?

ColaBear, who makes fun Zelda videos generally, speculates on this event in a 2 1/2 minute video:

Moving In (Youtube, 2 1/2 minutes)

Beating Pokemon Platinum Comprehensively

Obsession is simultaneously a wonderful and a terrible thing. Wonderful to behold from outside, awful to experience from within.

What kind of obsession produces an effort, not just to complete Pokemon Platinum, which after all was sold to kids with the expectation that they would be able to beat it eventually. No, what about an effort to finish every possible game of Pokemon Platinum, using a script that works on every possible random seed, of over four billion, that the game can generate? And also operates mostly on “Nuzlocke Challenge” constraints, where any defeated Pokemon (here, after the first battle) have to be released? But that’s okay, because after that first fight, the player is never defeated?

That this is possible at all is because of Pokemon Platinum’s use of a PRNG, a pseudo-random number generator. While figuring out how, mathematically, to beat over four billion possible games is a formidable challenge, it’s still better than beating every possible conceivable random sequence of events, which can’t ever be done conclusively.

So, that’s what MartSnack did. They found out how to swim through the deep-yet-discrete sea of probability to obtain just the Pokemon, and Pokemon stats, they needed to complete the game, regardless of any random event the game could throw at them, with the same sequence of button presses. It’s a journey that requires frequent synchronization, to make sure no one possible play breaks free of the others, sending that branch of fate down a rogue path. How is this possible at all, I leave it to you to discover in their Youtube video, an interesting hour and five minutes found by MeFi user (and former owner) cortex, here:

Beating Every Possible Game of Pokemon Platinum At The Same Time (Youtube, 1h5m)

Moving Miis from Wii to Switch

Fact: even after the disastrous life of the Wii-U, Miis still exist on the Nintendo Switch, and even though a lot less fuss is made about them now, there are still games that support them.

There are also games that used to support them but no longer do. The version of Super Mario Galaxy on Super Mario 3D All-Stars doesn’t let you select a system Mii to use as the file icon. You’re limited to one of the Mario characters provided! It’s a shame that. But, Nintendo Switch Sports, Smash Ultimate, and of course Miitopia supports them, as do four other games on the platform.

I’ve actually been through the process explained in the below video, by CJCat, which involves using Amiibo to transfer Miis over one by one from a Wii-U that had a Mii collection brought over using the Wii import channel. We played a lot of Wii, and it’s nice to know all the goofy characters we made, and the memories they carry, are on the Switch, even if few games use them any more. I hope the Switch 2 doesn’t forget about them, and that it makes them easier to bring over!

Bringing a Mii from Wii to Switch (Youtube, 9 minutes)

Almost Something on Game Rentals and Instruction Manuals

In a 12-minute video on Youtube, the channel Almost Something discusses Nintendo’s lawsuit against Blockbuster Video over photocopying game manuals. First off, here it is:

The lawsuit was really about Nintendo trying to stamp out the game rental business in the US, which they were largely successful at in Japan. Cartridge manufacturers were genuinely frightened of rentals cutting into their profits, and resorted to measures like increasing the difficulty of games in the US market to prevent players from completing games on a single rental and losing out on sales. Howard Lincoln of Nintendo of America called game rental “…nothing less than commercial rape.” While the Software Publishers Alliance (SPA) managed to get legislation passed that outlawed the rental of computer software, video games were separately defined and rental allowed to continue.

They sought out any legal means they could to make game rentals less attractive. Manuals were one way to do this. While rental stores couldn’t easily copy the games in order rent our more copies, it was fairly easy to make a good-enough reproduction of a manual using a copy machine. Nintendo sued Blockbuster over the practice, which was eventually settled out of court, but Blockbuster sent a letter to the four stores they had who were accused of the practice telling them to stop.

If you were around at that time, you might remember that for a time rented games would sometimes come with their own small makeshift manuals, sometimes taking the form of an adhesive sheet stuck to the plastic case. It seems these were a small industry that saw the lack of durable instructions provided with games as a little economic niche they could take advantage of.

The lack of manuals supplied with games may have been the reason for a weird quirk on one of Nintendo’s games. The game Startropics has one infamous place where the game asks the player to enter a code from materials supplied with the game. There was a sheet of paper that came with boxed retail copies of the game, an Infocom-style “feelie,” that if soaked in water revealed a code (747) that had to be entered into the game at one point to continue. The code wasn’t revealed anywhere in the game, so players without the sheet couldn’t progress.

The sheet, with the code revealed. (Image from imgur.) The code is discussed in more detail on gaming.stackexchange.com.

Interestingly, while the WiiU Virtual Console version of Startropics has an online manual that reveals the code, the Switch online version has no manual, and leaves players stranded there unless they look up the answer online.

How Many Bokoblins are in Tears of the Kingdom?

Now that the release of the game is some distance behind us, it seems apparent that, after all the videos about death machines and Korok torture have run their course, The Legend of Zelda: Tears of the Kingdom doesn’t have as much meme longevity as Breath of the Wild had. This is probably because BotW got some of the categories of video (like harassing Yiga) out of peoples’ systems, and also how brightly the Zonai device roundup compilation flame burnt for a while. Even Wolf Link’s minimalist run collection has slowed to a halt lately.

This is why I was pleased to see a video appear yesterday from MiahTRT both telling and elaborating upon how many Bokoblins there are in Tears of the Kingdom. The brief answer is 3,509 in the various tiers. Some of them can advance in power through the game due to the game’s hidden experience mechanic, a carryover from Breath of the Wild, that causes the monsters in the game to become more powerful depending on your actions in the game. (It does not increase Link’s power, although it may cause stronger items to generate.)

It’s a short video, at about four minutes, and unlike many videos seeking to stretch themselves out to increase ad revenue, it gets right to the point in answering its question. Thanks, MiahTRT!

How Many Bokoblins Are There In TOTK? (Youtube, four minutes)

Someone Other Than Me Talks About Rampart

It’s true! Thanetian Gaming on Youtube has an 18-minute video about Atari Games’ neglected classic Rampart. Remember back in September when I posted a strategy guide that no one asked for over four days? Judging by his video he could stand to read it, but no matter, I’ll accept anyone talking about my favorite arcade game in a positive light!

Score Keeping on the NES

Sometimes I feel like I should put a content warning here when the technical level of a post is higher than usual. This one would probably be a five out of five for geekery. It’s a video from NESHacker on counting score on the Nintendo Entertainment System. But I don’t want to discourage you from watching it! It’s nine minutes long, and it contains a definition of the term double dabble.

Human-readable numbers are tracked by computers in a number of different ways. Nowadays we basically just do a printf or some version of it, but on a 1 megahertz platform, optimization really matters. It’s easy to think of computers as being impossibly fast, but in truth speed only ever counts relative to the efficiency of the algorithm you use. Computers are fast, but they aren’t all that fast.

One of the big tradeoffs in processor design is, fewer complex instructions that do a lot but take a lot of cycles, and processor complexity, to execute, or many simple instructions, each doing little and being relatively simple, and not needing a complex processor design to implement.

The 6502 microprocessor generally follows the latter design philosophy. It made some important tradeoffs to keep costs down. For example, it doesn’t have hardware that can multiply arbitrary numbers together. It relies on the programmer, or else a library author, to use the instructions given to code their own multiplication algorithm, if they need one. The result is going to be slower, probably, that if the chip had the circuits to do this automatically in silicon, but it reduced the cost of the chip, basically allowing more to be made, or else increasing the profits for the manufacturer.

Personally I’m a fan of just storing the score as a series of digits that match up to their positions in the character set. Gain 1,000 points? Just bump the 1000s-place up by one, and if it goes past 9, subtract 10 and bump the 10,000s place. That’s a tried-and-true system that many games use, and works well if all you ever have to do is add numbers. Comparing values, like for detecting extra life award levels, make things slightly more complex, but not by much. There’s sometimes other factors involved though, and that may explain why Super Mario Bros. uses different systems for its counters, as explained by NESHacker.