Galaxy Generator (v1.9b)

Moderator: Makail

Galaxy Generator (v1.9b)

Postby Daequeous » Fri Dec 23, 2011 7:42 pm

WHAT'S THIS?

Want a unique map for every game? Want truly random maps? Want to be able to adjust map properties with sliders? Then I suggest trying this out. Keep in mind though that these maps will pretty much never be totally fair or balanced. They are random, and some players may end up with awesome starting locations while others collect dust.

The Galaxy Generator can create starmaps ranging from 6 to 500 systems in seven (more or less) different ways (though I highly recommend not going beyond 200 systems unless you have a very powerful cpu and a lot of patience). It can also convert SotS prime .csv maps to SotS 2 .starmaps. It comes complete with a GUI to make the process of generating starmaps as easy as I could make it within a reasonable time period. Each algorithm also comes with the ability to set the map height aka "3D-ishness", which allows full or partial flattening of maps for people who don't like the implications of full 3D space. All maps are complete with node line connections. Some of the galaxy types will, however, contain "node line highways" reaching across the galaxy, making some systems particularly valuable to Sol Force players. Some systems may have loads of connections, others just one. All I guarantee is that every system will be reachable from every other system via at least one node line route. Occasionally weird things may happen, such as node lines piercing stars. This is less likely the more 3D the map is, which is why there is a minimum of 5% 3D-ishness.

I messed around with different values to find a suitable range of size and number of systems, and then made sure it was possible to exceed this a bit just for the sake of it. Just be careful with the extreme values. The generator will prevent you from creating a map that's too cramped, but there is no check against spreading things out too thinly, so you'll have to use your own judgment.

Image

MAKING IT WORK

Requires: Java Runtime Environment (JRE) 1.6 or better. Can be found here: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Once the JRE is installed all you have to do is to extract the files wherever you want and execute #GalaxyGenerator.jar (you should be able to just double-click it). The generated starmap files will appear in the same directory as the executable, so I suggest placing everything in the starmaps folder, i.e. \sword of the stars ii\assets\base\starmaps\ if you don't want to manually move every map you generate to this folder.

Caution: It will overwrite files without asking for permission! Give each map a uniqe name if you don't want to overwrite something.

I suggest using the game itself to preview the starmaps. This is what I do:
  • Start the Galaxy Generator, select a galaxy type, enter a map name, set the sliders and click Generate starmap.
  • Fire up Sots2. My copy of the game is configured to start in fullscreen, so once started I press Alt+Enter to throw it into window mode. In the Game Setup screen I find my new map and have a look at it.
  • If I'm not pleased about it I alter the sliders in the galaxy generator and hit Generate starmap again, with the same map name.
  • In the Sots2 window I click the map name again. The new changes will appear. Repeat as many times as necessary.
  • If I want to make a new map with a different name I first generate it with the galaxy generator, then in the Sots2 window I go back to the main menu, then enter the Game Setup again to be able to see the new map. Then I can update the map by just clicking on it after every generation.
  • When I'm pleased I shut down the Galaxy Generator, hit Alt+Enter in the Sots2 window to bring it to fullscreen again and start playing.


THE GALAXY TYPES

Sphere
It's simple: It's a sphere. However, due to the random nature of the system placement it will be more like "Real Space" than "Sphere" from SotS prime. The sphere can also be hollowed out if desired, creating a hollow sphere. Lowering the height will chop the top and bottom of the sphere, thus creating a disc or a ring depending on if the sphere is hollow or not. Node line highways will appear.

Intrasphere
A sphere within a hollow sphere. The basic version is very much like "Hollow Sphere" from SotS prime. But to make it more interesting the height of the two spheres can be set independently. For example this can be used to create coreworlds with a shell around them, or a sphere with a ring around it, much like Saturn. Node line highways will appear.

Clusters
A good old cluster of spheres. The radius and height determine how far from the origin point, and how high above or below it, the center of a cluster may appear. The radius and height of the clusters may be set independently, making it possible to create 3D spheres spread out over a 2D plane, or 2D discs floating in a 3D space. Node line highways will appear, but only within clusters unless a very tight map is generated.

Lump
An undefined shape. I personally love this one. It doesn't give you a whole lot of sliders to play around with, and you can't really influence the distance between systems very much. However, the result will vary wildly between each generation, creating all kind of weird shapes. It's also very difficult to mess up. The sphere based algorithms will create sub-optimal maps if the radius is too large in relation to the number of systems. In the lump each system is close to at least one other system, and the radius' only function is to prevent some of the snake like shapes that may occur from going off too far in one direction. To get the most impressive lump I suggest using maximum radius and maximum height to give enough room for it to do its magic.

Multi-Lump
Pretty much the same thing as Clusters, but with the Lump algorithm instead of the sphere algorithm for the cluster formations.

Disc
Quite self-explanatory. It's thicker in the center and thinner at the edge.

Spiral Galaxy
A solid center with 8 bending arms that get thinner and thinner. When setting the slider values I suggest making it at close as possible to the "Starmap volume insufficient to accommodate that many systems" error, or the shape may get somewhat undefined.

VERSION HISTORY

1.0 (Dec 23, 2011)
  • Initial release.

1.1 (Jan 10, 2012)
  • Max number of systems increased from 200 to 500.
  • Max number of nebulas increased from 5 to 10.
  • Lump radius defaults to 100 lightyears.
  • Multi-lump minimum cluster radius increased from 3 to 8.
  • Persistency of multi-lump algorithm increased by 50%, which means error messages are somewhat more reliable when dealing with border values.

1.2 (Jan 21, 2012)
  • Starting systems have been buffed. Apart from the capital they will contain at least 5 other planets: 3 planets with a high probability of being colonizable, of size 6 - 8 with 3000 - 5000 resources, one uncolonizable planet of size 3 with 7000 - 9000 resources, and one gas giant.
  • The file #SystemNames.txt can be used to add your own system names to the mix. It works similarly to #RegionNames.txt with the exception that #SystemNames.txt is entirely optional. The generator will use as many names from the file as possible. If it runs out of custom names it will assign random names to the remaining systems.
  • Clarified lump error message somewhat.

1.3 (Feb 08, 2012)
  • New galaxy type: Disc. It's thicker near the center and thinner near the rim.
  • Duplicate entries in #SystemNames.txt and #RegionNames.txt no longer cause invalid maps to be generated.
  • The summary text field is now scrollable when a large amount of text has been written in it.
  • "Greetings" page has been split into a beginners guide and galaxy types page, and moved to a separate help menu.
  • The GUI has been slightly reworked to allow for a larger number of sliders.
  • The code has been refactored and cleaned (somewhat) to facilitate further additions.

1.4 (Feb 21, 2012)
  • Slider values now update while sliders are being moved.
  • System slider moved to the top and made wider.
  • A field next to the system label allows for keyboard input. Press enter to apply the value.
  • It is now possible to adjust the minimum allowed distance between star systems.

1.5 (Mar 17, 2012)
  • New galaxy type: Spiral Galaxy.
  • When creating the node line connections between clusters (or lumps) the generator will now try to limit the amount of connections a single system can get. Single systems may still get many connections if they are close to several other clusters, though not nearly as many as before.
  • Fixed a typo in the error messages.

1.6 (Mar 25, 2012)
  • New feature: SotS prime map converter. Given a SotS 1 map it will create a similar SotS 2 starmap.

1.7 (Apr 08, 2012)
  • Fixed a bug where nebula generation sometimes created invalid starmap files.
  • Fixed the broken arm in spiral galaxies.
  • Each cluster may now only contain a single start location.
  • The minimum distance between start locations in non cluster maps now scale with map size and number of players.
  • The Galaxy Generator now properly closes each output file without shutting down the generator.
  • Arms in spiral galaxies are now significantly more bent.
  • Nebulas in lumps are now spread out better across the map.
  • Each non cluster map is now divided into 4 regions.
  • Max number of nebulas increased from 10 to 20.
  • Minimum possible system distance reduced from 3 to 1.

1.7b (May 20, 2012)
  • Added slider for spiral galaxy arm curvature.

1.8 (Jun 23, 2012)
  • Terrain/region generation is now dynamic. The number of regions created is based on the radius and height of the map. Normally there will be between 2 and 10 "pie" regions on the horizontal plane depending on the map radius (10-20 ly -> 2, 21-40 -> 4, 41-60 -> 6, 61-80 -> 8, 81-100 -> 10). There will be an additional central region if the radius is greater than 50 ly. Also, if the height is greater than 70%, there will be a top and bottom region.
    Exceptions: Discs don't have top and bottom regions, each cluster in a cluster map will be a region, spiral galaxies will always have 8 arm regions and 1 center.
    Known issues: Spiral arm regions are far from perfect. They will turn out well on a medium sized map with a curvature of around 20%, but not otherwise. Also, due to the highly random nature of Lumps, those regions may be weird as well.
  • New optional file: ggConf.ini. This will contain options that can override default Galaxy Generator behavior. Currently there is only one option: Batch. When set to a higher number than 1 each press on the "create starmap" button will create the set number of maps, each independently generated with the set slider values. This file is only read at startup, so you'll have to restart the GG for changes to take effect.
    Caution: the batch option may be heavy on your cpu if you create a large number of complex maps, and the GG will be unresponsive until it's done it's thing.
  • Spiral galaxy starting locations are now at least half the map radius away from the center, pushing them into the arms (though not necessarily the very tips).
  • Minimum distance between starting locations in converted prime maps (if not defined) have been increased from 20 to 25 ly.

1.8b (Jul 01, 2012)
  • Fixed bug in 1.8 which made the generator ignore the content of #SystemNames.txt

1.8c (August 10, 2012)
  • Resolved issue where some prime maps would get weird names when converted.

1.9 (December 29, 2012)
  • Spiral arm regions synchronized with arms regardless of curvature.
  • Added slider for number of arms in spiral galaxies: 2, 4, or 8.
  • Reduced maximum number of players from 10 to 8.
  • Made maximum number of players overridable in config file.
  • Added slider for buffed home systems: Unmodified, small buff, small random buff, large buff, large random buff.

1.9b (May 29, 2013)
  • Fixed terrain tearing bug in prime converter.
  • Maximum number of systems now overridable in config file.
  • #Guids.txt is no longer used and can be deleted if you have it.
You do not have the required permissions to view the files attached to this post.
Last edited by Daequeous on Wed May 29, 2013 1:36 pm, edited 26 times in total.
User avatar
Daequeous
 
Posts: 97
Joined: Tue Dec 13, 2011 8:30 pm
Location: Sweden

Re: Daequeous' Galaxy Generator

Postby LuggLD » Sat Dec 24, 2011 5:48 pm

Awesomeness! Thanks for releasing this :) I'll give it a spin as soon as I've found a way (or made a tool) to look at maps outside of SotS2 (as I can't run it on my netbook, and won't be home for another few days)
User avatar
LuggLD
 
Posts: 143
Joined: Sun Oct 30, 2011 12:58 pm
Location: Germany

Re: Daequeous' Galaxy Generator

Postby Daequeous » Sun Dec 25, 2011 4:04 pm

You're welcome ;) I like the idea of an external starmap viewer. I thought about including something like that in the generator, but realized I lacked the skill and time to do it very well. I have already spent quite a lot of time on the generator and kinda felt the commitment fading :roll:, at least for the moment.
Random starmap generator with property sliders (and SotS prime map converter): Galaxy Generator
User avatar
Daequeous
 
Posts: 97
Joined: Tue Dec 13, 2011 8:30 pm
Location: Sweden

Re: Daequeous' Galaxy Generator

Postby motorbit » Sun Dec 25, 2011 4:22 pm

i like this tool :)
User avatar
motorbit
 
Posts: 2212
Joined: Mon Sep 17, 2007 7:22 pm
Location: Lummerland

Re: Daequeous' Galaxy Generator

Postby dcarde007 » Tue Dec 27, 2011 4:09 am

How did you create your nodeline algorithms?
dcarde007
 
Posts: 32
Joined: Sat Dec 03, 2011 9:33 pm

Re: Daequeous' Galaxy Generator

Postby LuggLD » Tue Dec 27, 2011 11:05 am

dcarde007 wrote:How did you create your nodeline algorithms?


I'm puzzling over that as well :D

In my (unreleased) map generator, I simply check within a radius of each star for other stars, and incrementally increase the radius until the target number of nodelines is reached. It's far from perfect, as there's currently no routine checking whether all systems are connected to each other, and you have to manually fiddle with the radius and target ndoeline number settings to get a result that connects all systems.
User avatar
LuggLD
 
Posts: 143
Joined: Sun Oct 30, 2011 12:58 pm
Location: Germany

Re: Daequeous' Galaxy Generator

Postby Daequeous » Thu Dec 29, 2011 12:43 pm

Every time I add a new star to the growing map I make sure it's connected to some other existing star. So in any given state of the algorithm all systems are always reachable. As the algorithm goes on the number of stars just grow. In the worst case every new system that's added is compared to all other existing systems, which isn't particularly nice computationally, but it's only a few hundred systems, so it doesn't really matter.

Specifics differ slightly between the spheres and the lumps. For the spheres, every time I add a new star I check if there are any other stars within a constant "node neighbor"-radius. If there are I add connections to a couple of them randomly. If there aren't any I add one connection to the closest system in the existing map. For the lumps, every new star is placed within "node neighbor"-radius from the last star. That way it gets connected to, at the very least, the previously generated star.

The clusters are worse, as after I have generated every cluster I compare the clusters to each other as well to find out which stars within a cluster are closest to which stars in another cluster, in order to connect the clusters to each other. The result is a rather ugly mess of for-loops which take a LOT of time, which is why the clusters take significantly longer to generate. It's not good, but it's feasible for a few hundred systems. It would not work with, say, a thousand systems.
Random starmap generator with property sliders (and SotS prime map converter): Galaxy Generator
User avatar
Daequeous
 
Posts: 97
Joined: Tue Dec 13, 2011 8:30 pm
Location: Sweden

Re: Daequeous' Galaxy Generator

Postby dcarde007 » Thu Dec 29, 2011 1:42 pm

Ah, so you are connecting the nodes while creating the stars.
dcarde007
 
Posts: 32
Joined: Sat Dec 03, 2011 9:33 pm

Re: Daequeous' Galaxy Generator (v1.0)

Postby Daequeous » Thu Dec 29, 2011 10:39 pm

Yes. Originally I created the stars first not worrying about node lines. However, I found it much easier to do the connections at the same time rather than having to do a whole lot of checks on every system afterwards in order to guarantee everything was reachable.
Random starmap generator with property sliders (and SotS prime map converter): Galaxy Generator
User avatar
Daequeous
 
Posts: 97
Joined: Tue Dec 13, 2011 8:30 pm
Location: Sweden

Re: Daequeous' Galaxy Generator (v1.0)

Postby Novak » Wed Jan 04, 2012 5:20 pm

hello, is it possible to modify it to double the number of star system that the generator can make?
User avatar
Novak
 
Posts: 8
Joined: Sat Dec 17, 2011 2:27 am

Re: Daequeous' Galaxy Generator (v1.0)

Postby rimbimbambo » Thu Jan 05, 2012 7:09 pm

Next patch it will be, I found a bug with the random naming that caused a crash when you ran out of unnamed stars - So this should solve the map star limit issue we were getting earlier. (I remember someone posted about it before).
User avatar
rimbimbambo
Kerberos
 
Posts: 440
Joined: Sat Oct 08, 2011 8:42 pm

Re: Daequeous' Galaxy Generator (v1.0)

Postby LuggLD » Thu Jan 05, 2012 7:42 pm

rimbimbambo wrote:Next patch it will be, I found a bug with the random naming that caused a crash when you ran out of unnamed stars - So this should solve the map star limit issue we were getting earlier. (I remember someone posted about it before).


Excellent news! While you're here: any estimate on when that patch is going to land? :)

Edit: Nevermind, found it! viewtopic.php?f=37&t=25284
User avatar
LuggLD
 
Posts: 143
Joined: Sun Oct 30, 2011 12:58 pm
Location: Germany

Re: Daequeous' Galaxy Generator (v1.0)

Postby Daequeous » Fri Jan 06, 2012 8:04 pm

This is indeed wonderful news :D

I will increase the maximum star limit and make the updated generator available shortly after the patch goes live.
Random starmap generator with property sliders (and SotS prime map converter): Galaxy Generator
User avatar
Daequeous
 
Posts: 97
Joined: Tue Dec 13, 2011 8:30 pm
Location: Sweden

Re: Daequeous' Galaxy Generator (v1.0)

Postby chasesan » Fri Jan 06, 2012 9:00 pm

Yeah I posted about the star limitation.

I was using my mapgen utility.

I also used one of my utilities to check code similarity, and yours isn't based off it, at least not directly, so good job. (it checks byte code for similarities)

viewtopic.php?f=50&t=22798&start=15

I think the limit was around 230 or something.
“Programmers are just humans: forgetful, lazy, and they make every mistake imaginable.”
User avatar
chasesan
 
Posts: 82
Joined: Sun Oct 30, 2011 8:05 pm
Location: Space Rabbits! Really!

Re: Daequeous' Galaxy Generator (v1.0)

Postby Daequeous » Sat Jan 07, 2012 12:40 pm

Thanks. The amount of research I did before committing to this was not exactly extensive, so I was unaware of your efforts. By glancing at your algorithms I see that you have linear algebra skills that I found myself lacking during parts of my implementation, and had to work around. It would seem we are using fairly different approaches, which is always interesting.
Random starmap generator with property sliders (and SotS prime map converter): Galaxy Generator
User avatar
Daequeous
 
Posts: 97
Joined: Tue Dec 13, 2011 8:30 pm
Location: Sweden

Next

Return to Modding

Who is online

Users browsing this forum: No registered users and 1 guest

x