Representing Bitmaps for Hex Grid?
BlitzMax Forums/BlitzMax Programming/Representing Bitmaps for Hex Grid?
| ||
| Let's say someone was writing a game similar to the old Civilizations which used 2D bitmaps for the hexes. What is a good way to draw a hexagonal bitmap in Blitzmax? One obvious way would be to atlas them packed onto squares with transparency color between but that leaves a fair bit of wasted space. Is there any more efficient way? |
| ||
More efficient in storage, but less in drawing:
.^. .^. _____
/ \ --> /___\ --> |\\ //| ___
/ \ /| |\ | \\ // | | |
/ \ / | | \ | -'. | | |
\ / \ | | / | '.' | + | |
\ / \|___|/ | // \\ | |___|
\ / \ / |//___\\|
\ / \ /
' '
1. your tile 2. an imaginary cutline 3. the outer triangles cut and reversed (left triangle gets right one, top gets bottom one etc.) 4. the center tile of the sprite - the rectangular area. Hope my drawing is understandable. Another thing would be some kind of "rotation" or quad-manipulation- All in all I think the way to keep the sparpness of the bitmaps is to store them as they are (or packed like I explained above). bye Ron |
| ||
| More efficient in storage, but less in drawing: Exactly. I think one should have *very* good reasons to abandon the "traditional" transparency method and the simpler drawing/storage routines, that are also easier to maintain. Here are some questions one should be able to answer: - How many hexagonal tiles are really needed? Dozens? Hundreds? Thousands? - How much memory do you want/need to save? A few megabyte? Or drastically more? - What platform do you develop for? Regular PC/Mac platform? With how much gigabyte RAM (of HD storage space and RAM)? With most graphics cards of the last six, eight years you can use tile images with a resolution of 2048x2048 *easily*. You can put 1024 tiles with a resolution of 64x64 pixels into those. If you want to be even more compatible (to older hardware) then use a resolution of 1024x1024 pixels which still means 256 tiles with that dimension - with each of those "megapixel files". Hope my drawing is understandable. Yes, your drawing is very clear - but it doesn't show hexagonals... ;-) |
| ||
| lol ...you are right, it shows iso-tiles (thought he wanted to say that because "old Civilization" is Civ1 or Civ2, first one had normal tiles, second one iso tiles). But the principle stays the same: each "cut of corner" could be merged with the oposite ones of all corners. bye Ron |
| ||
| Makes sense, thanks gents. I keep forgetting that we have supercomputers now. |