4 ms·
There's enough old Softdisk/id Software code released that you can trace the evolution of this RNG. First, check out Catacomb (1989). I think this is the oldes
by pdw 11y ago
There's enough old Softdisk/id Software code released that you can trace the evolution of this RNG.
First, check out Catacomb (1989). I think this is the oldest of Carmack's games for which source code has been released. This game uses a lagged fibonacci generator:
https://github.com/FlatRockSoft/Catacomb/blob/master/CATASM.ASM#L397 https://github.com/FlatRockSoft/Catacomb/blob/master/CATASM....
This makes sense, it's a generator that requires little memory and no expensive operations such as multiplications. You'll probably also find it in Softdisk's Apple II releases.
Carmack's first 3D game is Hovertank 3D, released in 1991. The LFG still exists, but now a "table-based RND generator" also appears. This seems to be the first appearance of the "Doom RNG".
https://github.com/FlatRockSoft/Hovertank3D/blob/master/IDASM.ASM#L698 https://github.com/FlatRockSoft/Hovertank3D/blob/master/IDAS...
The LFG is used when setting up the map, while the table-based is used for enemy AI during gameplay. Obviously every cycle counts when trying to do 3D on a 286.
The same year also saw the release of Keen Dreams, in which only the table-based RNG survives:
https://github.com/keendreams/keen/blob/master/id_us_a.asm https://github.com/keendreams/keen/blob/master/id_us_a.asm
(The state variables of the LFG are still defined, but the code is missing.)
- tmoertel 11y agoThat's a fascinating history. Thanks for tracing it back. According to a comment in the Catacomb source, the LFG logic was derived from a macro supplied with the Merlin assembler for Apple 2 GS computers: ;this routine was converted from ;the Random macro on Merlin GS