OpenDungeons/OpenDungeons — pull request #130 by hwoarangmy (2014-09-09 18:08:25+00:00)
Title: Lava and water passability should be set independently

fixes #101

Patch content :
- Improved algorithm for A* (using diagonals) and removed cutCorners
- Improved creature behaviour (Now, they will decide what to do on idle mode only). I've not looked at the fighting behaviour yet.
- Speed can be set independently on ground/water/lava. The speed is used to compute the best way. If speed is set to 0, the corresponding tile is not passable.
- Fixed a bug where synchronisation was not very good between server and clients when creatures were moving. This resulted in creatures going through walls :)
- Added support for floodfilling (used by A* to find path) to work with ground/water/lava
- Added command console to force a creature to go somewhere in the map and another to display floodfill in logs

How to test :
2 new console commands :
logfloodfill
setdest

Test floodfill :
In TestSingleplayerSmallPassability.level :
logfloodfill
You should see the floodfill values in the logs.
The 1st value corresponds to the value for ground units (if tiles have different values, there is no way between them).
The 2d value is for creatures than can go on water + ground
The 3rd for creatures than can go on lava + ground
The 4th for creatures than can go on water + lava + ground
In this map, there is 1 tile (0;0) surrounded by diggable walls. If you dig them, floodfill should change (same value for this tile and the ones linked to it)

In TestSingleplayerSmallPassability.level, there are 2 creatures called Lava (PitDemon, can go on lava - very slow) and Water (slime, can go on water - faster on water than ground) :
setdest Lava 9 0
You can try to play with both creatures. Note that slime is faster on water than ground so it should consider going on water when faster. On the other hand, PitDemon is slow on lava and should try to avoid it when faster.