5
\$\begingroup\$

I'm trying to build a space game and one of the key parts is building on spherical planet. I want the buildings to be build on a grid (some building are 1x1, some 6x4,..., kinda like StarCraft). My problem is, I can't seem to find a way to build the buildings near poles, while maintaining properly oriented grid.

I think that joining cells near poles is a bad idea, because there will be parts, where 1 cell is continued by 2 cells and it will be impossible to build over these parts.

Any ideas how to solve this? Should I forget about the grid and just check, if the building collides with other buildings?

\$\endgroup\$
  • \$\begingroup\$ Maybe the mathematics behind constructing a geodesic sphere could come in handy here - although you will end up with triangular tiles, not round ones. \$\endgroup\$ – Philipp May 14 '15 at 9:38
  • 1
    \$\begingroup\$ Are you completely sold on the idea to have orthogonal tiles? You could instead allow players to place their buildings freely at floating-point coordinates and rotate them freely by 360° (use quaternions to describe the rotation so you don't get any problematic behavior around the poles). You just check for intersection of the footprints and let the player worry about how to build a rectangular base on a round planet when they really want to be OCD about it. \$\endgroup\$ – Philipp May 14 '15 at 9:43
  • 1
    \$\begingroup\$ @Philipp I know. On the other hand, I'm planning for the building space to be very small and tiles would (imho) make effective placement much easier (you can see that you have exactly 2 tile space between buildings, so you know that some other building will fit between (without the tiles, you could put the 2 buildings 1.99 tile away from each other and you wouldn't be able to put the third building between)). \$\endgroup\$ – user2486570 May 14 '15 at 15:15
3
\$\begingroup\$

I can suggest to use a quad sphere

enter image description here

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

The quad sphere is good, but I'd like to throw another suggestion in the ring. Let's say you want a hex grid on a planet. Hex grids are all sorts of useful for strategy games. How do you do that?

In the same way that a cube, subdivided, then projected to a sphere gives you a square grid on the surface of the sphere, you can take an icosahedron, subdivide it, and project it to the surface of a sphere. There'll be some pentagons in the mix, but otherwise it has all the properties of a hex grid.

It's called a Geodesic Grid and it's used a lot in climate science. It's annoyingly more complicated, but hex grids are cool :)

There's some good resources at the BUGS site.

\$\endgroup\$
0
\$\begingroup\$

Introduce polar caps where there is no square grid and player can't build. Buildable areas will be ring-shaped alike in Civilization.

Topological representation:

enter image description here

\$\endgroup\$

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.