How do I represent a hextile/hex grid in memory?

前端 未结 9 566
迷失自我
迷失自我 2020-12-04 05:23

Say I\'m building a board game with a hextile grid, like Settlers of Catan:

\"Hosted

Note that

9条回答
  •  孤街浪徒
    2020-12-04 06:01

    I am sitting here "in my free time coding for fun" with hexes. And it goes like this... I will tell you what it looks like in words.

    1. Hexagon: it has six neighbour hexagons. It can deliver the reference for each neighbouring hex tile. It can tell you what it consists of(water ,rock, dust). It can connect itself to others and vice versa. It can even automatically connect the others surrounding him to create a greater field and or making sure all fields can be adressed by its neighbours.
    2. A building references up to three roads and three Hex Tiles. They can tell you which they are.
    3. A road references two hexes and other roads when they are adressed by neighbouring tiles. They can tell which tiles that are and which roads or buildings they connect to.

    This is just an idea how I would work on it.

提交回复
热议问题