Jump to content
  • Advertisement
Sign in to follow this  
waxor

Hex map woes

This topic is 5395 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For my game I would like to use a hex grid instead of a square grid as the basis for the map. The spell system is based on hex shaped runes and it seems more artisicly correct to use hexes wherever possible. My first issue is making anything that is not a flat plane. it is very easy to create non-planar hex cells, by that I mean a hex that needs to have side at different angles and heights. This would create a visually strange effect, (ie ugly). There is no easy way to create a pretty slope. I could seperate each hex with a small border and use that as a kind of buffer to take care of the twisting. That adds a lot of extra polygons and logic to rendering the map, not where I really want to go. It also means that there would be tiny triangle holes at each corner, I could fill those but that adds even more cpu/storage strain. I could ignore this issue and render each hex at a specific height and angle, which would look bad but would get me past the issue. Has anyone run into hex map troubles? What did you do? -Mikel

Share this post


Link to post
Share on other sites
Advertisement
You could always try adding an extra vertex in the middle of the hex (probably only for non-planar hexagons) so that it is split into 6 triangles (triangles are obviously planar). You can split it into less (4 triangles) but the 6 triangle method is easiest for interpolation (height of middle vertex = average of the 6 edge verts)

Share this post


Link to post
Share on other sites
Yeah, that is how I am rendering them.

The problem is making all the hexes planar while making the map look ok.

Share this post


Link to post
Share on other sites
You're not going to be able to make the hexagons planar, they will only tesselate to make a plane.
If you want them all planar, its probably best to make them all flat horizontal but have little cliffs around them.

Share this post


Link to post
Share on other sites
How do you store the heights? Is there one height for the hexagon or one height for each vertex or one for each edge or what?

If you store the height for each hexagon, then making the center vertex at that height and each edge vertex as the average of the 3 hexagons it sits between. I did this and it looks quite good, although the edges are still a little sharp.

If you really want to get them smooth you might want to break each triangle up into smaller pieces and use some sort of weighting factor of the three nearest hexagons to determine the heights of the intermediate vertices. I assume by planar you mean smooth as having a 3d surface that is planar is, as was mentioned, an oxymoron.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!