1
\$\begingroup\$

What is a simple way of representing celestial bodies in outer space using a coordinate system? There are actual scientific coordinate systems (see https://en.wikipedia.org/wiki/Celestial_coordinate_system) but they may be too complicated to really understand and bring up the barrier of entry to my game.

I could just end up using a two-dimensional system to make things simple, but I'd like to inject some realism into the game and make it 3D. Any thoughts?

Edit: This is for a completely text-based game. The coordinates are for the user to situate themselves in 3D space and for me to be able to calculate distances between celestial objects.

\$\endgroup\$
6
  • \$\begingroup\$ I am interested in what you want to ask about, but at its current state, it's unclear what you are really asking. I suggest that you edit the question, reformulating it in a different way and giving examples to make it clearer. \$\endgroup\$
    – MAnd
    Commented Jan 10, 2016 at 5:29
  • \$\begingroup\$ Sounds like you already know the answer you are looking for. at some point you will need to convert however you represent your coordinate system into xyz to render, so start there? \$\endgroup\$ Commented Jan 10, 2016 at 9:18
  • \$\begingroup\$ @drumbumLOLcatz: Sorry I think I was unclear. This is for a completely text-based game. The coordinates are for the user to situate themselves in space (and also for me to calculate distances between objects). \$\endgroup\$
    – nopcorn
    Commented Jan 10, 2016 at 14:22
  • \$\begingroup\$ @MAnd: Yeah I was unclear. See my edit :) \$\endgroup\$
    – nopcorn
    Commented Jan 10, 2016 at 14:23
  • 1
    \$\begingroup\$ What is the player trying to do? Why does the player care about coordinates? \$\endgroup\$
    – John K
    Commented Jan 10, 2016 at 15:46

2 Answers 2

2
\$\begingroup\$

The problem is that there is no center for Universe, and everything rotates. But it can be simplified if your user is restricted to one Galaxy, and physics is simplified a bit:

You could use Spherical coordinate system based on center of Galaxy. So you take angle from this Galaxy's equator, angle from this Galaxy's axis of rotation ( most of galaxies rotate, you have to arbitraty choose 0 deg ray ), and the distance from Galaxy's center. Those three numbers ( 2 angles, one distance ) could clearly define any Solar system in that simplified Galaxy. And inside Solar system you can just enumerate Planets.

\$\endgroup\$
1
\$\begingroup\$

Alternatively, if you don't like spherical coordinates, you could use a simple cartesian (x, y, z) coordinate system. Just put the origin at the galactic center, have the z-axis point out of the galactic plane, and arbitrarily choose a direction in the galactic plane as the x-axis (with the y-axis also in the galactic plane, 90° away from the x-axis).

An advantage of this system is that you can calculate distances simply using the Pythagorean formula dist(a, b) = sqrt( (xaxb)2 + (yayb)2 + (zazb)2 ). The main disadvantage, compared to the angular coordinate system suggested by Marqin, is that you'll need to use this formula even for distance from the galactic center, instead of just getting it directly from the first coordinate. Of course, if precise distance from the galactic center doesn't matter much in your game, this might not really be a disadvantage anyway.

(Other possibilities could include a hybrid "cylindrical" (r, θ, z) coordinate system, where position within the galactic plane is given by distance r from the center and an angle θ, but distance from the galactic plane is simply given as in the cartesian system. Given that the galaxy is mostly a flat disc, this might make some sense.)

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .