Open Dillsfawn opened 3 years ago
This is a rather complex swarm AI mechanism. A human can easily determine what is 'behind' and coordinate.
Alternate solution, the MineAI emits a pulse of force that flings nearby mobs without the mine AI tag behind it, to clear the path for itself?
That sounds like a simpler solution that could work. But it could cause problems if more than one minerAI is in the same area and they are constantly knocking each other away from the blocks they are trying to mine. Maybe prevent it from impacting other minerAI's and even add something to make sure minerAIs don't stand too close too each other? (Ive noticed multiple bigger mobs with minerAI will push each other away from the block they want to mine)
The 'trick' would be that the precondition to be 'shoved' would be it only does it the entities without the miner AI. The assumption would be that while miner A can block miner B, someone will be in front and able to mine.
The assumption would be that while miner A can block miner B, someone will be in front and able to mine.
Im less concerned about them blocking each other and more so concerned with them pushing each other. (I don't mean knockback, I mean when they walk close to each other bump each other) The current pathing tends to aggregate groups of them to the same point in the wall, and they shove each other back and forth trying to get to the same block they want to mine. This is less of a problem with mobs with 1 block wide collision, but larger mobs like wolves or bigger have issues. Maybe mobs with minerAI should be immune to this kind of pushing while mining? Like lock them into that position until the block is broken or something?
What about storing the current target blocks for miners somewhere + indicate the block that is closest to the player. Than when a new miner spawns, AI takes this closest block target to the player, applies a small offset if it's possible, and checks if this block is not already in current block targets. Do a 2-3 more tries if previous fails, otherwise put the AI to some "waiting" state, and when a miner finishes break his block target, for all miners with this "waiting" state the AI tries to pick a target again. Quite complicated and may be unstable in practice, but it can make miners create entries for the horde more efficiently.
Currently it is rather easy to get the mobs with the Miner AI bunched up behind mobs without Miner AI. This prevents or delays them from digging into player bases.
To solve this I suggest to give a 'formationPriority' value to mobs. Then adding functionality that tells mobs to stand behind other mobs with higher values in the event that they cannot path to the player. Adding functionality like this should help ensure Miner AI mobs are at the front while digging into player bases.