[devlog] Procedural Map Generation

rtitle02Hey !

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 game editors, 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.

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

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, ..).

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. Which it does well enough.

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.

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.

Snap1535Once this abstract map is built, it’s “simply” a matter of expanding it, populating solar systems with planets, naming things and placing factions on the map. I still have 2 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 one way to build a map, there’s a lot of room for improvement and variations, but that will be for later, 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

Snap1530Until 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 build 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 equipment presets. We’ll see.

Scale, pacing and balance

Snap1539Now 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 have been reduced by 15%, it may seem like a lot, but it doesn’t make that much of 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 take 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%.

Regarding ships. Their costs in credits and in ship parts have been rebalanced using a formula. It’s probably not perfect, but at least now, prices 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, though, which means that armies will be a bit smaller (nothing major, but still in a noticeable way). While at it, I made some changes and rebalanced the stats of a few warships.

Optimization Pass

Okay, so, 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.

Misc Improvements

Snap1538In no particular order, large destroyed ships can drop ship parts, the asset list is much more responsive when you have a lot of assets. “Ejecting” cargo from a docked ships will put it in the station or carrier. AI factions can back down from an invasion if it’s doomed.

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. An exploit allowing to equip XL and unavailable weaponry on small ships using equipment presets. The modding toolkit got improved too.

The full list is available in the changelog, as usual.