NiGHTS Into Dreams is a curious game on many levels. One of the most curious aspects of it is its “A-Life” system. In each stage, you can see “Nightopians” running around and interacting with their surroundings. They sing songs, they paint pictures, they are born, they can die - you can watch all of this happen in the background of the game. If you want, that is - it’s very possible to get through the whole game without interacting with them at all.
The Nightopians do affect normal gameplay a little bit: if you treat them well, you can get a bonus for the stars you’ve collected. And the general mood of the Nightopians influences how the background music sounds. But for the most part, the A-life system is ancillary to NiGHTS.
If you attack one of the Nightmaren enemies, they’ll turn into a colored ball that bounces around the stage. If that ball hits a Nightopian, it can produce an egg with a Nightopian / Nightmaren hybrid (called a “Mepian”) inside it. This is hard to do! Aiming the Nightmaren enemies is notoriously difficult.
The rarest Mepian is the King Pian (or Super Pian). NiGHTS players have known how to create one for a while, but it’s easier said than done. The King flies around looking for Nightmaren enemies to attack. Once an area is safe, it starts building a castle. Over the course of several replays of the stage, the castle will become increasingly elaborate.
How does the King work? In this article, we’ll take a look…
Hatching a king
A lot of the A-life system has been figured out for the PC port of NiGHTS. I’ll focus on the Saturn version, which has historically been more difficult to analyze.
Each Nightopian in a level has a data structure associated with it. One for an egg is shown below:
The items in the data structure determine the Nightopian’s appearance, its mood, what it’s doing, and more. There’s a pointer back to a generic object instance, which determines other things like its position.
When you hatch an egg, the A-life code looks 0F
bytes past the start of the Nightopian data structure. It modifies the type value to turn the egg into a hatched Nightopian or Mepian, and then stores it again:
Through trial and error, I found that if the first 4 bits of the type value are unset, then the Nightopian that hatches will be a King. So we can make this function always yield a King Nightopian by adjusting those bits. The instruction at 060373D2
does an AND with CF
- we can change that to an AND with 0F
instead:
060373D2 c90f
Or, expressed as an Action Replay code:
160373D2 c90f
Royal actions
The King’s behavior is controlled by the function at 060366b4
. It repeats some of what the normal Nightopian code does, but it gives the king some special behaviors.
Behavior 4F
is flying along purposefully. The King follows NiGHTS’s flight path.
Behavior 50
is attacking nearby Nightmaren. It will do this if any get close:
Behavior 42
is flying up and down between the ground and its castle, and 41
is actually working on the castle.
The castle
Once there’s a King in a stage, a castle will appear somewhere along one of NiGHTS’s paths. There are a few fixed locations that each stage uses. The castle is controlled by the function at 060392a0
.
If you replay the stage, the castle will change. There are 8 stages. It starts out as a small pink structure then it extends upward. Blue and yellow branches sprout from it, and then additional structures appear grow on those branches.
The castle’s current stage is stored in memory address 060cffa0
. If you alter that while looking at the castle, it will change before your eyes.
Christmas NiGHTS
How about Christmas NiGHTS? Everything is the same except for the memory locations.
The AR code to make all eggs hatch King Pians is:
1603cc5a c90f
And the castle construction status is controlled by 060cf3a0
.
Outro
For previous coverage of NiGHTS Into Dreams and Christmas NiGHTS, see:
Send me your questions about Saturn games! This article was inspired by a reader suggestion.