Making a unit take up multiple hex tiles

Hi everybody :slight_smile:

I’m currently working on a turn-based game using a honeycomb grid (hex tiles), and am aiming to have units of varying sizes. I already have the unit ‘squads’ working - four soldiers standing on one hex tile, and the normal sized units - which have a larger unit taking up a single hex tile. What I am aiming for is to have a much larger unit that takes up a cluster of hex tiles (7 tiles, centered on the middle tile).

Making the unit itself larger wouldn’t be an issue, the issue would ultimately be the pathfinding, and having the unit unable to move to a position where one of its ‘surrounding’ hexes is blocked. For example, a ramp that is 3 hexes wide would be valid for its pathfinding, but a ramp that is 1 hex wide wouldn’t be big enough to let it pass, so it would not even show up in the highlighted tiles when selected and showing it’s move range.

Can anybody give me some advice on this peculiar issue?

Thanks

This is most likely achievable with something like clearance-based pathfinding outlined here, but adapted for hexes. Simply put, you assign each hex a value that specifies the largest unit size that can exist on or pass through it, much as you might assign different terrain types like ocean or swamp. Then when it comes to pathfinding for a larger unit, you just ignore all the hexes that have a value less than the size of the selected unit.

You’d have to reassess the values for each hex after a unit has moved (assuming you do not allow units to pass through each other), but given your game is turn-based, this shouldn’t create too much of a performance impact.