We were inspired by the planet generation rules in GURPS: Space to write a tool that generates a random planet.

What it does

The user may provide input to a form to provide various characteristics of a planet. WebGL is then used to render a deformed sphere that is colored based on altitude.

The parameters are allowed to be in a range that will generate statistics usable in many tabletop games.

How we built it

Rust and WebGL are used to render an icosahedron that is subdivided at a sufficient resolution to appear as a sphere. The sphere is then deformed using a Perlin-like noise in order to provide varying altitude on the surface of the sphere.

React is used to provide a web form that can take in varying parameters about the planet. Safe-units is used to ensure that these parameters are all handled in SI units, and that no invalid conversions of units are performed under the hood.

Challenges we ran into

We had some initial issues with the noise generation library we were using and had to rewrite that code relatively last minute.

Similarly, many of the parameters that the planet is defined by, didn't match up 100% with the parameters used to generate the rendered planet. As a result, much of the UI isn't actually linked up with the rendering code.

Accomplishments that we're proud of

The sphere rendering code was written from scratch in WebGL and Rust.

What we learned

In the future we should have closer integration between the under-the-hood (rendering) people and the UI people so we can ensure that we're giving both groups the elements they need. This would've allowed us to more easily integrate the UI with the sphere generator.

What's next for Planets!

  • Proper linkage of UI to generator code.
  • Coloring of oceans based on hydrosphere settings
  • Coloring of "biomes" based on life settings.

Built With

Share this project: