For some research purpose I’ve build a small tanks game where you have 1 tank controlled by a player and one or more NPC tanks.
Now I want these NPC tanks to navigate through a field which they have no knowledge of. They can detect obstacles if they are in a certain range. If they detect those obstacles they should save them in a certain data construct that’s easy to query. So that they can take them in account when moving.
Now here is where I’m stuck : if my field would be a grid it would be quite easy for me, I would just save which tiles/nodes the obstacle is on.
But I haven’t really worked with a grid, my tanks just move forward a few pixels depending on their speed, so a tank can be located on any pixel combination, as well as the obstacles.
Now how would I handle this? Collision detection is out of scope.
Am I forced to use some kind of grid or waypoints ?
why not use a navigation mesh solution? seems like exactly what you’re looking for, a method for representing a domain for ai navigation with arbitrary polygonal obstacles.
github is down at the moment, but according to this website (which is worth checking out, it’s an interesting Java implementation), this project has a python navigation mesh implementation.
edit
Based on your comments below, I think that a hierarchical representation is actually closer to the answer you are looking for. This article links to a paper describing how to abstract the pixel-by-pixel grid (with arbitrary shaped obstacles) into a node-edge graph for increased speed in navigation calculations. By incorporating this type of hierarchical representation with a dynamic navigation algorithm such as d* (see this answer for an overview of dynamic navigation algorithms), you should be able to implement a solution to your problem.