Chris Shinnimin

Final Fantasy Bot Project Journal

Final Fantasy Bot Project Journal

A fun personal project to learn LLMs and React, and rekindle my love of a favourite childhood game.

September 9, 2025

Prev | Project Journal Entries | Github | Next

A New Strategy: Retrieval Augmented Generation (RAG)

Key learnings today:

  • LLMs can't do everything.
    • My initial assumption was that if I was explicit enough in my training instructions, I could have the LLM do everything for me. I've quickly realized that the project needs to be architected to combine both LLMs and more traditional information lookup tools like APIs.
  • Input-Output Pairs train better than a large JSON structure.
    • The LLM had a lot of difficulty understanding what I needed to to with just the JSON "RAM Catalog" I created last week as a training input. Today I learned about Input-Output Pairs which are datasets consisting of prompts and their desired responses. I had a lot more success today with this training method in getting the LLM on the right path.

Envisioning a New Architecture / Flow

Today I learned about the Retrieval Augmented Generation (RAG) strategy. Before undertaking this learning project I had only interacted with an extremely powerful AI agent provided to me by my employer with a professional license - Augment AI. Augment seemed easy to explain complex concepts to and was able to retain all of my instructions over time. Now that I am attempting to build something fairly complex with a more lightweight model that can run on my laptop and can only have limited training data and context retention, it only seems natural to build more traditional modules into my app that can easily handle typical data retrieval tasks.

Instead of trying to train the AI to not only understand the questions it is being asked about the game, look up relevant hexadecimal values from the NES RAM and teach it to understand what all of the hex values mean at different memory addresses with many lookup tables, why not offload some of those chores to a "RAM lookup Module" in the React app? With that in mind, here is my new idea for a high level flow:

drawing

  • The bot app will have an input textbox to take questions or commands from the user.
  • The message in the input textbox will be forwarded to the LLM. The LLM will be trained to distinguish between three types of messages - RAM Read Requests (RRR), Ram Write Requests (RWR) amd Strategy Requests (SR). More about these below.
  • Depending on which type of request it is, the LLM will be trained to handle it accordingly. I don't know yet whether I will use a single model for all three tasks, or whether the main agent LLM will offload these tasks to other models trained specifically for their individual tasks. I will need more tiime to explore the pros and cons of each approach.
  • If the LLM needs information from game memory, it will make a request back to the bot app RAM Lookup Module (RLM).
  • Once the LLM has the information from the active game state that it needs, it will formulate it's final response or action.

RAM Read Requests

An RRM is a message in which the user is asking a question that can be answered by looking at the game RAM. An example question:

How many hit points does the Ogre have left?

Because we only need to understand where in memory the Ogre's HP is stored, and report the value back to the user (no changes), this is an RRR.

RAM Write Requests

An RWR is a message in which the user is issuing a command that the bot will need to alter game memory to satisfy.

Reduce the Ogre's HP to 1.

In this case we still need to understand where in memory the Ogre's HP is stored, but we also need to write a LUA script to alter the value in memory. This is an RWR.

Strategy Requests

This is a third category of request whose definition may evolve over time. Right now my idea is that the strategy request LLM will be trained on a large dataset of Final Fantasy walkthroughs and adventure guides widely available on the internet. An example is a general question that doesn't pertain to game state such as:

How do I obtain the Mystic Key?

This is a subject well covered in the online documentation and is a simple example of an SR. Once I am successful with this, I will shoot for something even more complex - the idea of combining strategy questions with active game state. Example:

What should I do next?

This question requires combining the knowledge of the current game progress with the general information available on the internet. Not sure if I will make it this far but it's nice to think about.

Simplify Complex Tasks

Last week I was attempting to teach the LLM how to look up individual characters of the names of the party members and put them together to form the full name. This proved to be too difficult task for the lightweight Llama 3.2 3b LLM, especially since the data in NES memory is not represented as ASCII. It will be a much easier task for the FFBot App to just look up the character names itself and inject them into the training information we give the LLM. I will be looking to better organize a more comprehensive list of tasks for each module in the coming days.

Prev | Project Journal Entries | Github | Next

Demo of Today's Accomplishments