Game Internals › War of the Lance › The computer Highlord

The computer Highlord

The original game includes an AI to play Highlord but not Whitestone. This page looks at the details of how it plays.

The nations

The game numbers its nations alphabetically, and the computer's lists use those numbers.

  • 0Blode
  • 1Caergoth
  • 2Goodlund
  • 3Gunthar
  • 4Hylo
  • 5Kaolyn
  • 6Kern
  • 7Khur
  • 8Kothas
  • 9Lemish
  • 10Maelstrom (Blood Sea)
  • 11Mithas
  • 12Neraka
  • 13Nordmaar
  • 14Northern Ergoth
  • 15Palanthus
  • 16Qualinesti
  • 17Sanction
  • 18Silvanesti
  • 19Solanthus
  • 20Tarsis
  • 21Thorbardin
  • 22Throtyl
  • 23Vingaard
  • 24Zhakar

Neraka is the Highlord's capital. Blue marks the four knight countries.

Overall strategy

The computer Highlord is a methodical, defensive-first player with one offensive aim at a time. Every turn it first makes sure Neraka and its own nations are guarded. Then, if it feels strong enough, it picks the next country on a fixed invasion list and sends a force sized to the defenders it finds there. It moves units along a fixed network of route points, attacks only where its local odds pass a threshold that depends on how strong it feels overall, and keeps its weak units back as reserves. It works its plans out afresh every turn, and doesn't co-ordinate one front with another.

1Order of attack

At the start of every game the computer picks one of four strategies: two in the scenario (50/50), all four in the campaign (about 30/30/20/20). A strategy is just two ordered lists of nations:

  • an invasion list, the order in which it attacks countries;
  • a diplomacy list, the order in which it courts neutral nations.

The invasion lists, as they begin (each continues through the rest of the map):

StrategyInvasion order
0
KhurNordmaarGoodlundSilvanestiThrotylLemishSolanthusVingaardPalanthusCaergothNorthern Ergoth…
1
KhurSilvanestiGoodlundNordmaarThrotylLemishSolanthusVingaardPalanthusCaergothHylo…
2 campaign
KhurNordmaarGoodlundThrotylLemishSolanthusVingaardPalanthusCaergothNorthern ErgothGunthar…
3 campaign
NordmaarThrotylLemishSolanthusVingaardPalanthusCaergothNorthern ErgothGuntharHyloSanction…

So the Highlord always starts close to home (Khur, Nordmaar, Goodlund, Throtyl, Lemish). It then turns west towards Solanthus, Vingaard and Palanthus and the knight countries. Silvanesti comes early in strategies 0 and 1 and late in 2 and 3. Kaolyn and the Maelstrom are never invasion targets.

The diplomacy lists start with the nations that naturally lean towards the Highlord: Khur, Kern, Blode, Mithas and Kothas, or Throtyl and Lemish first in strategy 3. They end with the elven and western nations (Qualinesti, Silvanesti, Hylo).

2How bold it feels

Every turn the computer adds up both sides' total strength. Troops are adjusted for fatigue and quality, and each leader, wizard and dragon counts for a lot. The ratio sets an aggression level from 0 to 8:

Highlord ÷ WhitestoneLevelWhat it means
under ~0.90–3No invasion this turn: it guards, holds and picks off weak spots
~0.9 or more4+It invades the next country on its list, and contests Silvanesti and Solanthus
~1.7 or more8Maximum (also when Whitestone has no dragons)

The level divided by 3 (0, 1 or 2) is its boldness in battle: whether it attacks a stack, and whether it stands or counterattacks when attacked.

3Each turn: what every unit should do

The computer works down a list of priorities. Each one claims nearby units until enough strength is gathered, judged against the enemy strength it finds around the place and growing as the game goes on.

  1. Defend Neraka, the Highlord's capital, first.
  2. Defend its own and allied nations, each in turn.
  3. Hold captured capitals: any Whitestone-allied nation whose capital a Highlord unit stands on gets that square held.
  4. Invade (level 4 or more): the first nation on the invasion list that is neutral or on Whitestone's side.
    • A knight country is only chosen when Whitestone units are within 2 squares of its capital.
    • The force is about three times the strength found there (twice above 500), capped at 70% of the Highlord's free strength.
    • Against a neutral it sends a fixed 600 (400 against Palanthus).
    • Wizards and dragons are added until the force is big enough.
  5. Snap up weak capitals: wherever a Whitestone capital is held by 90 strength or less within 3 squares, and Highlord units are within 4, a 300-strength force goes for it.
  6. Contest Silvanesti and Solanthus (level 4 or more): the key squares around Silvanesti's capital, Solanthus's capital, and the Clerist Tower are attacked if Whitestone holds them, or held if the Highlord does. The Clerist Tower is only attacked while its own garrison is Whitestone's and Whitestone has units near.
  7. Everyone else:
    • Infantry, cavalry and Draconians in the far west stay put.
    • Kaolyn's, Lemish's and Throtyl's units go home.
    • Weak units (below 50 strength, other than dragons, citadels, leaders and wizards) become reserves. They go to the nearest capital or route point that is safe: no enemy closer than a friend, and not already crowded.
    • The rest are sent on. Dragons, wizards and Draconians go to the invasion, Blode's units around Neraka, the others towards the next target.
  8. Fleets head for a fixed coastal square by the invasion target. On the way they pick up infantry with orders, to ferry them there.

Finally each unit's goal is turned into a next waypoint. The map is divided into 14 regions, and a table says which of 34 route points to head for to get from one region to another, so armies follow fixed roads. A unit already next to its goal goes straight there. The citadels always head for Neraka.

4Moving

Units move one class at a time: ground troops; pegasi and griffons; dragons and citadels; leaders and wizards; fleets. Each unit steps towards its waypoint:

  • If the way is blocked (enemy, full square, impassable terrain, a neutral country), it tries other directions from a fixed preference list, never straight back, up to four times.
  • It stops when it arrives, runs out of movement points, stalls (less than 2 squares' progress in 4 steps), or would end on a square where it may not stop.
  • In an enemy's zone of control it is cautious. With few movement points left it usually stops, unless its goal is still more than 3 squares away. Dragons, wizards and cavalry push on; other units half the time.
  • If its goal turns out to be held by the enemy, it usually picks another square next to it (wizards, and units nearly out of movement, don't).
  • Dragons, leaders and wizards may first pick a free square of their own near their objective.

Fleets sail between fixed points in 9 sea regions towards the invasion's landing square. There they unload one unit onto free land. An empty fleet in port takes one unit aboard.

5Whether to attack

After moving, for every Whitestone stack next to Highlord units it compares strengths. Fortified stacks are looked at first, then the rest. Attacking from a river or stream weakens the attackers (−30% / −20%). Every Highlord unit next to the stack joins in, except fleets, very weak infantry, and, half the time, units that have a goal of their own elsewhere (unless that goal is a fort).

It attacks if its total reaches:

BoldnessOverall ratioOpen groundFortified square
0, feeling weakunder ~0.72× the defenders1× their strength
1~0.7 to 1.31.3×0.8×
2, feeling strong~1.3 or more0.6×0.6×

So the Highlord is, perhaps surprisingly, readier to assault forts than troops in the open. Fort defenders count double, but the bar is set lower.

Two exceptions:

  • On open ground, dragons alone, with no ground troops beside them, never start an attack.
  • Next to Solanthus's capital (around square 26, 20) it attacks with any force over 50.

6In battle

The computer reads the battle screen's troop counts. Those are fuzzed by up to ±30%, the same fuzz a human sees, so it misjudges too. Its "odds" are 10 × its strength ÷ the enemy's.

When attacking

  • HEAVY if it is stronger (odds over 10), otherwise LIGHT.
  • It aborts if it is clearly weaker (odds under 7) and the target isn't fortified.
  • It also aborts, usually, when it brought few troops but some dragons against a big fortified stack.
  • A computer attacker always advances after a win.

When defending

  • It counterattacks if the attacker is under half its strength and it is feeling bold (boldness 1 or 2).
  • It stands if fortified, or if the attacker is less than 2.5× / 2× / 1.5× its strength (by boldness).
  • Otherwise it retreats, if the square to its south is free (see the quirks).

Dragons

  • Attacking dragons attack when the target is fortified, or sometimes when the computer brought over 150 troops.
  • Defending dragons always use Dragon Fear (see the quirks).

7At sea

A sea battle goes round by round. After each round the computer withdraws if outmatched: as the side that moved, if it is weaker than the enemy times a random 0.7–1.2; as the other side, if the enemy is stronger than it by that factor. If the enemy withdraws, it always pursues. It never sails into the Maelstrom.

PC version The same in the 1990 DOS version, including staying out of the Maelstrom.

8Diplomacy

  • Alliances: each turn it tries to win over the most promising neutral that already leans its way (allegiance 110 or more on the 0–200 scale). It takes that candidate 70–90% of the time (always on turn 1), otherwise the next most promising.
  • War: it declares war on the first neutral nation on its invasion list, a knight country only if it has 3 or more units within 7 squares of the capital. If the first nation is already Whitestone's ally:
    • half the time it looks at the next nation on the list, and declares war on it if it is neutral and the Highlord has 6 or more units near its capital;
    • otherwise, when that ally is Solanthus or Vingaard, a quarter of the time it does the same with Lemish, Kaolyn or Vingaard.
  • Diplomats go down the diplomacy list to the neutrals that are still undecided (allegiance between 70 and 170, a wider band when few neutrals are left). Each nation gets diplomats until its diplomatic pressure reaches a random target.

9Subversion and quests

  • Subversion: on turns 1–22, while fewer than 6 of its units are on patrol, it may send one of a fixed few infantry units on subversion patrol: Neraka's 8th Mercenaries and 4th Baaz Draconians, two Blode ogre units, two Khur units, and one more. The chance is about 20 ÷ (10 × turn + 25 × patrols), so it is high on the first turns and soon small.
  • Quests: its heroes' choices (rest, seek aid, rejoin and so on) are random rolls, weighted towards the middle options.

10Its built-in advantages

  • A computer side gets +2 on its replacement rate: more troops back each turn than a human side with the same option.
  • The level of play option (1–5) doesn't change any of the computer's decisions. It only weights combat results.

11Quirks, and what a player can use

Quirks in the original's code

The rebuild fixes all four by default: the first three with Rules bug fixes, the last with Core bug fixes. Switching a group off on the Play page brings the original's behaviour back.

  • It never falls back on Neraka. The code has a plan to pull every free unit back to Neraka when Whitestone threatens it with more than 500 strength and dragons, but the test can never be true. Neraka is only ever defended by its first-priority allotment.
  • Defending dragons always use Dragon Fear, because the code compares a random number between 0 and 1 with 50 or 75.
  • Whether a defender may retreat depends on the square to its south. Before ordering RETREAT, the computer checks for a free square to retreat to, but its loop never sets the direction, so it checks the square to the south eight times. If that one square is blocked it stands, even with open ground all around. Where its units then go is chosen properly, from all eight neighbours, and heavy losses still force a retreat whatever it ordered.
  • Interception stops after the first patrol sails in. Once an enemy patrol has sailed up to one of the moving side's fleets in a movement phase, the original looks up the rest of that side's fleets from the wrong memory, so they get no interception check. With Core bug fixes on, the rebuild checks them, as the code intended.

What a player can exploit

  • Its roads are fixed, so its armies arrive by predictable routes, and blocking a route point slows a whole army.
  • It only invades when it feels at least about 90% as strong as Whitestone. Keeping the overall balance, especially in dragons, holds it back.
  • It garrisons fixed places in a fixed order. Anything not on its lists is defended only by whoever happens to be nearby.
  • On open ground it attacks only at a large advantage unless it feels strong. But it is readier to attack forts, so a fort is less safe than it looks.
  • It doesn't co-ordinate: units join an attack only if they happen to stand next to the target after moving.
  • When the computer is defending, a blocked square to its south stops it ordering a retreat, so it stays to fight.