3
\$\begingroup\$

I am working on a personal project of developing a simple 3D strategy game. I am working on my own game engine (let's assume that I have to have my own) and I have one theoretical question. How to develop a suitable coordinate system, which would be scalable and provide the best versability?

I am deciding between a X,Y coordinate system (different units cover different space - simply rectangle shaped) and a hexagonal system (bigger units take more hexagons).

I am working here with a simple concept of three different units of three different sizes for every player (maybe even buildings) and collision detection with conflict resolution. Thanks.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ There's no correct answer to this question. It just depends on the details of your game. \$\endgroup\$ – Almo Jan 22 '16 at 16:29
2
\$\begingroup\$

Amit Patel wrote a great entry all about hexagonal coordinate systems at http://www.redblobgames.com/grids/hexagons/ and I strongly encourage you to read through the whole thing for a deeper understanding.

A system he mentions in there that happens to be my personal choice for such systems is the Cube Coordinate system; In this system, three numbers are given to determine location of the hexagon (to match the 3 axes of a hexagon):

Description of cube axes

There are a couple of advantages to this system with the biggest one being that the three values of a hexagon's location when added will all equal zero. That is to say, X + Y + Z = 0. This is also what allows you to further simplify the system into Axial Coordinates; Because X + Y + Z always equal 0, then you can remove one of the axes and still have enough information to determine a position. If X = -1 and Y = 1, and Z is left undefined, it's easy to determine that Z = 0.

\$\endgroup\$
1
  • \$\begingroup\$ Btw, a hexagonal grid is actually a square grid with only one diagonal directional allowed. That's why in the cubic coordinate system X+Y+Z=0. e.g. drop the Z axis entirely and you'll be fine (you just have to remember the skew). \$\endgroup\$ – Draco18s no longer trusts SE Jan 22 '16 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.