Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

HexGlobe: Hex-based planetary globes for strategy games

Discussion in 'Assets and Asset Store' started by Tasarran, Oct 30, 2012.

  1. Tasarran

    Tasarran

    Joined:
    Jan 20, 2011
    Posts:
    327
    I am pleased to announce the release of HexGlobe!

    WebPlayer!
    http://www.electricrune.com/Worlds4/GeoGlobe4.html

    $SS1.png

    Inspired by 'HexPlanet,' HexGlobe allows the user to create hex-based globes that can be used for turn-based games.
    The base of the system is an icosahedron, a solid figure with twenty triangular faces.
    Each face is divided a number of times, and the vertices are normalized into a spherical shape.
    Each vertex from this stage becomes the center of a hexagon.
    The data for the terrain is loaded from a map the user creates, land is raised, and a fractal function is applied to each of the original triangular meshes, simulating actual terrain.

    There are toggles for creating and saving the texture maps, which are created with a procedural 'air-brushing,' so there are no ugly repeating patterns in the hexes. The hexagon grid is a separate, toggle-able layer.

    The distance around the equator of a globe is equal to the number of subdivisions, times 5.
    HexGlobe supports sizes from 5 (equator=25, # hexes = 252) to 100 (equator=500, # hexes = 100,002).

    This is a sample of a section of the input map that makes the globe in the screenshot and webplayer demo (50 subdivisions).
    $GlobeMap.jpg

    Included are size 10 and size 50 globe maps of the Earth, and documentation on how to create worlds of your own.

    Out of the box, there are six heights of terrain (Water, Low Plains, Plains, Hills, Mountains, and Extreme Mountains), and four kinds of 'ground cover': Grass, Forest, Sand, and Snow; but the user can easily extend this basic terrain system to suit their individual design needs.

    This is not a game in a box, but this is all the base functionality you need in the map/board part of a strategy game you might want to design. It has been kept intentionally basic to allow for extension by the user in a variety of ways.

    A basic pointer has been included to show that these hexes are discreet points on the surface of the globe, and how they can be referenced and clicked.

    If you've been thinking of making a grand-scale strategy game, this engine could save you literally months of design time!
     
  2. Toxic Blob

    Toxic Blob

    Joined:
    Jun 8, 2010
    Posts:
    18
    Looks really interesting.
     
  3. Tasarran

    Tasarran

    Joined:
    Jan 20, 2011
    Posts:
    327
    Sales are already happening; thanks so much for your support!

    If anyone has any problems or questions, I'm more than happy to discuss the package, and how to make it do what you need it to do!
     
  4. Tasarran

    Tasarran

    Joined:
    Jan 20, 2011
    Posts:
    327
    Several sales so far, but it would really help with my visibility if I could get some Ratings!
     
  5. Shizen

    Shizen

    Joined:
    Dec 31, 2012
    Posts:
    14
    I recognize that you are trying to sell your work on the asset store for a profit, and therein might not be interested in discussing the technical aspects of your work, but having recently ported HexPlanet to Unity myself, I am very curious about how you went about implementing your solution. It is hard to tell from your images how many pentagons you've had to insert to achieve your sphere. The hexplanet algorithm seems to insert a fair number. I haven't looked at the problem, yet, but I am reasonably concerned about pathfinding over the sphere with so many pentagons (and mapping the display to a model intuitively). I have seen maps with only a few pentagons (I read somewhere that 4 was the minimum number possible? although I found a demo app that seems to manage with only 1). I'd love to know what sort of "performance" your spherical algorithm gets. I'd love even more to know where you found your algorithm?
     
  6. Tasarran

    Tasarran

    Joined:
    Jan 20, 2011
    Posts:
    327
    There are 12 pentagons. They aren't inserted, they are there from the very beginning; the hexagons get inserted between the pentagons.
    I don't know where you've seen globes with 1 or 4 pentagons, but I think you might be mistaken; as far as I know, it requires 12, no more no less.

    I start with a model of an icosahedron (20-sided solid, think d20), and the pentagons are there at the corners.
    I achieve the globe by dividing the faces, and then normallizing all the vertices so that they are all 1 unit from the center.

    But your concern about pathfinding really isn't an issue; any pathfinding algorithm I'm aware of will work with n-connected nodes.

    In other words, each hex is just a number somewhere, and you can store a list of all the connecting numbers.
    You just have to write the routine that checks the neighbor hexes so that it can handle either 5 or 6.
     
  7. Elie S.

    Elie S.

    Joined:
    Jan 2, 2013
    Posts:
    5
  8. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Hi! Just bought the asset. What is proper way to generate 10hex map with the sample scene included? Can you please explain it step by step? No matter how I tweak, my Unity hangs up on generation stage, while sample scene generates just fine.
     
  9. Tasarran

    Tasarran

    Joined:
    Jan 20, 2011
    Posts:
    327
    Look in Assets/_GeoSphere/Documentation.
    There is a PDF in there that shows you how to set up your map, and it uses a 10-globe as the example.
     
  10. IndieForger

    IndieForger

    Joined:
    Dec 31, 2012
    Posts:
    92
    Hey Tasarran.

    Just bought your package.
    I tried to run the example but it doesn't really render expected Earth map. Could you please fix it and re-upload the package?
    Not-working module might be a reason you not getting any ratings... just sayin...

    I was tempted to blog about it on blog.i-evaluation.com but since it doesn't seem to work as expected I can't really test it.
     
  11. Tasarran

    Tasarran

    Joined:
    Jan 20, 2011
    Posts:
    327
    It's really not my fault.

    The code requires the model to be as it is stored in the FBX, the vertex ordering is important.

    When the package is used on a Mac, the process of switching the platform cause the Import Settings for the mesh to be set back to default.
    Optimize Mesh and Mesh Compression both change the vertex ordering, and therefore must be turned off.

    If anyone knows of a way to fix this, I'd be happy to upload a new package; otherwise, it won't do any good...
     
  12. Zedwimer

    Zedwimer

    Joined:
    Feb 5, 2014
    Posts:
    1
    Tasarran,

    This sounds like just what I need for a project I'm working on. However, I need to be able to make globes with up to 196,832 hexes, and would like the option to make them up to 590,492 hexes. How hard would it be for you (or me) to tweak HexGlobe to allow for more hexes?
     
  13. Tasarran

    Tasarran

    Joined:
    Jan 20, 2011
    Posts:
    327
    Your first number is reachable as is, the 100K limit in the package isn't a hard ceiling.
    The second number could be reached if you didn't want to fractalize the result; but at that scale, I don't think that would be an issue.
    While I'm not sure the high number is reachable without some modifications, there are undoubtedly some optimizations that could be done to make this work more smoothly; there's no reason it couldn't work for you.
     
  14. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Nicely done, I can some people making games based on this.
     
  15. Evan-Greenwood

    Evan-Greenwood

    Joined:
    Aug 6, 2008
    Posts:
    98
    I bought this package...

    But it builds the mesh backwards (so that land masses are seas and all the normals are facing towards the centre of the earth).

    After a look through the code this doesn't really seem to have any of the underlying structures I'd expect for the base of a strategy game. What I mean is that the grid is purely visual here, the hexes don't know that each other exist, so building any kind of pathfinding on top of this means writing the grid code from scratch (or just about from scratch).

    I'll be looking for another way to build a hex-based sphere now.
     
  16. Tasarran

    Tasarran

    Joined:
    Jan 20, 2011
    Posts:
    327
    Evan, try reading up two posts of mine to fix the problem you're having.
     
  17. Dirtnap

    Dirtnap

    Joined:
    Apr 6, 2014
    Posts:
    2
    I also am suffering from the inverted map syndrome. I'm not using a mac? The instructions aren't a lot of help here. Shouldn't you have an example that works out of the box?
     
  18. Tasarran

    Tasarran

    Joined:
    Jan 20, 2011
    Posts:
    327
    I don't know why it doesn't work out of the box, I have downloaded it on my end, and it works fine.

    Did you turn off Optimize Mesh and Mesh Compression?
     
  19. anthonyk2

    anthonyk2

    Joined:
    Sep 18, 2012
    Posts:
    47
    hi !
    before buying the asset, I would like to know if there is a way to paint/color the hexes at runtime by code ? For example if you click on the europe I want it to turn red.

    thank you and best regards !
    Anthony
     
  20. Tasarran

    Tasarran

    Joined:
    Jan 20, 2011
    Posts:
    327
    Out of the box, no; but you could re-purpose the code that draws the textures.
     
  21. jimma

    jimma

    Joined:
    Apr 3, 2013
    Posts:
    28
    Hey,

    I was planning to use the HexGlobe for one of my projects. However I have a few questions on the HexGlobe.

    It would be great if you could answer my questions below regarding the HexGlobe

    1. How is the texture/ terrain on the globe generated? Do we have to make our own texture in Photoshop and just place it on the globe? Basically if I wanted to create different maps on my globe, do I just create normal textures with Photoshop and place it on the globe or how does it work?
    2. Is it possible to select each individual hexes. Say if I wanted to place an object inside a hex, would it be possible to select that hex and place the object on top of it?
     
  22. Tasarran

    Tasarran

    Joined:
    Jan 20, 2011
    Posts:
    327
    I used a map data system that gets the starting map data from a file I do in PhotoShop, but that's just another way of getting the data in, not the texture.
    The code has a function that can paint the map; it's what you see in the demo stuff. It's a little slow, and could be replaced with something better; even a simple flood fill if you want.
    You could also provide textures made by hand as well. You could let the code make the maps, then paint over them or touch them up in PhotoShop - there's lots of options as far as that goes.

    The way it works is there is a high-res mesh that you see, and a low-res mesh that has one vertex for the center of each hex. Only the low-res mesh has a collider. You can raycast into the collider, find the vertex nearest the hit, and look up the number of the hex, thereby getting access to all the terrain data for that hex.
    You can just get the location of that point, put or move objects to that point, making sure the models keep their 'up' vector facing away from the center of the globe.
    The pointer in the webplayer is doing this process live.
     
  23. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    Hello, I have been contemplating trying to make something utilizing a hex map on a sphere and, well, your package is obviously suited for the task. I was wondering about a few things:

    Firstly, what is the state of the package with regards to current functionality and Unity 5 compatibility? I saw some posts about potential additions such as tectonic and wind simulation for procedural generation; cool sounding stuff. Was any of that implemented or is it still planned? Also, I looked at HexTech, which has a lot of interesting features; any plans or possibility of integrating features from that package?

    I was a bit worried when I saw that the package hadn't been updated recently, but you've been maintaining activity on the forums, and I understand that this package is largely for your own professional work, which gives me hope for its continuing viability.

    It really does seem like a very well-thought-out, comprehensive, and impressive package; I am sorry it does not seem to have received the attention or accolades it deserves. Perhaps that is the fault of its highly niche and technical nature.
     
    Last edited: May 23, 2015