Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by nicolasfricke · Mar 31, 2015 at 10:50 AM · newbiemapbest practiceshexagon

Best practices for interactive hexagon map?

I am planning to build an open-world game building on hexagon maps. The player is supposed to start out with only seven visible hexes but can expand the field in any direction. Each hexagon is supposed to be able to change its appearance (i.e. texture and maybe even height). Also, the user is supposed to interact with the individual tiles (reacting to touch events / via Raycast method).

What are the best practices for this?

The two options I (as quite a Unity newbie) consider up to now are:

  1. Individual hexagon game objects (or hexagon prisms), spawned at runtime, or

  2. A procedurally generated plane with triangles to form a hexagon structure

While option 1) is arguably easier to implement (though, I manually need to place the hexagons) I am afraid I may run into performance problems once the map reaches a certain size. Sizes of well over 1000 tiles are to be expected. For option 2) I am not yet quite sure wether it is feasible to individually change the appearance of each triangle/hexagon on the plane and how the map can be expanded during gameplay (starting with 7 hexagons, growing in all directions).

Can someone point me to useful resources? And what's the best option in your opinion – or is there even a better way? I know there are quite a few frameworks in the asset store for Hex Grids – but I'd like to stick to free resources for now.

Thanks – and I'm glad for every hint!

Nicolas


Resources I found up to now:

  • Procedural Hexagon Grid Framework, 50$ on asset store: http://u3d.as/bn3

  • Primitive Plus, a free add-on in the asset store which, among others, adds Hexagon / Hexagon prism game objects: http://u3d.as/akb

  • A great youtube tutorial how to make procedural planes: https://www.youtube.com/watch?v=bpB4BApnKhM&list=PLbghT7MmckI4qGA0Wm_TZS8LVrqS47I9R

  • An awesome article about Hexagons: http://www.redblobgames.com/grids/hexagons/

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Cherno · Mar 31, 2015 at 11:32 AM

Definitely go with runtime mesh generation. Hex tiles are quite complicated because of the math involved for finding out if a point is inside one hex or the other. I wrote my own terrain hex engine for a BattleTech-like game and it drove me nearly insane! As for textures, traditional splat map shaders won't do you much good because they can only support up to five or six different textures max, not enough for a wide variety of terrain styles. I haven't been able to find a shader that copies the Unity Terrain shader with it's unlimited textures. So, you are left with creating submeshes and multiple materials for each chunk, possibly using vertex blending to get smooth borders between different textured tiles.

Here are some links I bookmarked for the project:

link text link text link text link text link text link text link text link text link text

These are from my project: alt text alt text alt text

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image nicolasfricke · Apr 07, 2015 at 02:31 PM 0
Share

Hi, thanks for your detailed and nicely illustrated answer. With runtime mesh generation you mean the approach number 1) where each hexagon is an individual mesh generated at runtime? Thank you again :)

avatar image Cherno · Apr 07, 2015 at 04:22 PM 0
Share

Each mesh is not an individual mesh. A mesh can have up to ~65k vertices, so the area is divided into chunks, each chunk being one gameobject and thus one mesh. That also means that each chunk is made of multiple hex tiles, with each one having at least six vertices.

I should also add that the mesh doesn't have to be generated at runtime; The neccessary functions can also be called in edit mode with an editor extension. This is something I only attempted in my latest project unrelated to hex tiles but related to mesh generation, of course.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Part of mesh is invisible in game window but it's normal in the editor window 1 Answer

Basics of procedural map generation 0 Answers

Interactive Hexagon Map Errors 0 Answers

Need a bit of help with some math in regards to hex nodes 1 Answer

Apply shader to terrain 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges