The procedural galaxy
The reason 438 bytes suffice for the save file is that everything
is recomputed from the ship's coordinates. In the save file, this is
dzat_x, dzat_y, and dzat_z.
To this day I am not exactly sure what dzat stands for.
In the original source the Stardrifter is referred to as
l'astrozattera, the star-raft, so my best guess is that
dzat is the double-precision zattera, but I am
not sure.
This procedurally generated galaxy is Noctis's piece de
resistance. It is quite a bit of math, and documenting it in a
compelling way slightly exceeds my capacity for this first release.
But there is one wrinkle worth touching on: rand().
rand() is a fixed formula that from the same seed
always returns the same sequence of numbers. You could think of it
as resuming pi at some predetermined decimal point: things look
random but are indeed proceeding in a deterministic and repeatable
way. While other games might seed rand() with the clock
to simulate something more akin to dice throws, Noctis cleverly
seeds it with coordinates, and thereby produces the equivalent of a
giant dictionary on command. This is quite clever, but it introduces
two dilemmas.
The first is fun: the implementation rand() is
different based on the program's compiler. And so the heart of
Noctis's gameplay rests on one Borland implementation that was never
actually standardized. When the community behind Noctis IV: CE
ported the game to Windows and Borland's library was no longer used,
it would appear they transcribed its formula, bit for bit, into the
source, where it lives on as randalg.cpp.
The second is less fun. Because you can think of
rand() as like a reliable ticker tape of values, the
number of draws that you make and the order in which you do them
matter. If you skip a draw, or if your calling code sometimes
calculates the moons before the planets instead of the planets
before the moons, the outputs will be different. Put more simply:
any change in the order or number of calls to rand()
scrambles the Noctis universe. This fact will virtually kill
me matter a great deal when we get to the migration...