Skip to content
New

Introducing Scale: SurrealDB Cloud for high availability and scale

Learn more

1/4

Integrating Ultima VII with Spectron, part I: the game

Engineering

Jul 30, 202611 min read

Dave MacLeod

Dave MacLeod

Show all posts

Integrating Ultima VII with Spectron, part I: the game

Our newsletter

Get tutorials, AI agent recipes, webinars, and early product updates in your inbox every two weeks

For the past few months SurrealDB has been hard at work on Spectron, the solution for agent memory you can trust. If you haven't heard about Spectron before, here's a short introduction to why we built it:

AI agents forget everything when a session ends. Spectron is the memory layer that gives them durable, long-term memory and recall you can trust - so every agent you build remembers what happened, and can prove where each answer came from.

A great deal of work has taken place during the runup in order to test and refine Spectron's behaviour. One of the challenges when doing so is to test scenarios that are:

  • Complex enough to represent real-world scenarios, but

  • Gated enough that they can be reproduced in the same or mostly the same way.

As someone who experienced all of the 1980s and 1990s when growing up, I already had one solution in mind: the role-playing game Ultima VII, released in 1992. This legendary game pioneered the idea of a world that exists for its own sake, not just to shuttle the main character from one quest to another. In addition, the game is small in size (just a few megabytes), has no cutscenes, and uses an entirely point-and-click interface.

So that's why I hooked Ultima VII up to Spectron and gained not only insights into Spectron's inner workings but enough content to write three blog posts about the experience. This is the first one, which introduces the game and what makes it such a good fit.

But wait, how is a Spectron integration even possible for a game released in 1992? That's thanks to a project called Exult.

Since Ultima VII was released so long ago and has no frame limiter, directly running it on a modern computer will result in an unplayable mess. In fact, it was only a few years before computers reached that point and thus one day in 1998 a team of developers got together to begin the project Exult that would allow it to be played again:

Ultima VII an RPG from the early 1990's, still has a huge following. But, being a DOS game with a very nonstandard memory manager, it is difficult to run it on the latest computers. Exult is a project to create an Ultima VII game engine that runs on modern operating systems, capable of using the data and graphics files that come with the game.

The reason why Exult was allowed to be developed for a copyrighted game is that it is a game engine that allows you to properly play the original game again, not the game itself.

Once you download and build Exult, it looks for a legal copy of the actual game content - which you can buy either through EA or GOG for just a few dollars. If it's not there then you can't play it. But if it is, you're good to go!

And it is thanks to Exult that Ultima VII can be used as a testing platform for Spectron. Instead of having to set up a tool that graphically scans the output on the screen, you can just interact with the events available through the Exult engine and use those.

So now we have Ultima VII and an open-source engine to hook up to through which information can be fed to Spectron. What are the actual details about this game that make it a good fit for testing?

Ultima pioneered the idea of creating a world with a quest that you don't need to follow if you don't feel like it, and Ultima VII was the game in which you have a maximum of interactivity. Once you get the password to leave the first town (more on that subject in a bit), you can simply ignore the main quest if you like and just start exploring.

Just about every item in Ultima VII can be interacted with. Take this screenshot for example.

A screenshot from the game Ultima VII

As the main character (the Avatar) you can do all of the following in just this one screenshot:

  • Use the beds for sleeping,

  • Look through the nightstands and drawers,

  • Read the books (they have actual content),

  • Draw wine from the barrel,

  • Open the sacks of flour, put the flour on a surface, apply a bucket of water to the flour to turn it into dough, and put it into an oven and wait for it to become bread that you can then eat.

This interactivity you a huge amount of leeway when testing and the ability to set up scenarios to test whether certain types of inputs lead to derived conclusions.

The setting even includes books with limited but real content that you can read through. This allows testing the difference between canonical memory in Spectron (uploaded documents) vs. experienced knowledge, which is one of the main reasons why Spectron is so effective. Instead of mushing all interaction into a single vectorised blob, it allows you to decide which content is canonical and should be treated as such versus other types of knowledge.

When connecting Ultima VII to Spectron, if you want to assume that the Avatar sits down and reads every book from start to finish, then you can ascribe them the same authority as a document and have them uploaded to Spectron as such. But if you want to assume that the Avatar skims through them (which is what I ended up going with), then they end up as experiential knowledge instead.

The next blog post will get more into those decisions and refinements made during testing.

NPCs in Ultima VII aren't just quest givers as is usually the case in other games. The majority of them are simply people living out their own lives with their own schedules that the Avatar happens to meet.

Some of them do have issues that resemble quests, but for the most part interaction with them is just based on acquiring information and context.

Just like real people, you'll find NPCs at different locations at certain times of day. Often they will be at work during the day, at the pub afterwards, and at home sleeping when it gets dark. (You can stomp around their bed to wake them up if you really need to talk)

In addition, every single NPC has subjects that you can talk to them about that grows as the conversation progresses or you encounter events in the world that you can then ask them about.

Here's a simple example where if you ask an NPC what his job is...

Since he said that he sells flowers in New Magincia, you can now ask him more about those subjects if you like.

This expanding dialogue allows for testing based on what is known at Point A, followed by a new fact at Point B that changes the narrative and gives you something new to ask the NPC which supersedes a previous fact. Memory supersession is another important Spectron feature, allowing old facts to be superseded instead of retired. If you say that you are a manager and then later say that you are the CEO, Spectron doesn't forget your former state, it supersedes it. Nothing is forgotten.

In Ultima VII you are a hero from this world who returned to Britannia (the world in Ultima) via a gate after a year or so, but in Britannia 200 years have passed since your last visit. Upon arrival you discover that something is awry, that a murder has taken place in the town of Trinsic just before you arrived.

The first thing to do is to find some clues about the murder mystery. This part of the story is a built-in "first quest" in the game that makes it perfect for testing, because you won't be able to leave the first city until you finish it.

This section is the only part of the story that forces you to accomplish a quest before moving on to the wider world, but there's a good reason for that. It's because of...

Back in the day, games were simple files on disks. You would buy a game, get the disks, copy the files to your hard drive, type u7.exe and up pops the game.

Since people could copy those files onto any old disk and pass them on to their friends, game companies needed a way to make sure that only people that bought the game could play it.

This was done through books or items that came with the box that contained information. Since there was no internet at the time, the only way to bypass copyright protection was to know someone that had the game, phone or visit him or her, and get that info.

Group of friends would copy and share info about the same game in the same way that people will share logins today. But without a wider internet to distribute that info, copyright protection was good enough to allow game companies to make money from their products.

With Ultima VII, copyright protection was done through a cloth map that came with the game. At a certain point in the game you would be asked a few questions about locations in Britannia. To get the answer, you would pull out the map and find the latitude and longitude for a place, and then pass that on.

So it's thanks to pre-internet copyright protection that Ultima VII has this structured "first quest". In order to leave the city you need a password, and you can't get the password until you've found some clues to the mystery and then answered the copyright protection questions. That sets up the perfect test suite for a memory layer like Spectron.

As a first-time gamer you'd want to take your time here, but this first quest can be completed in about 15 minutes if you know exactly what to do. It involves this:

  • Agree to investigate the murder, go to the site, find a key.

  • Find the chest that the key opens.

  • Talk to a few people about the people that visited the town before the murder, learn that one of the criminals is a man with a hook for a hand.

  • Talk to the mayor to tell him the details, get the password to leave the city.

This ended up being the perfect testing suite for Spectron as it took a short amount of time, happened in a certain location, and involved a growing knowledge context.

Here are some of the challenges that were tested through the first quest:

  • The Avatar can try to get out of the town before knowing the password but doesn't know the right one. The Avatar later learns the password. How does the password change inside Spectron?

  • A character named Spark is the son of the murdered man Christopher. Spark only says "my father" though, and it's only through other characters that you learn that Spark is Christopher's son. Can Spectron determine who is who?

  • What sort of general facts can be determined from walking around Trinsic and interacting with people? Can it piece together the geography and who lives where? Does it get an overall sense of the atmosphere of the place?

Testing this involved a small Rust app that listened to events emitted from Exult which were then sent to Spectron which was then queried either from time to time via the app while playing the game, or directly through Surrealist or the API endpoints.

But more on that in the following post next week. See you then!

Haven't given SurrealDB or Spectron a try yet? Here are a few links to get started.

Related posts

Our newsletter

Get tutorials, AI agent recipes, webinars, and early product updates in your inbox every two weeks

SurrealDB

The context layer for AI agents.

Documents, graphs, vectors, time-series, and memory.
One transaction, one query, one deployment.

Explore with AI

Stay in the loop

Tutorials, AI agent recipes, and product updates, every two weeks.

Independently verified

SOC 2 Type 2

GDPR

Cyber Essentials Plus

ISO 27001

Trust Centre

Copyright © 2026 SurrealDB Ltd. Registered in England and Wales. Company no. 13615201

Registered address: 3rd Floor 1 Ashley Road, Altrincham, Cheshire, WA14 2DT, United Kingdom

Trading address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG, United Kingdom