Archived

This topic is now archived and is closed to further replies.

Nick_Gen

Hexsides

Recommended Posts

Hello, I currently work on an map editor for my Wargame, all functions Work Fine , but I would like to now implement the management of Hexsides(for rivers, roads...) Somebody can help me? I search some code or tutorial. Thanks Nick

Share this post


Link to post
Share on other sites
A hex sequence of images for tile-connecting structures like rivers and roads require 64 unique images (2 to the 6th power) for inland tiles, and 6 images for coastal tiles. It may not actually require 70 images, however, if you make clever use of reflected, mirrored, and rotated images, or are able to build the structures from components (which works well for roads, but not so well for rivers), in which case you will need as few as 3 images for hexes.

storing this information in a file on disk is simple: you use a single bit to indicate the presence of a road and a single bit to indicate the presence of a river. at load time, you calculate the image required for that tile based on the road or river flag for that tile and the tile of all of its neighbors. i typically assign bit 0 to the direction closest to north when moving clockwise, and bits 1,2,3,4 and 5 are in a clockwise direction around the hex.





Share this post


Link to post
Share on other sites
Well I was going to link you to a 2 part series that TANSTAAFL did, but GameDev no longer seems to have those files. Go to the Articles section and click on Tile-Based Games. There are sure to be some good resources for you in there.

Share this post


Link to post
Share on other sites