Thread: Hexagonal vs square tiles

  1. #1
    Mad OnionKnight's Avatar
    Join Date
    Jan 2005
    Umeň, Sweden

    Hexagonal vs square tiles

    I'm working on designing a game which is supposed to be a spiritual successor to Heroes 3.
    I then started pondering whether I should use hexagonal or square tiles for the world map. With square tiles there is an obvious "problem" with diagonal tiles being sqrt(2) times larger than the sides, does hexagonal tiles not have this problem or have I missed something in the math?

  2. #2
    S Sang-drax's Avatar
    Join Date
    May 2002
    G÷teborg, Sweden
    With square tiles you have two "obvious directions" of movement. With hexagonal tiles you have three. When you try to diagonally in a square grid, you run into the problem you described. This is avoided (in some sense) in hexagonal grids because there is no neighbours to go to, other than the tiles which alreay share a side.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    You can represent hex-rows as a 2D array. You just need to offset every other row, and adjust your movement.
    So if you're not sure how to get hexes in memory, just use a 2D array, and consider the above illustration on how to work out your movement and neighboring hexes.

    Last edited by quzah; 04-26-2007 at 08:49 PM. Reason: color
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tic Tac Toe Comp Move help
    By swgh in forum C++ Programming
    Replies: 5
    Last Post: 09-24-2008, 11:05 AM
  2. Loop seg error
    By Zishaan in forum Game Programming
    Replies: 2
    Last Post: 03-28-2007, 01:27 PM
  3. Forced moves trouble!!
    By Zishaan in forum Game Programming
    Replies: 0
    Last Post: 03-27-2007, 06:57 PM
  4. Help with my draughts game
    By Zishaan in forum C++ Programming
    Replies: 9
    Last Post: 03-24-2007, 07:33 AM
  5. C++ Checkers Game
    By SnS CEO in forum C++ Programming
    Replies: 9
    Last Post: 09-07-2005, 01:21 AM