Logo Platform
logo amplifiers simplified

Galaxy Generator explained

Reply
Copied to clipboard!
0Send private message
12 years ago
Jul 16, 2012, 6:23:58 PM
zetal911 wrote:
Hey JLA, thanks a ton for the response. My first instinct was actually exactly what you suggested with regards to creating a new Galaxy Shape, but for whatever reason, the newly created Galaxy Shape will not appear in-game, under the appropriate option dropdown. Have I missed something?



As for the symmetry... I see. I have the source project all set up, so I could produce a new dll. Do you have any recommendations on where to start trying to create a symmetrical generator? Thanks!



Edit: I just compiled a .dll as an experiment, but now I have no idea what to do with it. Where do I put this? =P




ever get a response to this? I am having the same issue
0Send private message
12 years ago
Jul 15, 2012, 3:50:07 PM
zetal the home system is linked to the galaxy xml datas i already changed the starting planets etc but i only can restrict a single annomaly i can´t just allow a single one
0Send private message
12 years ago
Jul 15, 2012, 3:38:13 PM
Not sure this is a modding question, it is a game design suggestion. If you created a random galaxy, you cannot see the seed. There is a seed field in the advanced options tab; but it is a write-only field. That is, you can write a seed value there and the game will use it.
0Send private message
12 years ago
Jul 15, 2012, 12:56:35 PM
Hi,



I think the possibility to have a mirrored galaxy would be great, my opponent would stop blaming inbalanced start when i kick his ass XD.



Btw i have a question for you expert in galaxy generation ; where is the galaxy seed? I cannot find it anywhere smiley: frown

I found a "balanced" galaxy and i want to play in the same map again.



Thanks
0Send private message
12 years ago
Jul 15, 2012, 7:36:49 AM
I believe (I could be wrong here) that Home Planet generation is linked to Factions and their Affinities, not to the Galaxy Generator. You should look into modifying faction XML's. For those, remember to keep the number of characters the same, or it won't work.
0Send private message
12 years ago
Jul 4, 2012, 2:12:25 PM
Dear all,



Let's by start explaining how the game Galaxy Generator works.



You will find attached to this post 2 archives, one for the data, one for the actual C# sources of the galaxy generation DLL.



Galaxy Generation Data

Here is a description of the files found in this archive



  • GalaxySettings.xml: this file is the database which defines all the available parameters used by the galaxy generation. Special homeworld conditions depending on your faction affinity, galaxy generation parameters used in the game menus, planets generation probabilities per star type, planet sizes probabilities per planet type, moons probabilities per planet type, anomalies probabilties per planet type (to avoid garden of eden on asteroids smiley: smile), temple probability per star type, temple types, strategic and luxury resources probabilities (which also pass through a repartition algorithm), star generation parameters, star names, constellation names (not yet displayed in the build smiley: smile). Most of the data found here is later referenced by name, adding a suffix or prefix to reference the right xml description. For instance a "PlanetTypeTerran" identifier in this GalaxySettings.xml file will be implicitely translated to "PlanetTypeTerran" for its descriptor name.



  • GalaxyShapes.xml: this defines each galaxy shape available in the game options. The main trick is that each shape is linked to two files : the density and the region file. the density is used to determine probability of occurence for a generated star (white = 100%, black = 0%, shades of grey = varying %), while the region files attributes a region to a star depending on the underlying color pixel (declared in the GalaxyShapes.xml file). The colors found in must exactly match the color code described in the xml regions. This is how we create basic constellations, while the generator (depending on its options) is capable of sub-dividing them. The density and region files are located in the matching folders for each galaxy shape. The symetry options are not used right now, maybe later on if we want to achieve purely symetric (balanced) galaxies. The layout is used to attach graphical objects (nebulae and such) to each galaxy shape. Even if you dont recreate 3D assets, you can attach a different 3D background to a new shape.



  • GalaxyConfiguration.xml: this is just a summary of all game options selected by the user prior to launching the generation : galaxy shape, size, number of empire, advanced settings, etc. If you mod the generator, it allows you to verify what is input to it from the game menus. You can also modify this manually if you do a console-only version of the generator. Actually, our galaxy generator expert has a separate program to generate galaxies and visualize the result outside of the editor.



  • Galaxy.xml: this is the result of the output from the Galaxy Generator, precisely what will be loaded by the game once the generation is performed. It is also typically the format of saved games (at least a part of it).





Right now, in the installed build, the GalaxySettings.xml GalaxyShapes.xml files are hidden in the Unity archive. We will move them later on.



Galaxy Generator source

I have placed in this archive the source code for the generator. It is compiled as a C# DLL (I included the project), and dynamically linked to the game. I have included the Visual Studio project (I think you can get a free Express version), incase you want to recompile it.



Basically, the generator is fed with the GalaxySetup.xml file, the GalaxyShapes.xml file, the GalaxyConfiguration.xml file, a generation seed (in case you want to regenerate the same thing twice), and it outputs the Galaxy.xml file.



The behavior of the generator is satisfying right now, but we plan on having it evolve using triangulation algorithm to better design the regions and the density of stars. The density file could disappear based on the approahc we take. We will keep you informed any way.



This should give you some elements to start your musing, do not hesitate to ask more questions. I will try to get more people on this thread.



Cheers,
0Send private message
12 years ago
Jul 13, 2012, 10:37:16 PM
JLA wrote:
1 - Look for the GalaxyShapes.xml file, and the Regions and Density folders. Two pngs and one descriptor in the xml will define a new shape. You will need to create a colored areas picture (neutral white regions, and colored empire-spawning regions), and a grey-shaded picture (black for no stars, white for max density of stars). Both pictures should be a decal of each other (same shape, different color scheme). Try copying a shape, both pics and the corresponding xml element, and then start modifying it. In the GalaxySettings.xml file, add an entry with the name of your new shape in the element.



2 - The generator is a random one. Unless you start coding a new dll yourself, the shape definition will be symmetrical, but the end result will be random. A symmetrical generator is being considered, but it is not yet determined if it will be implemented officially.



Keep me updated on your progress !



JL




Hey JLA, thanks a ton for the response. My first instinct was actually exactly what you suggested with regards to creating a new Galaxy Shape, but for whatever reason, the newly created Galaxy Shape will not appear in-game, under the appropriate option dropdown. Have I missed something?



As for the symmetry... I see. I have the source project all set up, so I could produce a new dll. Do you have any recommendations on where to start trying to create a symmetrical generator? Thanks!



Edit: I just compiled a .dll as an experiment, but now I have no idea what to do with it. Where do I put this? =P
0Send private message
12 years ago
Jul 13, 2012, 6:17:15 AM
zetal911 wrote:
Sorry to be a bother, but I've been flailing around in the XML for quite a while now, with no real results. I have a few questions.



1) Let's say I wanted to go about adding in a new Galaxy Shape? How would I go about doing that?

2) As a follow-up to that, how could I guarantee that the new galaxy would be a mirrored shape- ie, symmetrical down the middle in all regards?



Edit: I've managed to EDIT an existing Galaxy Shape, but I have not yet created a new one, that is displayed on the list.




1 - Look for the GalaxyShapes.xml file, and the Regions and Density folders. Two pngs and one descriptor in the xml will define a new shape. You will need to create a colored areas picture (neutral white regions, and colored empire-spawning regions), and a grey-shaded picture (black for no stars, white for max density of stars). Both pictures should be a decal of each other (same shape, different color scheme). Try copying a shape, both pics and the corresponding xml element, and then start modifying it. In the GalaxySettings.xml file, add an entry with the name of your new shape in the element.



2 - The generator is a random one. Unless you start coding a new dll yourself, the shape definition will be symmetrical, but the end result will be random. A symmetrical generator is being considered, but it is not yet determined if it will be implemented officially.



Keep me updated on your progress !



JL
0Send private message
12 years ago
Jul 11, 2012, 10:22:49 PM
Sorry to be a bother, but I've been flailing around in the XML for quite a while now, with no real results. I have a few questions.



1) Let's say I wanted to go about adding in a new Galaxy Shape? How would I go about doing that?

2) As a follow-up to that, how could I guarantee that the new galaxy would be a mirrored shape- ie, symmetrical down the middle in all regards?



Edit: I've managed to EDIT an existing Galaxy Shape, but I have not yet created a new one, that is displayed on the list.
0Send private message
12 years ago
Jul 10, 2012, 8:08:28 AM
In addition to the width/surface issue, when increasing the number of stars, one should be mindful of increasing the base resource numbers in the same GalaxySize element... Or else, resources will be very scarce indeed...
0Send private message
12 years ago
Jul 10, 2012, 5:09:39 AM
I got it today. I was confused after reading OP's comment about the source code being "dynamically linked to the game." If this happens to anyone else, you have to change the game files not the resources provided in this thread. In other words, navigate to Endless Space via the file tree. For me this is: C:/Program Files/Steam/SteamApps/common/Endless Space/Assets/Xml/GalaxyGenerator



I made a 200-star system, then tried a 500 star one. JLA, you were indeed correct that the load times were slow. I gave up on my 500-star system after waiting 30 minutes for it to load.



The width equation is interesting, and I'm glad you made that point because I hadn't thought through that far. I think your numbers are a good guide, but unless I did something wrong, the galaxy ended up being a bit crowded anyway, so I would recommend starting with the square root way, then adding a bit more for good measure.
0Send private message
12 years ago
Jul 9, 2012, 9:56:40 AM
Alysciph wrote:
Could an experienced programer please explain in layman's terms the process for a basic tweak to the generator here? I am trying to make a massive galaxy and I have opened GalaxySettings.xml and changed the value for number of stars in the "huge" option to 200 to test. I then saved my work (all using notebook,) then opened the game to find no change. I must be missing a step somewhere. Any help would be greatly appreciated!




Did you create a "New Game" after you modified the values ? A galaxy generation only happens upon a new game being launched.



In addition, for players who enjoy long games and huge galaxies and who consider modding :



- the generation algorithms are tailored for factory settings number of stars. I created a 160-star galaxy and it worked, but be prepared for a few minutes wait, even on a rather fast computer. This is only C# after all, and asking for 10000 stars will get you in trouble. The algorithms for generation (and I expect for gameplay too) are not optimized for values way in excess of what you have as factory default.



- when increasing the number of stars, one should be mindful of increasing the available space for them, by modifying the "width" value in the galaxy size elements. In more detail, the width should increase as the square root of the number of stars. Double the number of stars, multiply width by 1.41... This ensures there will be enough room to spawn the stars and that distances between stars will not shorten too much compared to an ordinary game.



Happy modding !



JL
0Send private message
12 years ago
Jul 9, 2012, 8:35:20 AM
Could an experienced programer please explain in layman's terms the process for a basic tweak to the generator here? I am trying to make a massive galaxy and I have opened GalaxySettings.xml and changed the value for number of stars in the "huge" option to 200 to test. I then saved my work (all using notebook,) then opened the game to find no change. I must be missing a step somewhere. Any help would be greatly appreciated!
0Send private message
12 years ago
Jul 9, 2012, 12:45:31 AM
I'm having some difficulty getting the .csproj file to open. I'm really VERY new to this. I've downloaded Visual C# Express, but get errors when trying to open it.
0Send private message
?

Click here to login

Reply
Comment