- Home /
Possible to generate galaxys? with solar systems?
So, im wondering how would i achieve this, Not Procedurally generated, 1 time generated, so it gets a full map, maybe data file i guess, and then if the galaxy isn't found it generates a new one, then it writes to a data file and then when the scene loads, the galaxy loads too. Maybe look something like this;
public class GenerateGalaxy : MonoBehaviour{
public bool override; // use this to force generate a galaxy.
public int galaxydensitiy = 1; // use this to determine how big galaxy is (Def; 1 = 250k planets)
void start{
// Check if galaxy data file already exists, if not then create a new one
// Add Solar Systems (When in galaxy add their own planet count)
}
}
The reason why i'm wondering this is; Simple! I don't want to have to make 100k+ planets, by hand, it will be extremely time consuming (Probably will take more than 1000+ hours (Including tree and stuff)) I'm not asking for any script, although it will probably be more helpful.
Edit: Yes, i do want it to generate prodederally FIRST, then if the file doesnt exsist, re generate it.
Answer by Serellyn · Jun 03, 2018 at 08:21 AM
Well, that's a coincidence, I was about to start on a 'space' game as well. Just not as big as you seem to want it...
Start out with at least a model for the planets, the model should contain variables like 'id', 'name', 'coordinatesandwhatnot'. Then within your GenerateGalaxy you want to create a List variable and fill it with all the planets. You could just create a for-loop saying that when the List count is lower than 250 (or something like that) then add another Planet with a random generated name/coordinates to the List.
Okay so, on the part of saving you galaxy, that's just a matter of saving to file or database. I don't think you need anything special for that, just create a model you can save and add the Galaxy model to it. Checking if your save then exists also isn't very hard. I hope this helped at least somewhat in your thought process.
Answer by b1gry4n · Jun 03, 2018 at 08:12 AM
You say you dont want procedural, but then say you dont want to make 100k planets. so youre saying a pool of planets to spawn. yes thats possible, save them as prefabs and instantiate them. your question is pretty broad and if you are ever asking "is it possible to do xyz" ... yes its always possible, but maybe not always probable