The gnuplotiverse

I will say it outright, I have a fascination with space video games. Space ships, space lasers, space anything. If you took the most mundane game concept on earth, and added the word SPACE to it, I would probably start salivating.

So, let's hit up on a subject that I am interested, especially as an indie game developer: procedural data sets.

I mean, let's be honest, if you want to make a huge system of some sort, you do not have the time to hand-craft the data set required to fill it to the brim.

Some examples of procedural produced data sets:

Diablo I Minecraft Elite Eve-Online Borderlands Left 4 Dead Dwarf Fortress

And so many other games, if I were to continue, this post would probably become a list with a little flavor text.

While there's probably plenty of guides on how to procedurally generate a universe, I'd like to present my attempt at universe generation.

Gnuplotiverse Click to enlarge

Because my work flow is entirely Linux-driven, you may have issues running this project without the proper dependencies. When it comes to procedurally generated data, the most important thing happens to be the data that's generated. Regardless, I find the process to generate the information more important than the code itself, because this will allow you to create your own universes.

You can find the code for this blog post here.

The steps that are taken to produce this data set are:

  1. Universe Distribution Map
  2. Universe Generation Library
  3. Data Output in CSV
  4. Gnuplot Script
  5. Gnuplot
  6. Universe Plot PNG

Universe Distribution Map

Most successful games that I know of create universes that are flat. The simple examples are Elite, and Eve Online. With that, the important part of producing this data is that we start on in a 2D environment.

With that we create a basic statistical map on what we would like the universe to look like. In this case, I took the Milky Way, and removed the color.

The Milky Way Click to enlarge

From this we can statistically decide the probability of a randomly placed star occurring. Black (#000000) would have a very low chance and white (#FFFFFF) would have a very high chance.

Universe Generation Library

The Universe Generation Library (universegen.lua) is where the "data"-magic happens. The most important part of the code is the function universegen.attemptStep.

This library basically takes a number of steps that should be computed, and runs until the steps are taken, where each step is the possible placement of a "planet".

The first thing we need to do, to take a step, is to choose a possible location for a new planet. Instead of choosing the pixels in order, I chose one randomly to help increase the amount of noise and variance of each dataset. This line basically chooses a pixel from the distribution map.

local px,py = math.random(1,self.size-1),math.random(1,self.size-1)

Then, I set the z coordinate so that there is some vertical noise. I use math.sin here to ensure that the vertical part of the dataset is more dense in the middle, and less dense near the z-limits (defined by self.size * self.zMult)

local pz = math.floor(
  math.sin(math.random()) * math.random(-self.size*self.zMult,self.size*self.zMult)

I then store the actual pixel data from the distribution map and the location of the center of the "universe" so I can use this later.

local r,g,b =,py)
local rx,ry,rz = px-self.size/2,py-self.size/2,pz

I then calculate the magnitude of the current pixel from the center of the distribution map. I do this so I can make the center of the universe more dense than the edges.

local mag = math.sqrt( rx^2 + ry^2 + rz^2) / self.size

I then multiply the magnitude against the base chance of a star being successfully added. This is important, otherwise stars would never appear outside of the designated zones of the Universe Distribution Map. This extra noise helps it feel a little more realistic.

local calc_bchance = self.bchance * mag

I only care about the darkness of the pixel, so I take an average to create the map chance of how likely the current planet will be successful. This example is black and white, but with this, RGB color images can be used as well.

local map_chance = ((r+g+b)/3)/255

And now the actual chance is computed by using the base chance and the pixel map chance.

local chance = calc_bchance + map_chance*(1-calc_bchance)

Finally, I push the computed chance through math.cos to give the entire system a more rounded look. Then if it passes the threshold, it is added to the system.

if 1-math.cos(chance) > math.random() then
  return self:addPoint(rx,ry,rz)

Data Output in CSV

The generated data is then parsed into data.csv as the following so it can later be used in gnuplot to see what we have.


This step is rather straightforward I hope.

Gnuplot Script

I then have a gnuplot script, uni.plot, to render the data.

Here I identify how the data.csv dataset works

set datafile separator "," 

I set the 3D view so I can relate to the data when testing.

set view 30,60

I then plot the data from the CSV with specific settings that will output it to uniplot.png.

splot 'data.csv' with points palette pt 8
set term pngcairo mono enhanced
set xlabel "X"
set ylabel "Y"
set zlabel "Z"
set terminal png size 1680,1050
set mouse
set xrange [-512:512]
set yrange [-512:512]
set zrange [-512:512]
set out 'uniplot.png'

Then finally plot the data that you saw earlier.



Running the previous script is as easy as gnuplot uni.plot

Universe Plot PNG

Then finally comes the output.

Gnuplotiverse Click to enlarge

A fun part is that with high contrast images, such as a png of beartato, I can create different kinds of universes.

Beartato Click to enlage

I hope that this example encourages folks out there to create awesome universes for their own space games! Thanks for your time!

Getting back on track

I admit it, I've been slacking, but recent events have shown to me that I need to make sure that Missing Sentinel Software stays up to date on its website.

Keep in mind, I'm very active in game dev communities. Between interacting with the LÖVE community, the Ludum Dare community, my local Game Dev support group, Rochester Indies Anonymous, and bleating on twitter, I do keep myself very active on the internet.

Currently when I post information about my games, they heavily depend on the context, which is usually for game developers. I plan on fixing this by creating blog posts that can stand on their own for both folks who are interested in game development and those who are only interested in the games.

I intend to correct this communication issue post-haste, by:

  1. Bringing everyone up to date via the blog, and
  2. Keeping everyone up to date on what I'm doing in the future.

There are two big projects currently in the pipeline here at Missing Sentinel Software, and the one that's currently getting most of my attention is Defense of Your Craft (DOYC).

Let's Talk, Indie Cade East

Last weekend I went to my first game developer festival, IndieCade East.


Myself, Wes Paugh and Kevin Drew, respectively.

This was my first festival/conference, and while I wasn't able to make as many contacts as I had hoped, I realize that there are a few takeaways:

  • Business cards: everyone's doing it, and I was smart enough to pull some together at the last second.
  • Don't be afraid to hand out your business cards. Everyone's looking to make contacts, not just you. Make it easy for them so you don't have to end up writing your website down on their arm.
  • Have something to show, and don't be afraid to show it. Even if it's something pulled together in a few days.
  • If you bring friends, know what games they have, and pimp them (the games!). Not only do you get some great cross pollination, but having someone else talk about them will give folks a better outside perspective. Kevin shamelessly was pimping Defense of Your Craft and I felt like an utter moron not being able to return the favor.
  • Get some space. Get a table, some presentation space for an hour or so, or a laptop with a big screen and a good battery. Showing off your game is a good way to get some attention for your project.

In the end, I had a great time. Indie Cade East has shown me that I really need to step up my game when it comes to communication, and I've been really failing hard when that comes to development the blog. While I don't want to post blog posts of low quality, I do want to keep folks up to date with what's happening.

The Blog Pipeline

With all this, I need to have a publicly facing portal for the games I have in development.

I realize that the information around DOYC is woefully lacking, and I will be correcting that post haste. In the future, you can expect a long list of subjects that I will be posting about:

  • Gnuplot Universe Generation - Generating universes and presenting them with Gnuplot.
  • Vapor - LÖVE Distribution Client.
  • LD27 - Defense of Your Craft (The Jam Version).
  • 0H Game Jam - a game made in 0 Hours for the Dingoo.
  • LD28 - Bitmo Pirates, the MMO made in 48 hours.
  • DOYC REMIX/HD, the current game in development stemming off the jam version.
  • Lokken - A menu system for DOYC.
  • Dong2 - A controller abstraction system for multiple controllers over multiple platforms for DOYC.
  • PratCam library - re-implementing the classic system in LÖVE with more for DOYC.
  • Love 0.9.0, Android & OUYA - Porting DOYC other devices.
  • EVE: Valkyrie - Experiencing the Occulus Rift beyond a youtube video.

I recently had some issues with the 64-bit version of my Xbox...

I recently had some issues with the 64-bit version of my Xbox 360 controller wrapper library, dong (as in dongle, pictured above left.) I was handing out 32-bit dll’s to the 64-bit users, and that doesn’t work very well. I committed the 64-bit versions of the dll’s (Thanks Boolsheet!), and everything seems “hunky dory”.

I would like to take a moment to mention that Starfire Lords: Genesis supports two controller schemas, entirely cross platform;

  • Keyboard and Mouse
  • Xbox controller (wireless via the dongle, and wired I believe)

For anyone with a registration code, build 303 has been updated with new .dll’s, and build 304 is available with the new dll’s as well.

On top of that, for ~12$ I bought the RetroLink NES Classic USB Controller (pictured above right) and as a pet project, I am thinking of making it a third supported controller schema. Why? Why not? Who doesn’t want to play a cool spaceship game with a big pile of nostalgia?

More to come, I’ll be here all week. Is this thing on?

Sis, Help Me!

Over the weekend, whilst doing a ton of other things, I managed to spend some time participating in the Bacon Game Jam 5!

I made the game, Sis, Help Me!

Check out and play my entry here!


Currently streaming some game dev for the bacon game jam 5! - josefnpat

More of everything!

More races, more ships! MORE RACES, MORE SHIPS.

Big shout out to Rose, check out and subscribe to her blog!

Big Commit

This last commit was a big one, and closed seven tickets.

Here are the fruits of my labor; a unified menu system (along with numerous other fixes!)


Getting a lot closer! This library is going to close soooo many tickets.

Up late working on a menu system to expand on Wes’, so all...

Up late working on a menu system to expand on Wes’, so all the menus in the game will work, look and act the same!

Gource of Git Repo

This may be a little more interesting to developers rather than gamers.

Everything in Starfire Lords: Genesis is controlled with revision control software (git), and I can use gource to show the developer interaction with the game over time!

This interaction is for the Minimal Viable Product!


About Seppi

Howdy; my name's Seppi, and I'm an indie game developer. I am an active member of the LÖVE community. I've been making games for years now, and I'm always interested in helping prospective indie developers out.

One of the paradoxes I've learned over the years, especially as a software developer, is the more I know, the more I realize I don't know. I quote;

Only a fool would take anything posted here as fact.

Questions, comments or insults? Feel free to leave in the comments section, or contact me; you can hit me up on twitter @josefnpat

Subscribe to RSS - Development