Procedural Randomness

version 2 by Aaron Reed

  • Home page
  • Beginning
  • Previous
  • Next



  • Example: * Weather Or Not - Add a bit of weather-related color to every room description which doesn't vary until the player moves.

        "Weather Or Not"

        Include Procedural Randomness by Aaron Reed.

        Trailhead is below Lonely Meadow. Lonely Meadow is below Forested Slope. Precarious Trail is below Mountain Peak and above Forested Slope.

        Weather bit is a number that varies. Before going: now weather bit is a random number from 1 to 10000.
        
        After looking:
            set seed to weather bit;
            say "The air is [one of]hazy [or]clear [or]windy [or]cool [with procedural randomness] and the sky is [one of]cloudless[or]scudding with white clouds[or]angry with dark clouds[with procedural randomness].".

        Test me with "up / up / z / z / look / up / down".

    This is certainly not the most accurate bit of weather simulation, but we can see how at the least it prevents the weather from changing drastically every time the player types "look".