• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Damnwing0405
      I am looking for talents to form a team of making a strategy base action game. Talents I am currently looking for are : -
      (I) Unity programmer (mobile)
      (II) Game designer
      (III) 3d Artist
      (IV) SFX Artist
      The attachment is some game concept for the game. All the concept will be turn into 3d or card form. The game will be strategy game where the players can form their own team and control the units in the battle field real time to fight against each others.  If you are interested to know more details please pm me or send an email to damnwing0405@gmail.com

    • By bsudheer
      Leap Leap Leap! is a fast-paced, endless running game where you leap from rooftop to rooftop in a computer simulated world.

      This is a free run game and get excited by this fabulous computer simulated world of skyscrapers and surreal colors in parallax effect. On your way, collect cubes and revival points as many as you can to make a long run.

      Features of Leap Leap Leap:
      -Option of two themes: Black or White.
      -Simple one touch gameplay.
      -Attractive art.
      -Effective use of parallax.
      To Download the game:
      Playstore: https://play.google.com/store/apps/details?id=com.avakaigames.leap
      Appstore: https://itunes.apple.com/us/app/leap-leap-leap/id683764406?mt=8

    • By BillyGD

      Play Flick Football 3D @ https://gamejolt.com/games/flickfootball3d/326078
      Check out our Facebook page @ https://www.facebook.com/FlickFootball3D/
      Flick Football 3D is a turn based football game inspired by the table top classic 'Subbuteo'.
      The game is currently in very early Alpha development. There is still a lot to be done before the first proper release but I have decided to release this playable version to get as much feedback as possible.
      The only game mode currently available in this release is the 'Practice Mode' which gives you control of both teams. Either play against yourself to get used to how the game works or play against friends and family on the same computer!
      Planned Future Features Include:
      -Take control of your own custom team in the single player campaign.
      -Play in online leagues and tournaments against other players in the multiplayer mode.
      -Fully customisable stadiums to make you stand out from the rest of the players.
      -Improve your players stats and skills by playing matches and setting up training sessions.
      Flick Football 3D is available for Windows, Mac and Browser.
      Thank you for viewing my game, all feedback is greatly appreciated. I can be contacted at; BillyGDev@outlook.com
      'Flick Football 3D' is also the development name for the game and I haven't yet decided what the full release will be called, so if you have any ideas please drop me a message!
    • By drcrack
      It is a combination of fundamental RPG elements and challenging, session-based MOBA elements. Having features such as creating your unique build, customizing your outfit and preparing synergic team compositions with friends, players can brave dangerous adventures or merciless arena fights against deadly creatures and skilled players alike.

      This time with no grinding and no pay to win features.

      We're still looking for:
      1) 3D Character Artist
      2) 3D Environment Artist
      3) Animator
      4) Sound Designer
      5) VFX Artist

      Discord https://discord.gg/zXpY29V or drcrack#4575
    • By Francisco Tufr
      Hi everyone! I'm currently working on a series of books about 2D Shader Development.

      The idea is to synthesize a bunch of techniques that are specifically useful for 2D, even if they work on 3D as well.

      I released the first book last week. It's 4.99 on Amazon or free on the series website, https://www.2dshaders.com

      This is an independent initiative, I don't work for any publisher whatsoever. The contents of the books are the result of a 4-year span where I started teaching this in Argentina and USA, always making the workshop better. Now I'm expanding it to make more sense in book form.

      I'd love to hear your opinions on the idea and if you get the book let me know what you think.

      By the way, the examples are in Unity, but the concepts from the book should be easily transferable to any graphics api/engine.

      Hope you like it!
  • Advertisement
  • Advertisement
Sign in to follow this  

Unity Wrapping my head around a hex tile grid

This topic is 2036 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


Recently I've been implementing a hex tile grid system in the Unity3D engine to get some practice in both the engine and the concept, but I'm having some issues with how the structure of the grid should be. The grid will be used in a turn based strategy game, so I think in the logic of the code, the tile will hold onto the character (have a reference to the character object in the tile). Also when I think about how I would normally move a variable in a normal 2 dimensional array, I would go to the section of code that houses the array itself and move or change the variable from the grid "manager". I'm assuming this would work the same way in a hex grid. Then there's the issue of how a character is going to attack another character. What I was thinking was that the grid manager will move the character, and when it comes time to do some action to another character, the grid manager will check to see if an enemy or something is in that tile, and if it is, move to the code inside the character class, and provide, for example in an attack method, the reference to the target so the characters will interact with each other directly. In my mind this is the best way to separate the responsibilities of the grid and the characters on that grid.

Is this idea sound or is there a better way of doing things?

Share this post

Link to post
Share on other sites
There isn't much difference from a high level between a normal grid and hex grid. I think if you re-order your logic based around your characters vs the grid tiles you'll be better off. Logic flows more smoothly since the most important operations usually are character 2 characters.

So instead of a grid manager you would have a character manager which manages characters, which happen to live on a hex grid. The movement of course is dependent upon the character type and the grid itself. There will still be a grid manager but it will only be used to resolve character 2 grid interactions like finding paths or free locations around a character etc..

Good Luck!

Share this post

Link to post
Share on other sites
Code wise, does this mean characters will need to have a module in them that has a reference to the grid? So they can check to see movements and distances.

Share this post

Link to post
Share on other sites
My current game project, Goblinson Crusoe, is a hex-based game. The way I handle it, though, is that the underlying scene manager is just a basic rectangular grid, for simplicity. The hex system is just a layer that sits on top of it. In this layer, I can convert a World coordinate to a Hex coordinate, and vice versa (although, when converting from Hex to World, I just calculate the World coord of the hex center). Objects, then, don't need to track their current Hex coordinate, but can just call the hex layer to calculate it when needed. The hex layer also provides other operations such as listing all neighbors of a given hex, listing all hexes within a given radius of a hex coordinate, and so forth; pretty much any kind of hex operation.

Movement and animation are all done in world coordinates. Pathfinding is done on the hex grid. So when a character wants to move, the pathfinder will try to find a valid path on the hex grid between the character's hex tile and the destination tile. This path is generated and returned as a list of hex coordinates. Since the game is a turn-based RPG fixed to the hex grid, this set of hexes is simply converted to a set of world coords representing the centers of each tile, and the character is progressed along the vector path thus produced.

Since the underlying scene structure is a simple rectangular grid, there is nothing weird to worry about as far as trying to manage the scene as a hex grid. Objects don't belong to a given hex, but they are maintained in the spatial grid. Frustum culling using regular grid cells is quicker than trying to do it with hex-shaped cells. Hexes are an appropriate abstraction for the game board, but not necessarily appropriate for the scene structure, and you just compound your work by trying to force the issue.

Share this post

Link to post
Share on other sites
@TheAsterite depends on how complex the grid and game is. Some grids are nothing more than flat sheet, x,y coordinates will suffice, other grids are complex multi-level hex voxel with area of effects and custom logic executing on them etc.. depends on your game. For now just a simple 2d coordinate should be sufficient.

Share this post

Link to post
Share on other sites
So in a basic strategy rpg, the tiles need height, be impassable at times, and figure out range for the characters. Height will just be variables compared with the characters jump value. The 2 heights will be subtracted, and if it's withing +- the character's jump, the character can move there. For now that's what I'm going to start off with. JTippetts' approach seems to work best for what I need the grid to do. I'm not sure what you mean by a multi-level hex voxel with area of effects though. It seems that JTippetts' approach solves that issue too. The path-finding and range algorithms tied to the grid should be able to take care of attack ranges and area of effects. Edited by TheAsterite

Share this post

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

  • Advertisement