Work Completed:
Fixed most log jam issues with T'hals getting through doors
Scale how frequently paths are rechecked based on distance from target.
I started implementing the Progress Method that I talked about yesterday which didn't work at all... their behavior looked very strange. It did fix the problem but... yeah wasn't good. But as it turns out the problem was far simpler than I had though. I just played with how soon the agent grabs the next node. I moved it from .3 units to 0.75 units and everything just magically worked! I created that variable for a reason you would have thought I would have played with it before doing all that extra work! Oh well... it works now and that's what matters!
The T'hals behavior was still strange when they were close to the player. They were always moving to where the player had just been. Not where the player was at that moment. This is because path finding is expensive so I don't want to do it every frame. Instead I was checking once every couple of seconds. Which is plenty if they're far away... not good when they're close. I could have just reduced how long there was between rechecks but then we run into that expense issue again.
So instead I now dynamically scale how long there is between rechecks. If the agent is close to the target it checks every 0.5 seconds, if it is far from the target it checks every 20 seconds. This solution both resolves the game play issue and should reduce the total cost for having path finding since in a large level there could be many agents finding a path to various targets.
I've been sick so I haven't been feeling to great programming (spent much of the day playing Civ: Revolution) but fortunately this only took me about two hours. I think this puts me at the Minimum Viable Product. We'll see where things go from there!
Fixed most log jam issues with T'hals getting through doors
Scale how frequently paths are rechecked based on distance from target.
I started implementing the Progress Method that I talked about yesterday which didn't work at all... their behavior looked very strange. It did fix the problem but... yeah wasn't good. But as it turns out the problem was far simpler than I had though. I just played with how soon the agent grabs the next node. I moved it from .3 units to 0.75 units and everything just magically worked! I created that variable for a reason you would have thought I would have played with it before doing all that extra work! Oh well... it works now and that's what matters!
The T'hals behavior was still strange when they were close to the player. They were always moving to where the player had just been. Not where the player was at that moment. This is because path finding is expensive so I don't want to do it every frame. Instead I was checking once every couple of seconds. Which is plenty if they're far away... not good when they're close. I could have just reduced how long there was between rechecks but then we run into that expense issue again.
So instead I now dynamically scale how long there is between rechecks. If the agent is close to the target it checks every 0.5 seconds, if it is far from the target it checks every 20 seconds. This solution both resolves the game play issue and should reduce the total cost for having path finding since in a large level there could be many agents finding a path to various targets.
I've been sick so I haven't been feeling to great programming (spent much of the day playing Civ: Revolution) but fortunately this only took me about two hours. I think this puts me at the Minimum Viable Product. We'll see where things go from there!
See the T'hals not get stuck!