09-08-2014, 06:28 AM
(This post was last modified: 09-08-2014, 06:33 AM by LogicParrot.)
(09-08-2014, 06:21 AM)xoft Wrote: I don't think a query of "can be here" will cut it. You need something more advanced, and luckily, there is something that might work: Get a function CanMove, that gets the start and end pos, which must be exactly 1 block apart, and the entity dimensions, and return the bool result and the Y coord of the dest point.. That way you can make your A* algorithm without many changes and it will work even for doors and such. It still won't work for things like traversing a hole over a row of opened trapdoor's ledges, but hey, we'll even be better than vanilla because our zombies will walk around doors instead of trying to knock them down
A canmove function sounds a lot more costly than my proposed get_traversable, and since the path-finding function will be called so many times, performance is very important. Do you think a canmove offers any advantage in comparison to get_traversable?
Nevertheless, it might make my job easier
Btw, I intend to make the "is it legal over there" function fully separate from the A* algorithm, making it easily swappable later on. In fact, I plan to begin with a dumb "Is there a solid block with complete disregard to the bounding boxes?" and improve it later on.
(09-08-2014, 05:57 AM)SphinxC0re Wrote: Also we should give mobs a range in which they can profit from their pathfinding abilities. The range should also be changeable by commands or the API
Of course. But that would be on the mob-level and not the pathfinding level. e.g. A zombie's code:
If (Player_is_nearer_than_50_blocks) do_pathfinding(......);