Maescool/Catacomb-Snatch — Issue #249: Set up clean pathfinding codebase
Author: mkalam-alami
Created: 2012-02-23 13:50:32+00:00
State: open
Labels: Feature, Refactoring

### 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> (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.