Home For Fiction – Blog

for thinking people


May 16, 2022

Planet Generator: A Tool for SciFi and Fantasy Authors

Programming, Writing

creativity, fantasy, fiction, javascript, programming, science fiction, writing

Astronomy is one of my hobbies, and I’m particularly intrigued by exoplanets – planets beyond our solar system. Combining this interest with my coding and writing experience, I thought to make this JavaScript Planet Generator program. Not only does it create graphical representations of such fascinating worlds, it also generates random civilizational data that might be helpful for science fiction and fantasy authors.

In other words, whether you’re a scifi/fantasy author looking for worldbuilding prompts, a programmer looking for inspiration and/or tips, or simply someone interested in the universe, there’s definitely something in Planet Generator that will interest you.

planet generator
Here’s how the results page of Planet Generator looks like

Planet Generator: How the Program Works

On the main screen, there are five initial conditions you can play with (you can also simply leave the randomly selected default values on, or even opt for a “Fast Mode”, bypassing this step):

That’s it! You set these (or, as I said, leave the defaults on), and Planet Generator is ready to go to work.

Planet Generator: Results

The graphical representation of the planet is made using the excellent (albeit, often frustrating; programmers will relate) p5js library. Depending on the initial conditions plus a set of randomized patterns, the program generates textures for the planet (and moon, if present). Though sometimes the results are repetitive – there’s a finite number of appearances an ice giant can assume – there’s plenty of variety.

The textual data are also randomized, partly according to the initial conditions. Name selections for the planet and the moon come from ancient Greece, and the constellation from a relevant database. Temperature and orbit duration are also partly random, but within the range allowed by the initial conditions – for example, a red dwarf type star will return colder temperatures than a binary system.

The fun begins with habitable planets. Planet Generator returns randomized civilizational data, which can function as a prompt for scifi or fantasy narratives. The images above and below should give you an idea of what kinds of things to expect. The last image showcases the extended help page, with plenty of tips on how to use the program, and links to several Wikipedia pages relevant to the topic:

Where to Find

You can try Planet Generator following this link. For a full list of my available programs, see the relevant page on the main site.

Want to take a peek “under the hood” to see how Planet Generator comes up with civilizational data? Take a look at my post on automatic text generation.