Getting the tank to move through a maze shouldn’t be all that complicated. We have done pathfinding before, so the only new aspect is the actual process of navigating between points using the track system. This should be as simple as setting up a function to turn towards the point and then drive straight, so I don’t believe this will be an issue.
The first step is to make the tank drive to a point without pathfinding. I will do this by making the tank run one track slower in order to turn in that direction, towards aiming in the direction of the target. Once it is facing close enough to the target, it will run both tracks at full speed to drive straight. When it gets to the point it will stop.
The next step is to add pathfinding. I will use a flow field algorithm, because it is simple enough to implement and allows the most flexibility in moving towards the target. If a tank strays off the path for any reason, it can still use the same flow field to make it to the target without generating a new path. This won’t help much for the task of navigating a maze, because there won’t be any evasive or tactical measures necessary, but flow fields aren’t really any less efficient at solving mazes anyway. It will actually be more efficient than most other strategies if we have multiple tanks with the same target.
The last piece I want to add is path smoothing. I haven’t done it before, but it would help a lot to make the paths more direct and less grid based. It also allows things like slowing down around turns without much extra work. This will help with speed too by enabling the tanks to follow shorter paths with less turns.
This all together should enable the tanks to navigate a maze and reach the exit as quickly as possible, or at least fast enough. The biggest issue is hitting walls, because travelling by points is a little inconsistent with the big delay between inputs, and it’s hard to avoid walls along a narrow path without moving unnecessarily slow. I might add some obstacle avoidance to avoid walls if the tank gets too close.