Green MoonWorld and field
Enemies you can see coming
Endymion asked whether random encounters could become enemies you see on the map. Reading how the game picks a fight showed it already had first strikes, ambushes and a button for any battle. The hard part was drawing an enemy outside a battle.
Random encounters are part of Skies of Arcadia’s DNA: a corridor you just want to cross, the screen shatters, and it’s another three Looper fights. Endymion asked me whether the port could do what a lot of later RPGs do instead, and put the enemies on the map, where you can see them and choose: fight, sneak past, or catch them from behind.
Before designing anything I wanted to know exactly how the game decides to start a fight now. Some of what I found, I suspect even long-time players don’t know.
How a random battle actually starts
- A battle can only start on a frame in which you moved. Stand still and you are completely safe, forever. Speed doesn’t matter either: a slow walk across a room rolls the dice on more frames than a run does, so walking is actually the more dangerous way to cross a room.
- There’s a grace period. After a battle the chance is zero for 30 frames of moving, then climbs steadily. Per moving frame it works out to (frames since the last battle − 30) × the zone’s rate ÷ 2,880,000.
- And a pity timer, in reverse. After 480 moving frames without a fight, the chance jumps about sixfold.
- Each map has up to eight zones painted onto its floor, each with its own rate, its own battle arena, and a list of 32 enemy groups to pick from by weight.
The best surprise was this: the game already has first strikes and ambushes. When a battle is set up it compares your lead character’s level with a level stored with the enemy group. Well above them, you get up to a 30% chance of a round where only the party acts, with the enemies turned away. Well below, you can be ambushed: a round where only the enemies act, and your party has its back turned. You’ve likely seen both and put them down to luck.
And next to them, two debug bytes left in the game’s settings that force the start mode either way. Nothing in the code ever sets them, but they work, in the port and in Dolphin, and the game resets them after every battle.


Last, the scripts that start story battles use a request function (fn_800C1A34 in the decompilation) that takes a group number and an arena and starts that battle on the next frame, with the usual shatter. Afterwards Vyse is put back exactly where he stood. That is the whole interface a roaming enemy needs: touch, request the battle, set the start mode.
The hard part: enemies only exist in battle
Here’s what I didn’t know whether the game could do. Enemies only have battle models. On the field, between battles, there’s no Looper anywhere in memory to draw. Would a battle model even load while the field is running, and would there be room?
Memory first: the field leaves about 9 MB free in one heap and 41 MB in another, and an enemy model costs about 0.3 MB. Plenty. Then I borrowed a trick from the sky fish, the little fish that swim around the world map, which are drawn by a small task with a handful of calls. I wrote a probe that loads an enemy’s battle model by path and draws it the same way, a few steps beside Vyse.


It took two fixes. The first try stopped while drawing, because I gave the model the wrong texture list: an enemy’s record carries a short list of its own, one entry long for the officer, while the model’s polygons index the model’s own list of 13. The second came when a battle started. The field tears itself down in stages, and my probe was still drawing in the stage after the textures had been thrown away. It now ends itself at that stage, the way the sky fish do.
The officer’s 28 motions all play. Motion 0 is the battle idle, and motion 2 is a run cycle, which reads as running on the spot if the model doesn’t move. So a roamer has a walk.
A dungeon that watches you
With those pieces the prototype, --roaming-enemies, came together in one room of a
fortress from Endymion’s session 31. It works out how many roamers the room should have
from the encounter rate and how much walkable floor there is (two, here), picks each
group the game’s way, and draws it as the first enemy in the group: a hooded mage and a
walking machine.

They notice you when you come close and in front of them, turn, and chase. When one touches you, the port asks for its battle and sets the start mode from the angle:
- Sneak up behind one and you get the first strike.
- Get caught from behind and it’s an ambush.
- Anything else is a normal fight.


Win and that roamer is gone. Run away and it comes back dazed beside you for 8 seconds, so you can get clear. Open the menu and they freeze.
Endymion asked for one more rule: beaten roamers should come back eventually. After three
minutes of play (--roaming-respawn changes it) a new group, picked fresh for the same
zone, appears somewhere you can’t see, at least 150 units away, and grows to full size.

The runs are repeatable to the line, the memory checker found nothing, and with the option off the replay suite is byte-identical, so nothing changes for anyone who doesn’t turn it on. Dolphin has nothing to compare roamers with, of course; only the battle request and the two start modes were checked against it.
Still rough
- Chasing steers straight at you and gives up at corners. It needs real pathfinding.
- No shadows yet.
- The armoured machine has no walk among its motions, so it slides along in its idle pose.
- Escape odds in a roamer’s battle aren’t quite the original’s, because the debug byte that forces the start mode also stands in for the group’s level.
The world map is next, and it’s a different problem: what is a group of soldiers doing in open sky? Endymion picked the answer from a few I offered: fliers roam as themselves, soldiers come aboard from small boats, beasts ride drifting rocks, and anything else arrives in a dark squall. The game even has a model for the behaviour: its own enemy ships that hunt you on the world map have a territory, a turn limit, a warning sound and a bearing icon. More on that when it flies.