AI Updates

Discussion in 'Developer Depot' started by Scrambler, Jan 26, 2018.

Thread Status:
Not open for further replies.
  1. Scrambler

    Scrambler Developer Emeritus

    Likes Received:
    Trophy Points:
    I wanted to discuss some of the things that went into R50 from the AI side. I shy away from doing to postmortem video stuff, so I decided to do this quick write up here.

    1) For this release there's a lot less network traffic for npcs and players.

    We did a long of work optimizing network movement for npcs. Jason refactored a lot of the system that handles our network communication for both players and npcs. One major change was eliminating non-reliable network traffic for npcs that were simply too far away to notice (that's stuff like minor movement updates). Some of the other changes include us moving towards having some tech in place to load balance more of the AI logic across more machines. This could allow us to increase the number of npcs we can support in a scene concurrently.

    2) Movement - Npc attacks are now more in sync with player's location

    I finally got around to addressing how we handle player positioning for ai combat purposes (for remote players). The solution we had in place has been inadequate for a very long time. At the core - npcs were using buffered player positions for combat purposes due to the dead reckoning implementation. We buffer positions, rotation, velocities for smooth playback on the client.

    I've known forever this was going to need addressing, and it wasn't going to be a solution we could ship with. What made this particularly challenging is combat locations and physics (raycasting) for AI combat logic need to use unbuffered player positions data. The rest of the game - player interaction, player combat, and other systems need to use the buffered player data. The two systems would need to be isolated so they don't affect each other.

    So, we now use unbuffered player position and raycasting for players just for AI combat. This is super cool - and feels much more responsive

    3) Npc attacks should be more logic

    First, attack selection needed some logic to filter attacks that weren't going to be effective due to the current player position (player reachable - not just within range). We saw issues where a mob would choose a close melee attack, fail to get to the player, then choose another attack. Now mobs use a range filter first during selection and only choose from attacks that will be successful .

    Second, once that was addressed it was time to fix crazy melee attacks hitting players from crazy far distances. This is partially by design to prevent exploits, but is so far out of where it needed to be to work properly. So, I give npcs and ability to cancel their attacks if the player moves *too* far out of range right before the attack happens. I wanted to make sure this doesn't become an exploit... don't expect to step slightly out of range to guard against getting hit.

    4) Speed up npc reaction times

    I sped up the reaction times for npcs across the board, they're doing more work per frame than they used to, but will now react quickly to situations like changing targets.

    5) Aggro

    Last release I took a pass at cleaning up the aggro codebase. This release Bobby and Chris took a pass at the old decay logic and replaced the decay algorithm making it much better.

    6) Charge attacks / Gustball

    We added a charge attack to npcs. The boar will prefer to use his close range attack if the player is close, then switch to the charge if you get some distance. The charge is *fast* and getting the animation and logic in place was fun, I was able to borrow a bit from the player code to get this to work. Expect more charge attacks on other creatures.

    Charge attacks move the npc over time, smoothly. We found that the movement on the non-master client was poppy. Apparently ppl saw this with the gustball too. If you gusted the gustball on a local client it was smooth, but other ppl saw it pop from location to location. This has now been smoothed - and should look the same on all machines.

    7) Hover creatures / Wisps

    Flying creatures got a little cleanup this release too. Mostly behind the scenes stuff. Wisps will now fall to the ground when killed.
    Last edited: Jan 26, 2018
Thread Status:
Not open for further replies.