Tuesday, December 25, 2012

Musing on Procedural Generation


Wow - this blog is still here. 

It's been a while since the last post, and it's going to be of an entirely different character. I'm writing this blog mainly as an exercise to flesh out some thoughts I've had tonight about coding. Suffice it to say that in the time between Cairo and now, I've founded an indie game studio (Send More People) and started to get into the language C#.

The Gist of It

Space sometimes poses a challenge for game designers. Space is big - our own galaxy has something close to 100 billion stars in it, and many of these stars have orbiting planets. Generating billions of systems can be tricky for reasons of scale - storing the data, and, from a design standpoint, ensuring that each system is built properly.

Spore supplied players with a vast procedurally generated Galaxy
Minor segue: games like Escape Velocity had a few hundred star systems and hand-crafted each one. Usually there were only a handful of planets in each given scene, and their qualities were pre-determined. Compare that to a games like Sins of a Solar Empire - where each game is set in a procedurally generated star system - and the scripted feel is exchanged for variable gameplay. And it occurs to me now, Spore did a great job at generating a galaxy... although it didn't give you much to do in it.

Anyway, I'm thinking that it would be fun to procedurally generate a universe for a player to explore. Here's how I might organize the variables in a such a system, and the variables they might produce. Each of these variables should be derived with the others in mind; for example, planets closer to the star  would likely be warmer than those further, etc. The relationships would be complex, though - surface temperature would also be influenced by, axis rotation, atmospheric content, day length, etc.
  • Stars
    • Number of (Integer, likely 1-2)
    • Type (name)
      • Brightness (Float, Scale 1-10)
      • Size (Float, Diameter km)
      • Mass (Float, Whatever the Unit of measurement is for stars...)
  • Planetary Bodies
    • Number of (Integer, Probably between 0-15?)
    • Size (Float, km)
    • Atmospheric content (Array, Chemicals and % of Atmosphere)
    • Mass (Float, kg?)
      • Gravity (Float, Unit is "G" for earth gravity.)
    • Surface Composition 
      • Chemical (Array, Elements and %)
      • Liquid on the surface (Boolean)
        • Size of Bodies of water (Integer, percentage of surface area)
    • Life 
      • Exists? (Boolean)
      • How Many forms (Integer)
      • Intelligent (Boolean)
        • Hostile (Yes/No/Neutral)
        • Technological Development (Array, Stone-age to space god)
      • (Many, Many other variables possible)
    • Moons Orbiting
      • Same variables for planets
    • Orbit period
    • Revolution period
    • Axis Rotation
  • Asteroid Belts
    • Number of asteroids (Integer)
    • Size of asteroids
    • Speed 
    • Composition

Look at your watch, dude.

Its nearing 1am and it's Christmas day, so I'm calling it a night. But in closing, it occurs to me that there are multiple levels of complexity that are possible for procedurally generating a star system, and each level of complexity seems to exponentially increase the difficulty in creating system. Likely I'll want to hit some middle ground between just randomly generating a number of planets and moons, and meticulously generating individual characteristics of said bodies.

Something to consider. Over and out.