Generate a 3d galaxy map

Hi all,



maybe someone has a nice idea for generating a 3d galaxy map like this one.

Does anyone know ascendancy?



I’m not sure what the best approach is…



I randomly creating some vertex/3d points/Vector3f (somethink like this). So know how to determine the neighbors?

A way is to iterate through all 3d points and use the distance() method of Vector3f. but perhaps there is a better way?

Maybe do the generation in another way!?



Anyone a idea?



Regards

saw demo like this, node tree ??

manxside said:

saw demo like this,...

Where? Source?

manxside said:

... node tree ??

Yes i allready think of something like this. But this is just data organisation. To fill this structure you still have to find the neighbors.

Or what are your thoughts on this?

Correct if i wrong, this is a plan view, if 3d planets are too far to really need to render whole planet.



Next you need player view in 3d space, then render planets as disks ( single mesh if you can make ) ,first texture is that planet pic, second a texture to make it look like it has spherical shading ( darkness ). then if player zoom to planet, switch it with sphere





You just need to know the relationships of the planets ( which line connect which planets ), the node tree class will show you the line building.


manxside said:

Correct if i wrong, this is a plan view, if 3d planets are too far to really need to render whole planet.

Right, you don't see detailed planets. The galaxy map will contain planet systems and nearby system must be connected with lines.

manxside said:

You just need to know the relationships of the planets ( which line connect which planets ), the node tree class will show you the line building.

Exactly... i need to know the relations between the systems in the galaxy map. So i have to find the nearby systems.
Which node tree class do you mean? The TreeNode class form jre?
How will this help me to find the neighbors? Yes, after i have filled it with my systems it will help me. But first i have to fill it and to do so i have to know the neighbors before.

I see someone else has also been inspired by the FreeOrion project :slight_smile:

Cool.



I am also working on a space-strategy game… You wanna share more info about your project?

Ah, relationship is rule - maybe in this case sometimes trading, sometimes politics depending on what user want to know.



simple data node like follwoing

class relation(){
Planet to;
}




store a  collection of these somewhere for each planet ( maybe a bespoke RelationManager ). Before adding relation, check planet to has not already got a relation marked, if not add it.

then just draw lines from the planet for all relations selected


@manxside Thanks for you investigation. But this didn't really help me. The data structure/organisation is not my problem. The drawing is also not my problem. The problem is to know the near neighbors of each random 3d point before i can fill any data sturcture. it's more a sorting problem.

Perhaps i have the wrong approach and have to generate it in another way.



@Mindgamer Yes, cool someone else also know about it. ^^ I follow the project now a long time. I think since it began.

I really like those games.

Cool you are also working on such a game. Would be nice to talk about it.

I do not have a real concept for now. I just play abit around and have some rough ideas.

Ah, in that case you need neighbour distance rule ?? what defines a neighbour pls, if it simple distance (x * x) +(y * y) + ( z * z) then you have it



where

x = planet.x - neighbourPlanetX.
if x < 0 x = x*-1;



I am not sure if this will help you, but I will give it a try.



This will work for 2D or 3D (or more! :D).


  1. Calculate a number of planets/galaxies. You can use any random algorithm here, from "all coordinates are random" to something more sophisticated like randomizing polar/spherical coordinates and distance, so your complete map would be more like a sphere.


  2. Now you need a "maximum" distance (let's call it R) for a planet to be "accesible". You can set it by hand, or based in density, or in your battleships autonomy…


  3. Now imagine a sphere with radius R around each of those points. Iterate through your galaxies: all other galaxies within the sphere are accesible. If you want funny effects you can randomly displace the center of the sphere, while keeping your galaxy inside it. Fill your galacy structure with the info of the relationships (and remember to also fill each "related" galaxy's data).


  4. Walk again your galaxies, looking for isolated ones (no relations). Randomly increase R and calculate relations again until you have at least 1 relation ()



    Actually, there are lots of ways of doing this. It really depends on what you want.



    To find the distance between two points, use: d = sqrt( (x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2 ).



    In jME I prefer: float d = (vector2.substract (vector1)).length();



    To find if a point is in a given (sphere), and if performance if an issue, you can save the square root up there, but I don't think that's the problem…



    I might have misunderstood your question. Sorry.