Unending Galaxy : Dev Update 16-01-04

I will try, from now on, to post more or less regular development updates in addition to the other more design oriented articles. This one is regarding my current work on the Faction AI and the galaxy map. As usual, feel free to comment.

Enjoy ! 🙂

Galaxy & Sectors

I am now able to load a general galaxy map from a text file. I am not ruling out the option to build procedurally generated galaxies, but having a hand designed map(s) shipped with the game is definitively a plus. Currently the format is really simple, the file is read like a grid where the letter “X” mark standard sectors and “O” is for possible faction home sector. The actual content of sectors (asteroids and background) is still randomly generated so far.

Sectors now have a “solar strength” value that will tell the AI (and the player) how many Solar Plants can be built in such sectors. It’s currently random, but once I am done adding data to the sector backgrounds objects, this value will be higher in sectors with a sun (and in their neighbors) than in other ones. I do know that it would be more logical to limit the output of solar plant according to this value instead of capping the amount of solar plants per sector. But given the fact that such stations don’t need any input resource to produce energy, they would be overpowered (why build anything else?) otherwise. It also make things easier for the AI to decide where to build what in general.

Faction AI

Factions are now able to claim sectors. They will favor sectors near their border and choose in priority sectors with a lot of solar strength, lot of asteroids, and well connected ones. Here’s a nice animated GIF showing this expansion in action:

4 factions expanding over the galaxy map.
Four factions expanding across the galaxy

Factions with a high “Expansion” setting will, of course, expand faster that the others. Here, Blue has the highest setting while Pink has the smallest one. By the way, note that this is a small test galaxy and that the look of this map window is temporary.

What this little GIF doesn’t show, is that factions can now use constructor ships to build stations instead of spawning them out of thin air. So far, those ships are used to build solar plants in sectors with enough solar strength. Next, I will add mines, trading stations and military bases using the same logic. Then I will do the same for ship and and station parts production facilities (and whatever factories are needed in each faction production tree) so I can connect all that to the economy. It should be relatively straightforward. And finally it will be the turn of stations and factories with no relation to infrastructure (trading wares), which will probably be a bit harder to implement, but hey, a challenge at a time 🙂

Miscellaneous

I think I am done with the galaxy map pathfinder (A-Star). I made some tests in very large maps with tons of ships, and so far I hadn’t any issue. The related thread is still relatively light CPU wise. Anyway, worst case scenario, AI ships will take a tiny bit longer to update their orders if dozens of path-finding requests are made at the same time by the AI. It won’t slow down the game in any noticeable way for the end user.

While dabbling with station building, I realized that my stations don’t have hull or the ability to equip weapons and shields. Only ships can shoot and be shot at. I will have to change that sooner or later.

 

Anyway, I am going to finish the general Faction station building logic next. Then I will probably go back to individual ship AI (carriers still need to be correctly implemented). Then probably Faction military and diplomacy. Also if I want to release something soon, I really need to improve my display engine as there’s no special effects, ship rotation (apart for basic 90° angles) or animation in general.