I'm making a game with a 2D square grid for my world map. It wraps around, so when you reach all the way north you start out in the south again, and when you go all the way east you wind up in the west, etc.

Would this method have any flaws? I'm under the impression there might be flaws around e.g. fast travel.

  • 4
    \$\begingroup\$ If you don't see a problem with your game, then there is no problem; every game is different. Easy =) \$\endgroup\$ May 15 '12 at 23:13
  • \$\begingroup\$ The only "problem" I can think of isn't inherent in 2D square grids but in map design. Like you were saying, if you have your points of interests resting against the edge of the map then by default it would be faster to cross the nearest edge of the map rather than walk across it the correct direction. In that case, you just add some "empty" space outside of the normal borders to account for the shorter path (assuming you don't want to have that shortcut ;) ) \$\endgroup\$
    – Mike Cluck
    May 15 '12 at 23:22
  • 1
    \$\begingroup\$ I do not think this question is a good fit for the site's Q&A format. It will (technically) go unanswered until someone provides whatever flaw the asker is vaguely remembering must exist, because 'there are no flaws' is one of those things that can't be proven (you can only prove there are, or that you don't know of any yet). Any proposed flaw will not necessarily be a big one and will lead to discussion around why it's not a flaw, since I don't believe there are any flaws, but then again we can't prove that. This question is probably inviting opinions. \$\endgroup\$ May 15 '12 at 23:29
  • \$\begingroup\$ rezwits, can you expand on what you perceive as a "fast travel" flaw? Additionally, are you only asking in terms of how the map is stored? Even if you do use a 2d grid for a map, there are a lot of ways to render it, some of which will hide the underlying "gridness" of the data storage. \$\endgroup\$
    – Tim Holt
    May 15 '12 at 23:35
  • \$\begingroup\$ Alright, thanks, it just seemed like I was told along time ago I couldn't do this. Because honestly to me I mean even in a spherical globe there is fast travel, for instance, if I am in Las Vegas and I want to get to Denver. I can go east two hours on a plane and get to Denver, or I could go West around the globe in 22 hours (or so) and get Denver. Thanks again \$\endgroup\$
    – rezwits
    May 15 '12 at 23:36

Using squares for a map that's supposed to represent a planet, just be careful you don't end up representing a toroid. When I was first trying to think of a tile system where the user walks over the top and bottom and both sides were wrapped thinking to myself that that would work fine only to have my cousin point out this obvious defect in my plan XD.

In the end I settled with top and bottom being blocked and wrapped on the sides. That's the only issue that I've bumped into with squares, even though it's not dependant on squares, just one of those things that might not be immediately apparent.

  • \$\begingroup\$ Good point. Grid works great if you don't mind a non-spherical game world. \$\endgroup\$
    – Tim Holt
    May 15 '12 at 23:37
  • 2
    \$\begingroup\$ Hey, I've never thought about it like that before. You could make that a cool feature of you game. The world is a space station in the shape of a doughnut. \$\endgroup\$
    – Jay Kyburz
    May 16 '12 at 1:57
  • \$\begingroup\$ @JayKyburz Thing is that no one really thinks of it. Unless you see the map wrapped around a 3D object the difference between a sphere and a torus are pretty hard to make out from a flat map. And frankly, are confusing to players if you try to correct it from a torus to a sphere. (1/3 of map from east at north edge crosses to 2/3 of map from east on north edge) \$\endgroup\$
    – DampeS8N
    May 16 '12 at 14:31
  • \$\begingroup\$ Actually. Math above is wrong. I'll leave it as an exercise for the reader to figure out why. \$\endgroup\$
    – DampeS8N
    May 16 '12 at 14:42
  • \$\begingroup\$ Here is a visualization of the issue that I had with using a torus. For most cases this might not be a problem, but I wanted to have polar travel, ie submarines using the polar caps to get places faster, so a torus was a no go. \$\endgroup\$
    – Melignus
    May 16 '12 at 17:57

One inherent problem is that if you allow diagonal moving, like a bishop in chess, the unit will move further than a unit moving orthogonally.

This might be a problem if you combine your grid movement mechanics with other mechanics that use "as the crow flies" distance.

So for example, if you are running away from a unit who shoots x meters, and you can move y squares per turn, you would get further away if you move diagonally.

If your grid is 1 meter, moving orthogonally you will move 1 meter, but moving diagonally you will move 1.41 meters.

  • 1
    \$\begingroup\$ This would only apply when you implement movement per square. No reason why you wouldn't implement a normal movement system where you simply have a movement speed of x pixels / units in any given direction. \$\endgroup\$
    – Thomas
    May 16 '12 at 7:26
  • \$\begingroup\$ @Thomas Correct, and the opposite problem exists if you don't allow diagonal movement, now it is the same distance to travel in a huge L as it is to follow a 'straight line'. \$\endgroup\$
    – DampeS8N
    May 16 '12 at 14:39

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.