You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A good pathfinding system would unlock awesome AIs (#7) and more. Regarding the existing code, it could already be used to replace some code in the Zombie and Turret classes. Feel free to make suggestions.
Specifications draft
Interface
Add some methods to the Entity class, to be used by anyone needs them.
protected boolean isVisible(Entity e) Uses raytracing to check all tiles on its way to the target's position
protected void moveTo(Entity e) Uses Dijkstra/A* to compute the path to a target, then call Entity.move(double xa, double ya) accordingly
Caching
Both methods might be very resource-demanding if used on each tick ; under the hood they should cache the results of all paths, for instance by:
Storing a Map<Tile, List<Tile>> (the key being the target tile, and the value the path to the target)
Cleaning the map as soon as the Entity goes to another Tile.
This would cost some RAM but also have the huge advantage to be safe for extensive use.
The text was updated successfully, but these errors were encountered:
A good pathfinding system would unlock awesome AIs (#7) and more. Regarding the existing code, it could already be used to replace some code in the Zombie and Turret classes. Feel free to make suggestions.
Specifications draft
Interface
Add some methods to the Entity class, to be used by anyone needs them.
protected boolean isVisible(Entity e)
Uses raytracing to check all tiles on its way to the target's positionprotected void moveTo(Entity e)
Uses Dijkstra/A* to compute the path to a target, then callEntity.move(double xa, double ya)
accordinglyCaching
Both methods might be very resource-demanding if used on each tick ; under the hood they should cache the results of all paths, for instance by:
Map<Tile, List<Tile>>
(the key being the target tile, and the value the path to the target)This would cost some RAM but also have the huge advantage to be safe for extensive use.
The text was updated successfully, but these errors were encountered: