Categories
Galactic War

Galactic War : Populating the galaxy.

There are two way of creating the map.

The first solution is to do it manually. It works, but every little change (adding a planet, moving some others) can rapidly be tiresome.

The second, and only viable option, is to create it procedurally.

That doesn’t mean it will be random. The goal is to set the position of the planets in a editor, and it can generate all the paths and influence zones automatically.

There is hopefully a mathematic solution to any problem, and in this case, it’s call a Voronoi diagram.

There are two way of  creating the map.

The first solution is to do it manually. It works, but every little change (adding a planet, moving some others) can rapidly be tiresome.

The second, and only viable option, is to create it procedurally.

That doesn’t mean it will be random. The goal is to set the position of the planets in a editor, and it can generate all the paths and influence zones automatically.

There is hopefully a mathematic solution to any problem, and in this case, it’s call a Voronoi diagram.

A Voronoi diagram is a way of dividing space into a number of regions. By entering a set of planets, it will generate a region consisting of all points closer to that planet than any other planet.

Voronoi diagram.

Here is a early test of my galaxy editor, showing the planets (big cicles), the points given by the Voronoi diagram (the little circle), and the region boundaries (green lines).
I also have all the links possible from one planet to another (lines).

The planet are randomly positioned at first, but I can move them around and the editor will update all the links and regions.

Of course, as my display is in 3d, I need a set of polygons for each region, in order to give them some transparency and have the exact same look as the mockup.

That’s what the latest iteration of the editor is able to do :

Drawing the region as polygons.

 

It also clean the boundaries that are outside the map (the square). Please not that it’s a editor preview, with a limited number of planets. The final number is not decided yet, but it can handle as many as I want.

The final step is to take all the planet links that the Voronoi diagram gave me, and remove the ones I don’t want, then export the final result (position, regions and links) in the database.