I've taken an interest in procedural generation lately. More specifically for the generation of areas in space.
Here's a snippet from wikipedia:
"The earliest computer games were severely limited by memory constraints. This forced content, such as maps, to be generated algorithmically on the fly: there simply wasn't enough space to store a large amount of pre-made levels and artwork. Pseudorandom number generators were often used with predefined seed values in order to create very large game worlds that appeared premade. For example, The Sentinel supposedly had 10,000 different levels stored in only 48 or 64 kilobytes. An extreme case was Elite, which was originally planned to contain a total of 248 (approximately 282 trillion) galaxies with 256 solar systems each."http://en.wikipedia.org/wiki/Procedural_generationI tried to do the same thing in TI-Basic. If my math is right, the size of the universe I've created on my calculator is in the magnitude of ~10^40 calc screens.
I did this by using the pseudorandom number generator of the calculator and by using predefined seed values.
The downside is, they aren't unique.
In other words, I want my calc-universe to be made up of unique calc screens only, I don't want to come through the same screen twice.
I've been thinking of a way to make this happen, but I didn't find one. Does anyone have an idea?
I've added the universe thing as "space2d.8xp". I did a quick optimisation with sourcecoder and the code itself could probably be more optimised but that isn't my main concern right now.
I've also included the individual subroutines in source.zip
ENGIN is the main game loop.
COLLIS checks for when you reach the edge of the screen and updates the X,Y coordinates, generates new seeds
NUMBERS puts the seeds into rand and generates a pseudorandom number from which the stars are generated.
CONV converts the pseudorandom number into individual numbers. e.g 123 becomes 1, 2 and 3.
COORD uses the individual numbers to generate the coordinates for each individual star while also providing collision detection.