Search Unity

group pathfinding system for RTS sea warfare?

Discussion in 'Navigation' started by Cake_Nachos, Jul 18, 2022.

  1. Cake_Nachos

    Cake_Nachos

    Joined:
    Dec 30, 2021
    Posts:
    1
    So with unity navmesh pathfinding I can order units to go to a position. This works fine for units such as soldiers or small vehicles, but what about ships (ships as in battleships, cruisers, aircraft carriers etc.)? The problem with ships is that they need to turn slowly, and they can't really cross each other's path in the same way a soldier could cross paths with another soldier.

    What I need to figure out is how to give each ship a specific location when I select multiple ships and click on a destination (or target). I don't know what would be the best layout of these positions. Perhaps I just have all the ships go towards a specific point and stop when they are a certain distance away, but I doubt that would be a good system to play with. I'm just looking for ideas and any other thoughts about how this would work, because as of now I'm stumped.
     
  2. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    Just an idea, but imagine you have a group of 10 ships selected. What if we click, we don't pick the exact position 10 times, but wrote a script that calculates 10 spots in a certain formation, and then move the individual ships to the individual spots. It won't solve overlapping movement, but the ships will end up in a formation. Perhaps we can also calculate a heading so we can all put their sterns into one direction once they have arrived.

    By moving those ships again, and using the same spot-making algorithm, the ships would neatly move next to one another. I recommend playing a few games that have group mechanics. A while ago Warhammer Total War was free on the Epic Gamestore. It has mechanics like this and it's worthwhile to see how other games do it, and where they cut corners.