Post news RSS Devlog: Procedural Map Generation

Unending Galaxy's weekly devlog with the new procedural map generator and the usual improvements, changes and bug fixes.

Posted by on

Hey !

This devlog is a bit late, last time I promised that this update would be about the procedural map and that’s kinda why. I, as usual, got sidetracked into other things which delayed this post by a few days. Anyway, there’s a lot to look at beside the procedural map generation, which is still in its infancy (but don’t worry I’ll talk about it too). I added the ability to choose the equipment for ships built at player shipyards, made multiple changes to the game’s pacing, added several tools and functions to the modding toolkit, and finally I did most of the optimization pass with very good results.

Procedural Map Generator

While it’s still a work in progress, maps can be procedurally generated now. More to the point, those maps are saved into files that can be altered further through the map editor or reused across multiple games.

Basically it works as follow. I build an abstract map where each square is what will become a 5×5 area in the final map. Each square is defined by the paths it can go to and a set of features (small system, big system, asteroid belt, nebulae, ..):

green circles are solar systems, blue are asteroid fields, yellow are the nice looking backdrops.

Firstly solar systems are placed in the grid. Not at random, because it would, more often than not, look horrible but by using a distribution method known as Mitchell’s best-candidate algorithm. Its goal is to distribute the solar systems evenly across space. It's not the most efficient algorithm at doing this task, but it's fast, straightforward, and I don't want something that's always 100% perfectly spread.

Using the same method, I follow up by placing “interesting” road patterns across the grid, those are 3 ways and crossroads basically (bigger more varied patterns will be added later on). Then, I link the ‘roads’ together and to the solar systems, remove useless connections and dead ends. And finally I add asteroids, nebulae and other map features the same way I did for the planets. One thing lacking so far is the very large nebulae (big blobs of sectors belonging to the pirates), but I am confident I will be able to add them as well, probably using Perlin noise or other algorithm that's good at making blobs.

And of course there will be a bunch of parameters to play with, the map’s size obviously but also the asteroid density, the amount of solar systems (and ratio of big vs small systems), how dense is the ‘road’ network, and so on and so forth.

Once this abstract map is complete, it’s “simply” a matter of expanding it, populating solar systems with planets, naming things and placing factions on the map. I still have two issues to overcome, namely where to put the various factions in a way that doesn’t screw over some of them completely and how to place planets in a balanced way. It seems that my planet and colony data is lacking helpful information to do that. Its not a big deal but it will take a few days to figure out properly.

Of course, that’s only one way to build a map, there’s a lot of room for improvement and variations, but that will be for later, I might as well perfect this method before trying others.

That’s all about the map generator for now, but you’ll likely read more about it soon.

Player Shipyard

Until now ships produced at your shipyards would be equipped with a semi random selection of weapons and the best available shields. While it’s still possible to do so, you can also choose to make equipment presets for each one of your ship types. Using those presets will, however, increase the amount of ship parts you’ll need to produce said ship.

The preset screen is the same as the one you’re familiar with (used when buying a ship or changing equipment), presets are ship specific but they carry over games.

I may also add the option to use credits in order to speed up production and pay for those presets. We’ll see.

Scale, pacing and balance

Now that the beta period is basically over, it’s time to restore a bit of sanity regarding the pacing of the game. All ship and bullet speeds hav been reduced by 15%, it may seem like a lot, but it doesn’t make that much of a difference when you play, especially now that the time to wait between jumps has been reduced to 30 seconds instead of a minute.

Building time of factories has been increased by 33%. It also takes longer to build a station (military base, shipyard or trade station) than to build a simple factory. Ship building time is roughly increased by 50%.

Ship data has been reviewed too. Their costs, both in credits and in ship parts, have been rebalanced using a formula. It’s probably not perfect, but at least now, they are somewhat coherent. Generally speaking, big ships are cheaper (1 million credits for a run-of-the-mill battleship), while fighters and cargo ships are a bit more expensive. Supply cost of military ships are higher, which means that armies will be a bit smaller (nothing major, but still in a noticeable way). And while at it, I made some changes and rebalanced the stats of a few warships.

Optimization Pass

In theory, I wasn’t supposed to do that until just before release, but what began with an innocent bug fix became something a bit bigger. I won’t go into details but let’s just say that the two most CPU intensive parts of the simulation aren’t even in the top 10 anymore. Path-finding and trading (which are interlinked) which would take up to 30% of the CPU usage before, only take about 5% now. There’s other areas of improvement, but those are the big non boring ones, and they make a world of difference, especially during the late game.

Misc Improvements

In no particular order, large destroyed ships can drop ship parts, the asset list is much more responsive when you have a lot of ships and docks. “Ejecting” cargo from a docked ships will put it in the station or carrier instead of making it vanish into thin air. AI factions can back down from an invasion if they think it's gonna fail badly.

If also fixed a few bad bugs including one in which automated ships’ data get corrupted during a savegame causing them to buy unlimited escort ships or reset their location and an exploit allowing to equip XL or otherwise unavailable weaponry on small ships using equipment presets.

The modding toolkit got improved too with multiple small improvements, a map editor allowing to create maps of any arbitrary size, and so on.

The full list is available on the forum, as usual.


You can read more about Unending Galaxy on the official website and on the wiki. You can also follow us on twitter and facebook.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.