TASVideos

Tool-assisted game movies
When human skills are just not enough

Game Resources / NES / Ultima 4

Table of contents [expand all] [collapse all]

Character selection

The first thing you have to do is pick which of the 8 classes you will be. The selection process is a single-elimination bracket between the 8 virtues. So you need to pick the virtue corresponding to the class you want each time it comes up. The other questions don't matter so you can pick the one that makes for less text in the next round.

Your class has several effects:

Virtue

Internally each virtue is represented with a value that ranges from 0 to 100. You start with 50 in each virtue. Various activities trigger increases and decreases, often by multiple points and in more than one virtue. Virtuous deeds can build your level to 99. At that point you can achieve partial avatarhood, represented by a value of 100, by meditating at that virtue's shrine.

Honesty 680C
Compassion 680D
Valor 680E
Justice 680F
Sacrifice 6810
Honor 6811
Spirituality 6812
Humility 6813

Most virtue-gaining activities have a cooldown counter that counts down with steps on the world map. The countdown seems to be 15 steps for most things though shrines are 60 per cycle of meditation. So for example if you give money to a beggar more than once without leaving town you will only gain virtue the first time. There are some very useful exceptions. The reaper in Castle Britain will repeatedly raise your virtue each time you talk with him and tell him no. Flamis, Jaana's campfire in Yew will repeatedly raise your honesty.

Some cooldown counters:

Give to beggar 6803
Sell weapon 68ea
Buy herb 68eb
Talk to Hawkwind 68e2
Give blood 68ec
Meditate 68e1

When you sell weapons or armor to a shop they will offer to pay a certain price that is half of the item's full purchase price. You then get a chance to name an arbitrary price. The shop will accept as high as the full purchase price but going above the suggested price will cause you to lose virtue. On the other hand you will gain virtue by selling at the suggested price or lower.

As long as you give the blind herb sellers at least 1 gold they will give you your herbs. But if you give less than the agreed price you lose virtue. Give the true price or higher and gain virtue. The effect on your virtue is the same whether you give exactly the right price or higher. It is also the same whether you give one gold or one less than the right price.

If you talk to a beggar and give any gold at all you get 5 points of compassion. If you don't give any gold you lose compassion for teasing. It doesn't matter if you don't have any gold to give. If you give every last gold piece you have then you also gain sacrifice. The amount doesn't matter beyond that, one gold is worth as much virtue as one less than your total. The beggar in the stone room of dungeon Despise doesn't award virtue but does expect you to give him some gold. If you don't pay up then he will kick you out of the dungeon without the stone.

The only way to gain valor is to win a random encounter fight by killing all the enemies. Running by moving outside the bounds of the battlefield will decrease your valor. Allies can run, however, as long as the main character stays. The very useful blink spell will magically end the battle with no change to virtue. This applies to random encounters in the outer world and dungeon halls, pirate ship fights and daemon fights near the shrine of humility. Dungeon room fights are different; you do not gain virtue for winning but you can also walk out without losing virtue.

You need to max out all the virtues to attain avatarhood and enter the final dungeon. Apart from that your virtue level has a few other effects. Other characters will not join your party if your level in their corresponding virtue is too low. Hawkwind in Castle Britain will give you a very general idea of how you are doing in each virtue. On getting partial avatarhood in a virtue a line of the ankh is filled in on your status screen.

A few examples of deeds that affect your virtue:

Adding to your party

You can have up to four characters in your party. If you talk to one of the heroes in their town they might offer to join. The requirements are:
  • Your virtue level in their corresponding virtue must be high enough. The barrier isn't high, the starting midpoint is good enough.
  • Your experience level must be high enough. Again, the barrier isn't that high, it's something like one additional party member per level.
  • You need to have room for them in your party!

Do you want to add to your party though? Here are some effects of party size:

  • The number of enemies in random battles increases.
  • If you have more than one character then there are a number of situations where an extra dialog will pop up for you to pick a character. This includes casting magic, opening a chest, touching an orb, shopping for equipment and picking the target of healing magic. Some of these dialogs still pop up when your main is the only living party member.
  • It takes slightly longer to board the ship and pop up the menu, even if the other party members are dead.
  • You need to order each living character in battle.

Taking on one partner can be helpful but things get unwieldy beyond that. While the dungeon rooms are the same regardless of your party size, they are all quite manageable with a good duo or a strong solo character.

You can always drop the party members off at the hostel in Castle Britain and get others or go solo. Picking someone up to sell their equipment is a good way to earn money in the early game and you can always dump them off in the hostel later.

RNG

The primary RNG source is a 32-bit linear feedback shift register. This is quite strong for an NES game as it can produce over 2 billion numbers before looping. Usually only the high byte is used, though some calculations are affected by the carry bit that is shifted out in the shift process. The RNG is at 0036-0039 with 0036 being the value used as the random number.

The RNG shifts each frame you are moving or standing on any overhead map. Not when the menu is open though. It also shifts every time a number is actually used. So it could potentially cycle many times in one frame if there are multiple random numbers used.

So it makes sense that there are basically two ways to manipulate luck: Wait and let the RNG advance each frame or do something that uses a random number. Unfortunately, the fact that movement is quantized to 16-frame (1 step) increments is a major factor in getting the RNG to land on the right place at the right time.

A few examples of things that will call the RNG:

Random encounters

Random battles are controlled by a counter at 00D9 that gets increased every 16 frames (one step) in areas where random battles occur. When this counter overflows past 255 you get a fight.

The amount that the counter increases is determined through a complex algorithm that uses the RNG to get a number from 0 to a maximum value that depends on the terrain you are standing on. The algorithm has the confusing property that the same random number may produce a higher result when the maximum value is lower. Still, the higher max values will definitely produce higher average results over time.

The max increment value for various terrain:

  • grass, ocean, dungeon hall: 8
  • hills, shrubs: 12
  • forest, swamp, bridge, lava: 16

The counter does not increase on the step that you board the ship. It also does not increase in the abyss where there are no random battles. It does increase before you even start moving after closing the menu on a spot that has random encounters or on returning to the world map after a random fight.

The type and number of enemies is random but in a range based on your level and party size. The positioning of your party and the enemies is also chosen at random from several options. One setup places your party and the enemies across the battlefield in two clumps. The other formation places your party around the middle of the battlefield with the enemies all around, suggesting an ambush. You still get to attack first though.

Terrain can also make a difference. Swamps, forests and bridges have their own enemy sets. Bridge fights will always be against trolls and ettins with your party horizontally across the bridge from the enemies. The same random numbers seem to produce the same number of enemies though.

In dungeon halls the enemy formation is always across from your party. Fights against pirate ships are always the same, two boss pirates and six wimpy pirates. Random fights on the ship always place the enemies out on the ocean across from your party on the ship.

Dungeon movement

Inside dungeons the view switches to a first-person perspective, changing things quite a bit. Holding a direction on the d-pad will have you continue moving or turning that direction every 16 frames. But you can move or turn every 15 frames by pressing and releasing the d-pad precisely every 15th frame. There is no frame rule for movement allowing for a much higher degree of luck manipulation--very convenient as we need a lot of luck to get through the dungeons quickly.

After taking a ladder up or down you are immediately given the option to take it again. This dialog can be preempted by moving. Turning and forward/back movement both work and it is enough to hold the d-pad during the screen transition. Hitting the A button to open the menu also works but requires frame precision. If you step onto a square with a ladder the dialog is not avoidable so you are out of luck when a ladder is in your way.

The RNG does not advance each frame while moving as it does on the world map and towns. In fact, it advances only one frame per movement when using 15-frame movement. The random fight counter increases with its usual algorithm every 16th advance of the RNG. So you can move around quite a bit without much threat of random battle. Also, those 16 frames get reset on taking a ladder or entering a room. So it is often possible to navigate through sections of a dungeon without getting any closer to a random fight. The random fight counter does not increase in the abyss where there are no random fights.

Your MP increases each step you take forward or backwards but not when you turn.

In first-person mode the menu comes up a bit faster. Your party hp and mp is always up and you are not subject to the 16-frame rule.

In dungeon rooms clear of enemies you can move around with the same overhead control as the world map or towns. There are no random fights and the fight counter does not increase. But the RNG does get incremented every frame. Unlike towns you gain MP with each step.

While in dungeons (as in towns) cooldown counters do not count down, the moons do not change and the wind does not shift.

Chest gold

When you a treasure chest with gold the RNG determines how much you get, from 1 and 99. The algorithm is the same and completely random regardless of whether the chest is dropped by an enemy in the outer world, sitting in a dungeon or pillaged from town. The amount you get is 1 + (RandomNumber mod 99). The random number ranges from 0 to 255 so statistically the average is about 40 gold.

If you have more than one person in your party you get the option to choose who opens the chest. Your choice has no effect at all. Unlike the PC version and other Ultima games there are no trapped chests. Perhaps the traps were a feature the developers planned but never implemented or removed without thinking of the dialog?

Orbs and stats

The stat-increasing orbs found in the dungeons are very useful. By increasing your stats you can quickly make your character more powerful with none of the drawbacks caused by being on a higher level. The biggest benefit probably comes from increasing Dex which increases max MP, allowing for more powerful spells to be cast. While this is nice for all characters (except for the shepherd and fighter) it allows the Paladin to fill in his only shortcoming. Int is also useful to increase ranged attack accuracy.

The orbs in dungeon Deceit take 200 hp and give 5 Dex. The orbs in Despise give 5 Int for 200 hp. Other dungeons give 5 of one or more stat and take 200 hp per stat. The orbs in Hythloth give 5 of each stat and take 600 hp. You don't necessarily need to survive; you keep the stat gain even if the damage kills you. The main character's death will send you to Lord British, however.

The orbs disappear after use but will be reset if you leave the dungeon or enter a stone or altar room. Dungeon treasure chests are the same way.

Experience Levels

You gain levels by speaking with Lord British after building your experience past certain thresholds. Gaining levels has the following effects:
  • Your max hp increases by 100
  • Your stats increase
  • Random battles get stronger enemies and larger groups

At level 4 pirate ships start appearing. Beating pirates and taking their ship is the only way to get one. Certain areas are only accessible by ship and some of these are necessary to complete the game, so level 4 is the minimum you can finish the game at. The advent of pirate ships greatly changes how the RNG runs in the outer world.

Altar rooms

The altar rooms connect all the dungeons. They are always on level 8, the bottom level. There is an altar for each principle and so each dungeon will have an entrance to 1-3 of the altar rooms that correspond to that virtue's principles.

In Hythloth you can go between the altars of Truth and Love with no fights. Shame connects Truth and Courage without a fight. So you can always reach all three altars and any dungeon without a fight from the altar rooms.

Death

When the main character dies you find yourself transported to Lord British's throne room where you have been revived. HP and MP are both fully restored to all party members. Your gold is set to 400 regardless of whether you had more or less when you died. You do not lose experience; dying is a great way to warp to LB to up your level.

The key to preserving your gold through death and taking advantage of the 400 gold you get on revival is to spend it on weapons or armor. You can buy and sell equipment at the same price if you don't mind taking a small hit to your virtue. One simple abuse is to spend the 400 gold on a sword in the town of Britain and die again.

Shrine of Humility daemons

The shrine of Humility is located down a mountainous path on the Isle of the Avatar. It is protected by daemons who will attack you if you get too close. The way this works is that stepping on to a point north of the shrine will trigger a fight. The fight will always be agains a group of daemons and/or balrogs regardless of your level. The number and formation of enemies is computed the same as other random battles from a range based on your level and the size of your party. Your random battle counter is not affected. After winning or fleeing the battle you are pushed north one square so that the daemon barrier is still between you and the shrine. If you win you get a treasure chest on the square that you end up on.

These daemon fights work the same as random fights with respect to virtue. So you can repeatedly engage and defeat the daemons to build your valor without the time normally needed to build up the random battle counter.

The way to reach the shrine is to pick up the horn from a small island north of Magincia. When you blow it near the shrine of Humility it "makes a weird sound" and the demons will not appear. Entering the shrine or leaving the area will reset this effect but you can just blow the horn again.

Hythloth

Dungeon Hythloth has some unique and convenient properties. It has an extra entrance in Castle Britain that requires walking through some trick walls and using the key to access. This extra entrance is an entrance only; there is no ladder back up and the exit spell takes you to the real world map entrance on the Isle of the Avatar.

From the secret entrance you can descend to level 8 and reach the altars of Truth and Love with no battles. This makes for an easy way to reach the bottom of any dungeon once you have the key. For routing purposes one consideration is that you may be able to get from a stone room back an altar room faster than crawling through the dungeon. Take the stairs from the back of the stone room, cast gate to warp to Britain then use the secret Hythloth entrance to descend to the altar room.

It is possible but painful to work your way up from the bottom floor to the main entrance by crawling through the dungeon and climbing ladders. The exit spell is much more convenient. You can easily reach the remote entrance either from the secret entrance or any of the altar rooms. From the main entrance there are two points of interest. First, a stat orb is located near that entrance. You can max out your stats by touching the orb -> deathwarp to LB -> secret Hythloth entrance -> cast exit -> repeat.

The second reason to exit to the remote entrance of Hythloth is to get to the balloon. You need the balloon at some point to get the white stone from Serpent's Spine and you need to go through here to get it.

Cove

The hidden village of Cove can actually be accessed several different ways. The most straightforward way is to float there on the balloon. This may be the best way to go when you consider that you need the balloon to reach Serpent's Spine anyway.

The other two ways both involve getting a ship on Loch Lake. This can be accomplished by sailing into a whirlpool on the ocean or by attacking a pirate ship that spawns on the lake.

Wind

The aloft balloon floats along in the direction the wind is blowing. The wind has no other effect.

Internally the wind is always blowing in one of the four cardinal directions. The direction is stored at 0062. A counter at 0063 determines when the wind will shift next. When it reaches 0 the RNG will determine the new direction and duration. The counter counts down each step in the outer world but does not change in towns or dungeons. So on exiting a town or dungeon the wind will always be blowing in the same direction as before.

The wind spell will force the wind to change to the direction of your choice. The duration will be random.

Moons

The current moon phase is stored at 6801, represented by a number from 0-23. The moons change phases every 128 active frames in the outer world. That is the time to take 8 steps. The controlling counter is at 003C and it starts counting up from 0 when you start moving on the world map. When you enter town or get into a random battle the counter resets to 0. So it is not certain that walking the same distance or taking the same amount of time will shift the moon the same number of times; it depends where the counter is when you get random fights. This also means that it is possible to tweak the shifting of the moon by manipulating battles to be just before or just after a phase shift or waiting until the moon shifts before entering a town.

The moon cycle's main purpose is to control the moongates. The left moon controls which gate opens and the right moon controls the destination. If both are the same then the warp effect occurs but you end up in the same place. The moongate will not open again despite the left moon being in the proper phase. That effect can be cancelled by getting into a fight or entering a town. If you do either one before the left moon changes the gate will open. So in order to get the black stone and use the moongate without waiting for an entire moon cycle you need to get into a random fight soon after getting the stone.

Combat

Attack attacks an enemy. If the enemy is right next to you it is a melee attack. If not and you have a ranged weapon you do a ranged attack. With no ranged weapon you'll move towards the enemy.

Cast picks a spell to use.

Item uses an item. There are only a few items usable in battle and none of them are that interesting. The flute puts enemies to sleep. The skull kills the enemies but wrecks your virtue. You can throw oil flasks and leave single squares of lava. Not that useful.

Move moves you one square. Unlike a normal free movement situation the RNG does not advance. If an enemy is in your way you melee attack it. If a wall is in the way you don't do anything. If you move off the screen you flee the battle.

Auto hands off your decision to an algorithm that automatically picks an action. In certain situations a particular action is guaranteed. If you moved last turn auto will keep moving you in the same direction. If you attacked last turn and the enemy you attacked is still alive and in melee range auto will attack it again.

Otherwise auto uses the RNG to pick an action at random. It will either move or attack. The move choice moves you towards the closest enemy. The other option is to attack the closest enemy or the last enemy you attacked if you attacked last turn. If the enemy is in melee range then you definitely attack. Otherwise you can do a ranged attack. If you do not have a ranged weapon but you do have MP and herbs you cast the Missile spell.

Since auto algorithm uses the RNG using it is one way to manipulate luck.

Enemy actions in battle

When an enemy moves the RNG is always used to get a random number even if it seems the enemy can only do one thing. If an enemy has magic or a ranged attack then that random number decides what it does. All enemies have a chance to take a step towards you rather than doing something useful. In melee range they will attack instead of move and may still choose to use magic or a ranged attack.

Enemies move towards the closest party member. If they bump into a wall or other barrier they are smart enough to try moving sideways around it. They can get stuck in corners though. They do not try to avoid lava at all.

Speeding up battles

For random battles the main thing is to manipulate only one enemy. The next thing is to get a scatter/ambush formation where the enemies are close to you. The reason for this is that it takes time for your ranged attack or magic to fly toward the enemy. Getting a scatter formation is worth about 26 frames. A similar gain is to manipulate a weaker enemy that will die to a shot from your ranged weapon. Otherwise you would have extra menuing and text to pick a spell to cast.

Naturally you want the enemies to at most move if they even get a turn.

Lava generated by the energy spell can be a big time-saver. When an enemy dies on lava it simply disappears with no text explaining the damage amount or experience awarded.

Using auto saves 3 frames over attack, assuming the auto algorithm decides to attack.

It takes time for enemies to move. So it is faster to save enemies that are stuck in a terrain feature for last. It is also faster to finish off weaker enemies that die in one hit before moving on to enemies that take more hits.

Lava damage

In battle, stepping on lava deals 6-15 damage to heroes or enemies that step on it. The RNG provides the random damage amount. When the lava damage kills an enemy it dies without awarding experience. There is no battle text at all, the enemy just disappears, saving quite a bit of time.

Outside of battle lava or damage squares deal 0-30 damage your character. Being random, it calls the RNG and provides an opportunity to manipulate luck or simply trade off some hp to advance the RNG faster. The range of damage is quite large; good luck can make a big difference when you need to step on those squares. Dispel magic can clear these squares but uses valuable MP, herbs and time.

Ranged attack accuracy

Each time you use a ranged attack a miss counter is increased. There is a miss counter for each enemy slot 1-8. The miss counter for enemy1 is at 6AC4. Firing a bow at enemy1 will cause the miss counter to increase by an amount determined by your Int stat. If the counter overflows, you miss. A paladin just starting out has relatively low Int, will add 33 to the counter each time and miss every 8th shot. If you max out your Int by touching orbs each shot only adds 1 and so only every 256th shot misses. There is no RNG involved and no way to avoid missing if want to make repeated use of ranged attacks. Melee attacks and magic attacks do not increment the counter and always hit.

The RNG does determine the damage within a range determined by your stats and weapon.

Magic

You start out with a decent but incomplete selection of spells. More spells can be learned by talking to various persons in towns around the world and then visiting Spells Unlimited in Moonglow. In most cases the NPC will specifically tell you the name of the spell and its ingredients. In other cases it is less clear. Some spells are mentioned by several different people with each giving some of the ingredients. However, there is actually only one person for each spell that sets a flag for that spell to appear at Spells Unlimited.

The most powerful spell, tremor, is the least straightforward to obtain. Three different NPCs mention the spell but none of them actually sets the flag. That actually happens when talking to a mage in Castle Britain near the secret room with the rune of spirituality.

All spells require herbs. You start out with a few of each herb except for mandrake and fungus so you can cast a few spells before finding an herb shop. The most commonly used one is ash, so conserving herbs usually means conserving that.

You gain an mp with each step on the world map or while moving through a dungeon hall or cleared room. You also gain an mp at the end of each round of battle. In dungeons you can manipulate luck efficiently by taking some steps in rooms and some steps in halls.

Cure

Cure gets rid of poison. Of course in a TAS it is faster to just not get poisoned.

Heal

Heal restores 60 to 75 MP. The RNG determines the amount within that range. Thus heal can be a useful for luck manipulation.

Light

Light lights up the dungeon. It sets the light counter at 68E7 to a random value. The counter counts down as you walk the dungeon halls. Hacking that address can light up the dungeons for free. Light seems to have no effect on timing of movement in the dungeons so it is quite convenient to hack in light while making your TAS.

Wind

Wind allows you to force the wind to blow from a certain direction. The duration is random. It is the only way to control the balloon.

Exit

Exit takes you to the world map entrance of the dungeon. If you take the Castle Britain entrance to Hythloth and then cast exit you end up on the Isle of the Avatar by the balloon.

Blink

Blink lets you escape a fight with no impact to your virtue. It is faster to cast blink than to fight even a single enemy.

Gate

Gate is an extremely useful spell that lets you warp to any of the 8 moongate locations. You can only cast it from the world map. It is not in your spellbook at first, you must speak with a mage in Cove to gain access to it at Spells Unlimited. It requires 32 MP and a pricey assortment of herbs but the ability to warp about the world is well worth it.

You still need to keep an eye on the moons because if you gate to where a moongate is currently open you will immediately enter the gate - probably not what you wanted to do.

One side effect is that any pirate ships you have captured and parked will disappear. This is not the case with normal moongate travel. The reason for this is probably to prevent a situation where there are stranded ships about the world.

Missile/Fire/Ice

Missile, Fire and Ice are all single-enemy ranged direct-damage attacks. They are all starting spells. They vary in the herbs used, the amount of MP used and the damage dealt. Ice is particularly convenient because it is faster to select and cast than fire and does enough damage to kill many types of enemies in one hit. It does not use ash, typically the first herb you run out of. These advantages often outweigh the extra 5 mp over Fire.

Destroy could also be added to this group but it is not a starting spell and requires fungus.

Energy

A powerful and strategic attack spell that creates a 3x3 pool of lava around the target. Extremely useful in dungeon rooms where the room layout and enemy placement causes enemies to stroll to their death on the lava. Lava kills are great; you do not need to do anything but watch and the enemies die without triggering any text. A bonus is that the targeted enemy takes a significant hit.

Energy also useful in random fights against single enemies with 40-50 or so HP. After you cast it on them they step onto the lava and die, saving some time on text.

Tremor

The most powerful attack spell, it is capable of wiping out any group of enemies in one shot. The 40 MP required means that you must have fairly strong magic ability to use it. Anyway, the RNG is used twice per enemy. Once for the hit and again for damage. Though the damage will always be enough to kill. Because the accuracy is RNG-based it is possible to get very lucky and clear large groups of enemies in one shot.

Apart from luck there are two other disadvantages. First, 40 MP is pretty steep. Regenerating the MP takes over 10 seconds. The other potential disadvantage is the relatively long casting sequence. Still, a well-manipulated tremor is often faster than any other method.

The chance that tremor kills 8 enemies is very low, less than 1%. The RNG produces dead zones where there is no chance of it happening for over 1000 iterations. So in some cases it is necessary to choose between a long wait and a survivor that must be killed by some other means.

More useful addresses

World Map X 001c
World Map Y 001d
Gold 6827
Main character HP 687b
Main character MP 6896
Main character experience 68c3
Dialog Flag 0014
Enemy1 HP 6a30
Enemy2 HP 6a31
Enemy3 HP 6a32
Enemy4 HP 6a33
Enemy5 HP 6a34
Enemy6 HP 6a35
Enemy7 HP 6a36
Enemy8 HP 6a37


Combined RSS Feed
GameResources/NES/Ultima4 last edited by TheAxeMan on 2015-02-15 07:05:49
Page info and history | Latest diff | List referrers | View Source