Hex Grid Movement in Unity 2021 P3 - Breadth first search

Поділитися
Вставка
  • Опубліковано 2 гру 2024

КОМЕНТАРІ • 28

  • @MindMachineTV
    @MindMachineTV 3 роки тому +3

    I just want to tell you. I have started making my game and thanks to you i know how to make some stuff work. greetings from Tijuana :3

  • @michalslusarski
    @michalslusarski 3 роки тому +5

    The most advanced unity tutorials! Very good quality and interesting topics!

  • @rappyrap2819
    @rappyrap2819 2 роки тому +2

    Thank you so much for this tutorial, I have been wanting to make a strategy game like panzer corps for a while but couldn't find any tutorials that worked well for me, this one is great so far though! After I finish this I intend to look at your civilization tutorials, they seem like they have lots of helpful info!

  • @jean-michel.houbre
    @jean-michel.houbre 2 роки тому +1

    I love this series !

  • @trell_7842
    @trell_7842 3 роки тому +2

    Ohh very helpfull,
    i am currently working on turn based game with hex grid)))))

  • @yogashima3
    @yogashima3 2 роки тому +3

    Many thanks on creating these video. I hope there will be more in the future. Curious if you can do hextile swap, like a forest tile transforming into a deforested area in real time.

    • @SunnyValleyStudio
      @SunnyValleyStudio  2 роки тому +2

      Thanks for the suggestion! Sure basically you need to ensure that the GameObject representing the HexTile has as a Child Object the forest model. All you need to do is to swap it / remove it using *Destroy()* and *Instantiate()* methods.
      Thanks for watching!

    • @yogashima3
      @yogashima3 2 роки тому +1

      @@SunnyValleyStudio interesting and thank you. Your knowledge of unity is amazing to say the least

  • @spaceduckstudio8623
    @spaceduckstudio8623 2 роки тому +1

    At 4:00 shouldn't be 20 >= the cost instead

    • @SunnyValleyStudio
      @SunnyValleyStudio  2 роки тому

      I don't recall the code but that is the idea. I don't think that the end result would work without the condition being correct in the tutorial but let me know how it ended up!

  • @shaneboone
    @shaneboone 2 роки тому +1

    Thanks for this great series of videos. How would you go about expanding this system to work with a 3D hex grid where a character could climb up or down hexes as well as traverse across them? Do you know of any asset/code available that would handle this?

    • @SunnyValleyStudio
      @SunnyValleyStudio  2 роки тому

      It should be fairly easy. I would just introduce a check to A* (if you want to include the extra cost for this type of movement) and to the movement itself "Is the next hex on the same height as me?". In case of A* you just add some extra cost if the next hex is higher. During the movement you could add the check that when you want to start moving to the next hex and it is higher make the character play some climb animation when moving. In case it is moving down play the jump-down animation + move the character.
      I hope it helps!

  • @raimuyo
    @raimuyo 3 роки тому +3

    Would this be possible to implement somehow while using Unity Tilemaps for the map?

    • @SunnyValleyStudio
      @SunnyValleyStudio  3 роки тому +1

      Hey! Sure! I will be showing it soon in my Make Civilization tutorial series :)
      All you need is to create a grid out of the tiles on your tilemap. Ex make a "walkable" tilemap where all the tiles are meant to be walkable and you can use CellToWorld and WorldToCell methods from the Tilemap class to get the positions for your grid.

  • @chezzer57
    @chezzer57 Рік тому +1

    In the SelectionManager I had to add GraphSearch. to the front of the line BFSResult bfsResult = GraphSearch.BFSGetRange(hexGrid, selectedHex.HexCoords, 20); so ie :- GraphSearch.BFSResult bfsResult = GraphSearch.BFSGetRange(hexGrid, selectedHex.HexCoords, 20);

    • @chezzer57
      @chezzer57 Рік тому +1

      Ahah nevermind I needed to move BFSResult struct outside of the public class Graphsearch

    • @SunnyValleyStudio
      @SunnyValleyStudio  Рік тому +1

      I am glad that you were able to fix it.

  • @lnf928
    @lnf928 2 роки тому +1

    Is there any reason to use BFS instead of A*?

    • @SunnyValleyStudio
      @SunnyValleyStudio  2 роки тому +1

      Hey!
      I just think about A* as a solution to "find me a shortest path" while BFS as " visit all the nodes that meets a condition and return me the result". I'm pretty sure that A* goes only in the direction of the destination so I'm not sure how you would make it go in any direction without removing the "move to Destination" part (I mean to get the movement range). I can be wrong ;)

  • @Morax
    @Morax 2 роки тому

    How would you build a level editor for a hex grid?

    • @SunnyValleyStudio
      @SunnyValleyStudio  2 роки тому

      If you mean an ion-game level editor you would approach it the same way that you would make any grid related building mechanic. I have this City Builder tutorial that should give you some idea about it ua-cam.com/video/8ayFCDbfIIM/v-deo.html . All you would need is a save and load system to persist the levels that you create.

    • @Morax
      @Morax 2 роки тому

      @@SunnyValleyStudio ​ Thanks! Going to watch it now. Your videos are very helpful btw, great work!

  • @zeggxr1539
    @zeggxr1539 2 роки тому

    Graph search part little bit gone far