Announcement

Collapse
No announcement yet.

Feedback: Allowing player to adjust Hex mesh height used as terrain.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Feedback: Allowing player to adjust Hex mesh height used as terrain.

    Hello fellow UE4 devs. I'm completely stuck on this and can't determine the best approach on how to tackle my situation.

    Problem
    I want the player to be able to select hex tiles and be able to raise/lower their faces to make ramps to the next level.
    The player can also select the whole tile and raise and lower it by 1 level. (200 unreal units for example).
    I have attached some pictures to help illustrate what I'm trying to achieve.


    Mesh Type?
    Am I supposed to use Procedural meshes? Skeletal meshes? I looked into RuntimeMeshComponent and it's a little over my head with the main dev apparently gone from support MIA.
    The current plan is to have a hex based tile world. I've looked into and am continuing to research into HISM. However I don't know know if I can even use static meshes here?

    Extra Info
    I was planning on using hundreds of these hexes if not thousands to make the playable world. Its top down and the player can build on the hex grid. The terrain is procedural.

    Thanks in advance to anyone willing to help. I've spent the last week or so reading about trying to edit meshes in runtime and while I feel like I learned a lot, I don't feel like I've made any progress on my actual problem.

    #2
    Well first of all, RuntimeMeshComponent is deprecated in favor of ProceduralMeshComponent I believe (someone correct me on this one I know one deprecated another but I am not quite sure which is which). But more importantly, using HISM might be impossible depending on if you want to be able to smoothly adjust the height of a tile, because all meshes in a HISM have to be identical. If it's just a few pre-defined presets then multiple HISM components is your answer but if not then you're SOL. In order for something like this to be performant though with the number of tiles you're talking about you would have to do something like "if not smooth-modified, use HISM, otherwise use a procedural mesh".

    TECHNICALLY you could use HISM for all cases and update the visible height smoothly via shader modifications (even that will be a bit convoluted to associate height modification to a given instance in the HISM) but you'd run into issues with collision that way.

    tl;dr - This is mighty big bite you've taken.

    Edit:

    I just saw the comments in your photos - it seems that each hex face will only have a handful of states depending on which vertices are lowered and raised. Given that what you want to do is have one HISM component for every possible state and when you modify a vertex you check which state you're now in, remove that instance from the previous-state HISM and add an instance at that transform to the next-state HISM.
    Last edited by DamirH; 12-29-2018, 08:55 PM.

    Comment


      #3
      Originally posted by DamirH View Post
      TECHNICALLY you could use HISM for all cases and update the visible height smoothly via shader modifications (even that will be a bit convoluted to associate height modification to a given instance in the HISM) but you'd run into issues with collision that way.

      tl;dr - This is mighty big bite you've taken.
      I'm trying right now to see if I can do some kind of interp between Static Meshes and just cut the old one out of the array and add in the new one. The collision data will be important because the units will be pathable.



      Originally posted by DamirH View Post
      I just saw the comments in your photos - it seems that each hex face will only have a handful of states depending on which vertices are lowered and raised. Given that what you want to do is have one HISM component for every possible state and when you modify a vertex you check which state you're now in, remove that instance from the previous-state HISM and add an instance at that transform to the next-state HISM.
      Thanks for your feedback! Yes I plan on only having a handful of states. Its either flat top with overall Height adjusted. (height 1, 2, 3, 4, 5) and Ramps as shown.

      Comment


        #4
        I'm currently looking at using world position offset to see if I can find a solution there.

        Comment


          #5
          Making some progress on the hex map generation side. Special thanks to DanielOrchard and his amazing hex grid plugin. Super efficient, great support and easy to use.

          Comment

          Working...
          X