如何在内存中表示十六进制/十六进制网格? [英] How do I represent a hextile/hex grid in memory?

查看:27
本文介绍了如何在内存中表示十六进制/十六进制网格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我正在构建一个带有六边形网格的棋盘游戏,例如

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

Note that each vertex and edge may have an attribute (a road and settlement above).

How would I make a data structure which represents this board? What are the patterns for accessing each tile's neighbors, edges and vertices?

解决方案

Amit Patel has posted an amazing page on this topic. It's so comprehensive and wonderful that it needs to be the definitive answer to this question: Hexagonal Grids

这篇关于如何在内存中表示十六进制/十六进制网格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆