Ultima Game Developer: NPC Schedules

Created Worlds

Created Worlds

Beginning with Ultima V, all characters in the game followed schedules. As the complexity of the games increased, the complexity of the schedules do likewise. During Ultima VII and Serpent Isle, a blacksmith characters might go to bed at night, eat breakfast in the morning, go to work and craft items using items around them, go to a tavern for lunch, return to work, leave at the end of the day and go home for dinner. A farmer could path around their farm, gathering eggs from chickens, milking cows, and threshing grain, taking breaks as appropriate.

When designing an Ultima-style game, NPC schedules can add realism and believability to your world. In a living world, a shopkeeper does not stand at their counter, day and night. Innkeepers go to sleep and must be awoken if a late traveller arrives. Farmers would scarcely trust a stranger stalking about their barn at night. These kinds of things can be done using schedules.

Implementing schedules is a combination of AI, pathfinding, and scripting. Creating a guard who paths between guard houses during the day is a simple script, following a predefined path between certain game hours. Once off duty, that guard would leave his armor and halberd in a secure storeroom and go to dinner, or back to the barracks. It may take dozens of individual scripts, some unique to a single NPC and some broad enough to be used on an entire group, along with realistic crowd creation and handling, to bring your living world together.

Creating an Ultima game does not *require* schedules. Ultima IV did not feature them, and was considered one of the best CRPGs ever created. On the other hand, Ultima IX did away with them as well, and was considered remarkably less favorably. When using a day/night cycle, it is ideal that, at a minimum, a NPC schedule moves them from their business to their home. Failure to do so dramatically reduces the believability of your world.

The extent of schedules is directly related to how complex and believable your world is. Let’s take a look at three example games:

  • In Game A, the tavern owner has no schedule. He stands at his bar, unmoving, until the player approaches him and engages him in conversation. While simplistic, he is functional.

  • In Game B, the same tavern owner has a basic schedule. The game begins at sunrise, and the NPC spawns in his home. He paths from there to his shop, where he stands behind the bar for four hours, allowing players to converse with him. At noon, he paths to the small table behind the common room, where he has a meal. During this time, he will respond with a script that asks players to come back later. After an hour, he returns to the bar. In the evening, he leave the tavern, locking it behind him, and makes his way up to his home, and falls asleep at dusk. He wakes up at dawn and repeats the same schedule.

  • While Game B is much more realistic, similar to Ultima V, VI and VII, it is possible to greatly increase the complexity of the NPC, if desired. Game C has the same script as before, with the following additions. If the tavern owner is not engaged in conversation (for at least a couple of minutes), he will begin performing one of several actions: cleaning the bar, pathing out and cleaning tables, conversing with a serving wench, taking drinks and food to patrons, etc. After hours, he herds everyone out of the bar, and will not leave unless all players and NPCs are out of sight (possibly allowing a stealthy character to remain). He takes the coin from the lockbox behind the bar and locks it in safe at his home each night. The time he falls asleep and awakens varies by 1-60 minutes each day. On Saturdays, he opens late, just before noon, after taking the coin for the week to the local bank. The tavern remains open until midnight on Saturdays. He leaves the bar locked on Sundays, sleeps in a bit, and travels down the path out-of-town that afternoon, where he sits next to his wife’s headstone in the town graveyard.

While that NPC in Game C is unique, it takes MUCH longer to design a specific NPC than it does to create general routines for a class of NPCs to perform. If all shopkeepers have the same schedule as Game B, each only needs a few unique identifiers (i.e., home, work, etc). You wouldn’t want them all to use the same schedule as Game C, as it is far too tailored to a specific character, and leads to very crowded cemeteries…

You might also combine certain schedules, however; Shopkeeper01 has the schedule from Game B, plus an idle schedule and weekend schedule that turns them into the character from Game C. Shopkeeper02 has the same Game B schedule, but only has an idle schedule unique to their shop; their shop is open every day, so they simply repeat the daily tasks. Shopkeeper03 may have the same Game B schedule, a unique idle schedule, and their weekend schedule is simply to wander the town and speak with other NPCs. This makes the game much more interesting, as learning a town’s schedule becomes interesting and unique.

When creating schedules, especially for NPCs that players will interact with, remember to have them readily available for the majority of their time. For example, in a 24-hour day, expect an NPC to be available for 14 hours of it (they work at 6am, take an hour lunch, and leave for home at 9pm, meaning they are available 6-12, 1-9). Generally, shopkeepers will rise an hour before sunrise, and their business is open until just after sunset. This makes it much easier to access them than if they work 8-5. Similarly, when a NPC is performing a task from their “idle” script, they should still be available to run their normal interactions.

Do you have any preferences, or pet peeves, when it comes to schedules from the Ultima games? How would you make them better?

Browncoat Jayson

Join me in New Britannia!

You may also like...

2 Responses

  1. Iceblade says:

    I think I really like the idea of two NPCs for certain shops that fill more urgent needs similar to how Archon did it. For example, all Inns had a simple night clerk NPC to handle night shift Inn/Tavern needs.

    Something similar could be done with healers: have an early to afternoon shift (5 am to 3 pm) and an afternoon to twilight shift (3 pm to 1 am).

    Obviously, luxury, provision, and armor/weapon shops would probably have more reasonable hours with just one NPC per task 7/8 am to 5/6 pm.

    A smith and shopkeeper arrangement actually works out even nicer here with the smith working most of the day and filling in a late evening or early morning shopkeeper role while the shopkeeper manages for the majority of the day.

  2. I’m still pounding out some fundamentals before delving into the realm of AI, but it’s going to be perhaps the biggest part of my game. As I’ve mentioned, when you disconnect from the server your player character will continue playing under the direction of AI as you’ve customized it (or not), essentially becoming an NPC. “No down time” basically.

    Let’s say a player plays for one hour a day on average, seven days a week. That equals out to 4% of their character’s life being directly controlled and 96% being controlled by AI. Multiply this by my target goal of having up to 2000 players per server and you get a hell of a lot of AI calculations. The server would be more of a simulation with intermittent (but constant) guidance from the player base.

    Because different players will require different responses to any number of natural and societal stimuli while they’re away, I thought a more organic approach to AI would be fitting. I want to incorporate basic things like moving from point A to point B at certain times, expecting someone to deliver fish for you to sell while someone else invests the money from selling them into the blacksmith shop at a specified rate of return, etc., but with adaptability should betrayal occur or the markets change.

    My first thought was to create tiers of AI patterns. The top tier would be your preferred system of interaction. The second tier would occur if the top tier failed to meet your specified criteria. Eventually you would failsafe to pure survival mode, perhaps living in the wilderness to hunt and fish, perhaps resorting to a life of crime (all tiers customizable of course).

    Each tier would be comprised of a number of variables including specific places, people, animals, plants, needs, salable goods or skillsets, aversions, affinities, etc., so you’d be crafting your character’s general behavior with an eye to survival and ultimately success.

    Anyone have any ideas about how such a system might work? I’m still in the brainstorming stages, so am very open to suggestions. I want to implement things like:

    “I must have X amount of food per day, or failsafe behavior Y will execute until X amount of food is obtained.”

    “Even if I’m starving I will not commit action A, but will certainly commit action B until I have food.”

    I’m thinking of a model where the player can choose any number of actions that they will or will not do to obtain specific results, whether economic or survival related. The ultimate customizable AI for different personalities.

Leave a Reply