I think the current AI is very crude and is split across way too many places. So it could use some polishing. And perhaps some helper functions like WalkToBlock(x, y, z) that would schedule the walk onto that block, if possible. Then it'd be really easy to modify AI behavior using plugins, too.
I'm already working on the very first step needed for a better AI, and that is "surrounding block scanning" - the mobs need to be able to query their nearest surroundings (4 blocks away, 16 blocks away etc) and see if they like something in there or for path-finding. For that they need the cBlockArea object that I'm writing right now, so that they don't spam the cWorld:GetBlock() function, which is very low-throughput (it needs to lock the chunk storage, find the correct chunk and only then query the block type). Using the cBlockArea they can make a snapshot of the surroundings and query that snapshot without locking or chunk-traversal. I think it'd be best if path-finding would get a rewrite to use this object, too.
Btw. mobs walk away when you hit them, but if they walk into a tree in that direction, they just stop and stand there, and the server console is spammed with warnings
I'm already working on the very first step needed for a better AI, and that is "surrounding block scanning" - the mobs need to be able to query their nearest surroundings (4 blocks away, 16 blocks away etc) and see if they like something in there or for path-finding. For that they need the cBlockArea object that I'm writing right now, so that they don't spam the cWorld:GetBlock() function, which is very low-throughput (it needs to lock the chunk storage, find the correct chunk and only then query the block type). Using the cBlockArea they can make a snapshot of the surroundings and query that snapshot without locking or chunk-traversal. I think it'd be best if path-finding would get a rewrite to use this object, too.
Btw. mobs walk away when you hit them, but if they walk into a tree in that direction, they just stop and stand there, and the server console is spammed with warnings