Randomization in Kingdom Hearts 1

Ryan Hall

More stories from Ryan Hall

Randomization in Kingdom Hearts 1

When video games release, they typically bolster a community around them that encompasses many different types of people with a wide variety of skills and ideas. Sometimes, these people wish to add or change things in their favorite video games that the developers refuse to do or wouldn’t have considered to have in the initial release. 

These changes are typically referred to as mods, short for modifications, and have a wide array of possibilities and potential for changing things within games. Mods entail many things from simply changing the color of a specific object or adding music to fundamentally changing the game as a whole. One flavor of mod that usually can make a game feel like a whole new experience is a randomizer.

Randomizers can differ from game to game, but typically follow the same rules. A randomizer takes elements from all across the game and places them in new locations. This can fundamentally change a game by giving you items or abilities from the end of the game in the very beginning, or leaving you high and dry with no good skills or techniques. Games like Pokémon have had randomizers for several years, but a series that has fairly recently broken into the randomizer scene, is the Kingdom Hearts series.

In early 2020, Twitch streamer, Valaxor released a new randomizer for Kingdom Hearts 2 Final Mix, a director’s cut version of Kingdom Hearts 2 from 2007, in which all weapons, abilities, enemy encounters, items, and treasure chests are completely randomized to be in new locations, as well as adding two weapons that were previously unobtainable in the base game into the pool for randomization. 

With the advent of this randomizer, talk began amongst Kingdom Hearts fans of potential randomizers for other games in the series. “I had heard people mention the idea of 1FM randomizer before,” Developer of the Kingdom Hearts 1 Final Mix randomizer, Denho said. “At some point I just thought ‘maybe I can figure out what determines the chest rewards.’ I’m a creative person and when I get an idea I need to try my best on it. Once I got some parts working, I kept hearing more and more ideas as to what could be randomized and there’s still no end in sight to how much there is to do.”

The Kingdom Hearts 1 Final Mix randomizer functions differently from it’s Kingdom Hearts 2 counterpart. Whereas the Kingdom Hearts 2 randomizer has a Proof system, in which the player completes a certain task to obtain items to reach the end of the game, Kingdom Hearts 1 is much less linear in it’s randomizer structure.

“It does behave differently from 2FM randomizer in many ways,” Denho said. “Of course, 2FM randomizer is way more developed at this point and I don’t know how much and in what ways 1FM randomizer will still change. That being said 1FM is more exploration based and knowing the secrets that each world hides while 2FM is more straightforward picking up chests in plain sight and progressing through worlds until you find the specific items. Furthermore, there are no plans to add arbitrary item checks like 2FM has, since 1FM has lots of requirements naturally built-in such as high jump or glide in Monstro, books in the Hollow Bastion library, and the Navi G pieces.”

As simple as it may seem to just adjust values within a game to alter the outcome, Kingdom Hearts 1 Final Mix isn’t always consistent in how it decides to reward the player for opening a chest or leveling up.

“Sometimes it’s just a table that defines what’s what,” Denho said, “but other times scripts related to each room in the game do it and that is very tricky to change dynamically. In the end I ended up making a system that can change the in-game reward texts to anything I want while adjusting the player’s inventory / magic / trinity unlocks to match. So the game still tries to give the normal rewards in some cases, but the randomizer just replaces it right away. However, some randomization like level ups involve simply shuffling a table in the game’s memory.”

To someone unfamiliar with programming, this process may seem very complicated, but Denho has a background in programming, as well as previous experience messing around with the memory of the Kingdom Hearts series.

“As for how I managed to do any of this,” Denho said. “Cheat Engine is an incredibly powerful program for finding memory locations. For example, let’s say you have 5000 munny, so you scan for a value of 5000 in the game’s memory. Then you spend some munny, and see which values in the found addresses actually changed to reflect the new value. Similarly with inventory items, you can find in the game’s memory how many of each you have and scan for that. And things like the inventory items are typically stored right next to each other, so if you find one, you find them all.”

With access to the game’s memory, changing a game in real time is now possible, but the use of more external programs to rewrite memory in real time is still required.

“As for how you can make a mod out of a bunch of memory addresses,” Denho said, “you just need to program something that changes the game’s memory based on some logic and randomization. I used LuaBackend by TopazTK, which essentially allows loading Lua scripts and pointing them to the game’s memory space and it comes with the necessary functions to read and write the data as you wish. The game’s files are unaffected, the randomizer only changes the game’s memory once it’s loaded. This happens to be suitable for randomizers, since you will be frequently changing what is randomized if you want to play it more than once. I did also receive help from people who have modded 1FM before, such as Some1fromthedark. He was able to tell me how a lot of these parts in the game work, how the data is stored and so on, which greatly helped me in understanding what to look for.”