Killing Floor 2

Killing Floor 2

161 ratings
Tamari's KF2 Survival Handbook - AI Pathing
By Tamari
A full, in-depth analysis on the AI of Killing Floor 2 and how to manipulate it and control it, showcasing tactics meant to dodge, confuse, and avoid Zeds.
   
Award
Favorite
Favorited
Unfavorite
Introduction
Topic:
AI Pathing

Category:
Tactics

Prerequisite Guides:
N/A

For player skill levels:
Advanced to Expert

View the entire Handbook here:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1633641281
Welcome to Tamari's KF2 Survival Handbook - a consolidated resource for tips, tricks, and tactics for Killing Floor 2 that aims to help you become a better player and learn a bit more about the game while you're at it.


This guide is focused on: AI Pathing

The concept of "AI Pathing" refers to the way Zeds move around the level in-game. As with all programmed AI, their decision making and actions are based around specific algorithms and formulas. Once you understand how these processes work in-depth, you can begin to manipulate them in your favor.

Understanding how the AI moves around the map in KF2 can help you a great deal in a variety of ways, such as by allowing you to predict movement patterns in order to cause an enemy to become stuck in an infinite cycle, or by completely causing the AI to whiff altogether, saving you some precious health points.

The tactics I intend to teach you in this guide are little known to most players, which is a surprise to me. Hopefully by reading this, you will be able to add what I believe to be a few very underestimated skills to your arsenal as a Horzine Zed slayer.

Read on!


How the AI Moves
The AI controlled Zeds move in two distinct ways:
  • By directly following a player when they are in line of sight (LOS)
  • By following the level's Path Node network when not in line of sight OR the "direct" path is obstructed or inaccessible somehow (by geometry, props, or other Zeds)

Consider the following diagram:

Figure 1 - Top down view of path node grid

The black lines are Walls and the orange squares are Path Nodes. Path Nodes are placed by the level designer and are used when the AI has no direct line of sight to a player, or if the path they intend to take is obstructed or inaccessible somehow.

The yellow arrow protruding from the Scrake is the direction he is facing, and the icon of Rae is the player (you).


Scenario 1: Player is in line of sight
In the following image, observe how the Scrake moves when Rae is in line of sight:


Figure 2 - AI Movement when in LOS


When a Zed has a direct line of sight with a player, they will opt to track them using the shortest and most direct path they possibly can, provided nothing is in the way. As you can see, the Scrake continually turns to face Rae as she moves away from him. In this scenario, Path Nodes are not used by the AI, and their movement will be more exact.


Scenario 2: Player is not in line of sight
In the following image, observe how the Scrake moves when Rae is NOT in line of sight:


Figure 3 - AI Movement when out of LOS


Here, the Scrake cannot directly see Rae, so he opts to follow the network of Path Nodes. When he does eventually round the corner, he can see her, and reverts back to the LOS following protocol.

There are a few important things to note about LOS:
  • Zeds know where all players are at any given time. Just because they can't see you directly doesn't mean that they don't know you're there.
  • The direction a Zed is facing does NOT dictate whether or not he has LOS, but rather his location. The yellow arrow in the diagrams above is simply so you can see how the Scrake is moving. However in reality, there are infinite "arrows" (known officially as ray casts) coming out of him in all directions. A Zed can be facing away (ie, following another player), yet still have line of sight on you (in this case he would just follow whoever he is focused on).
  • When a Zed loses sight of the player they're following, they will search for any subsequent targets in the immediate area, switching to follow the closest nearby target to them. Otherwise, they will pursue the player they lost sight of through the Path Node network (more on this in a later section).


Obstructions
Direct line of sight is not the only pre-requisite for a Zed to use the "direct follow" protocol. The path must also be clear of obstructions. Obstructions are any physical objects that get in the way of the intended path. Some examples are:
  • Doors
  • Props (trucks, barrels, cars, etc)
  • Map Geometry (Walls, etc)

The best way to visualize obstructions is to draw an imaginary straight line from the Zed to yourself. If the Zed were to move along that line directly at you, would the line pass through any objects? If the answer is yes, the path is obstructed.

For example, if you are on the other side of a car, the "direct line" drawn from the Scrake to you would pass directly through the car, which makes it an obstruction.

Note that the path can also be obstructed if the movement the Zed would have to take along the "direct" path would be illegal. A classic example of this is a raised platform connected to the ground level by stairs. If you are on the raised platform, and a Scrake is below you on ground level, then technically the Scrake CAN see you, but he cannot reach you by direct movement (Scrakes can't fly thankfully). In this scenario the path is also obstructed.

In order to get to the player, the AI will attempt to move past the obstruction either by circumventing it completely or vaulting over it (for example with railings) in order to maintain their line of sight path to the player. They will only do this if the movement would allow them a shorter path to the player and the movement is legal. Zeds will not climb up surfaces or walls to get to you, nor will they attempt to move over/past/around anything they cannot fit through or around.

If all else fails, the Zed will revert to using the Path Nodes to navigate to the player (unless another player is in LOS that is close to them).

In the case where another player is in LOS that is nearby, the Zed will switch to follow that player instead. This can be seen in the following diagram:

Figure 4 - AI behavior when losing sight

Here, the Scrake switches to follow Tanaka after Rae moves around the corner, since he is close by. If Tanaka were not around, the Scrake would have still continued to follow Rae using the Path Node network. This switch of attention is called an Aggro Swap.

As you will see in a later section, Aggro Swapping can be heavily abused.


Manipulating AI Movement
Now that you have a basic understanding of how the AI moves in KF2, you can begin to manipulate it to work in your favor. The following sections will focus on specific tactics you can utilize to do just that.

Keep in mind that it's never 100% guaranteed that any of these methods will work, simply due to the random nature of the game. With that said, I will still do my best to break them down as simply as possible and provide a reliable method for each.

There are two important skills you can learn to manipulate the AI in KF2. They are:
  • Corner Kiting
  • Looping


Tactic 1: Corner Kiting
Corner Kiting is a method used to force an attacking Zed to miss. It is extremely useful, as you can completely avoid taking damage if you can pull it off reliably. You can also use it to stall for time in certain situations such as:
  • When you're waiting for your syringe to recharge so you can heal.
  • When you're waiting for a friendly Medic to catch up to you.
  • When you're trying to reload.

Basically, it can protect you during moments where you're extremely vulnerable to taking damage and/or dying, which can help you stay alive on harder difficulties or during Last Man Standing scenarios.

It works on ANY Zed in the game, including Bosses, which can really save your life in some situations.


Advantages
+ Allows you to stall for time to finish critical actions such as reloading or healing
+ Great way to avoid taking damage
+ Allows for ample breathing room
+ Not particularly hard to master once you get used to it



How it works
Recall from earlier that Zeds have two navigation protocols:
  • 1. Follow the player directly if they can see them and the path is not obstructed
  • 2. Use Path Nodes to follow the player if they cannot see them or the path is blocked

Zeds in line of sight of a player normally opt to take the shortest and most direct path to that player, unless the path is blocked by something (see Figure 2 above if you forgot).

HOWEVER... this does not apply when a Zed is attempting to attack a player. In these cases, the Zed ALWAYS attempts to move directly at the player, even if the path is obstructed. Are you seeing the loophole yet?

When I say "..when a Zed is attempting to attack a player", I mean during the moment when a Zed is performing it's attack animation. These are situations like:
  • A Scrake lunging to attack you with his chainsaw
  • A Fleshpound jumping toward you to hit you with his grinders
  • Slashers, Crawlers, Rioters, and Alpha Clots jumping at you

Basically, any animation that causes a Zed to commit to moving a certain way besides walking or running qualifies. The only thing that doesn't qualify is a ranged attack, for example from a Husk or E.D.A.R., as these attacks cause them to remain stationary (E.D.A.R.s still lunge at you sometimes
if they get into melee range though).

The main idea with Corner Kiting is to get a Zed to commit to attacking... however cleverly, we want to move in such a way that when they attempt to follow us with the attack, they get caught on an object, missing entirely.

Below is a diagram of what happens when you attempt to move behind an object normally:

Figure 5 - Normal AI pathing around an object


You can see here that the AI switches to using the Path Nodes, and the Scrake simply walks around the wall, which as we discussed earlier is normal protocol.

However here is what it looks like when you force a Zed to commit to an attack and then run behind something:

Figure 6 - Effect of Corner Kiting on AI pathing


As you can see, the Scrake attempts to zero in on Rae but becomes stuck on the wall and misses, which allows her to gain a bit of distance.

Since Zeds can't perform any other actions while they've committed to an attack, they cannot switch to using Path Nodes even though you have now moved behind an object. This will cause them to try to take the shortest path to you, which is now straight into the object you've walked behind. As a result, the Zed will get stuck and you will earn a few moments of breathing room.

This works wonders against enraged Large Zeds like Fleshpounds, Quarter Pounds, Scrakes and Bosses.

Though the term is called "Corner" Kiting, it can be done with any object in the game that blocks movement and cannot be stepped up onto without having to jump, such as map props (vehicles, etc), map geometry (walls, doors, etc), and even other Zeds.

It won't work on short objects like stairs, short railings, or curbs that you can walk up onto because Zeds can still step up onto objects while attacking.

You also want to stick as close to the object as possible so that the distance you have to move to get around it is the minimum possible. Remember that you only have mere seconds to perform this manuever, so you have to do it as fast as possible.

In-game Examples
Here are some in-game examples of Corner Kiting in action:

https://youtu.be/4__nURtj_u4
You can see in this first example how the Scrake gets stuck on the truck because I turn the corner quickly enough that his "direct" path to me goes right through the truck itself. Notice how much free time I am buying myself here. This time could be used to shoot at the Scrake, heal, or reload!


https://youtu.be/gT5-7noN65g
This example showcases how you can also use just about any other object to perform this trick, like pillars. Notice how sometimes the Scrake seems to become "confused" and swings his chainsaw completely in the wrong direction. This is because he can't figure out whether or not to go around the left or the right side of the pillar. Small objects that you can dance around rapidly are great for confusing enemies!


Disadvantages
Now, onto the disadvantages of this method. The most prominent ones are:

- Small time window to perform, especially against faster Zeds
- Is not always effective. Sometimes Zeds can slip past the corner or object and still hit you
- It's easy to get stuck by either trying to turn the corner too fast or by getting trapped by a Zed that walks in front of you
- Requires close to zero distractions and relative isolation. Other Zeds and players can sometimes get in the way


One of the main disadvantages to Corner Kiting is the limited time window to perform it. With fast Zeds like Fleshpounds, you will only have a few moments to step around an object and avoid being hit. Furthermore, sometimes Fleshpounds and bosses will lunge very quickly at you with great enough speed and range that they actually clear the corner and still hit you. This makes dodging a bit more difficult for slower perks like Support and Demolitionist. Still though, these perks will benefit the most from this skill if performed properly for that very reason.

You're also very susceptible to being blocked when trying to corner kite, either by other players or by incoming Zeds (usually the latter), so make sure to only attempt to do this when you know it's clear, or if you have the firepower to keep your path clear in case the occasional random Zed does show up.

Overall, Corner Kiting is extremely useful and can save your life. Though you should not rely on it completely, it's still extremely helpful for increasing your survivability and overall longevity. Learn it, practice it, and master it, and you may just save some games!



Tactic 2: Looping
It's possible to move in such a way where a Zed becomes trapped in an infinite cycle. This is known as Looping.

Looping a Zed causes it to get stuck moving in a specific pattern over and over, essentially trapping it. This is done so that a Zed can't reach you, allowing you to safely retreat or attack. Like Corner Kiting, Looping works wonders on Large Zeds and sometimes Bosses by buying you time.


Advantages
+ Allows you to stall for time to finish critical actions such as reloading or healing
+ In some situations, can offer a great method of crowd control
+ Great way to avoid taking damage
+ Allows for ample breathing room, especially for slower perks
+ Great against slow enemies and certain Bosses



How it works
Looping works by abusing the fact that Zeds must use Path Nodes to navigate when you are either out of line of sight or in an area that they cannot get to by direct movement. Path Nodes cause AI to move very predictably and robotically, which allows you to set up movement patterns that keep them stuck in those states indefinitely.

The best way to achieve a loop is to quickly switch between two platforms that are disjointed, for example jumping over a gap between two sets of stairs. This causes the Zed to have to run all the way around and up the other side to get to you, after which you can just repeat the process.

You can also achieve a loop by moving "through" what would otherwise be an obstructed path for a Zed. A common example of this is jumping through a window that the Zed cannot fit through. As we know, Zeds can only directly follow you if they have LOS and there is nothing in the way. This will cause it to have to find another route since it can no longer follow you through the window. You can then simply run back to the window, let the Zed catch up to you, and repeat.

Here is a diagram that shows what this looks like:


Figure 7 - Simple Zed loop


There are a lot of places you can do simple Looping tactics like this, such as:
  • Disjointed platforms (platforms that have a gap between)
  • Windows that you can jump through
  • Near or around ledges with railings

The best places to loop are the ones where the Zed will have to take the longest path to get around the obstruction and reach you. Furthermore, the best spots have a reliable and efficient way to repeat the loop, to prevent the Zed from potentially catching up to you. When playing a slower perk such as Demolitionist or Support, the second point here is even more vital, so keep that in mind. However, it should be said that these perks also benefit from looping more if they can pull it off because it allows them breathing room that they usually don't have the luxury of (unlike faster perks such as Gunslinger or Berserker).


Bosses
As mentioned earlier, Looping can be used to control Bosses, which is one of it's greatest applications. However, it is only viable against certain bosses and in specific situations.

In general, looping is ineffective against the following bosses:
  • The Patriarch
  • Dr. Hans Volter
  • Abomination / Krampus
  • The Matriarch

The Patriarch and Hans can shoot you with rockets or bullets even though they are not in melee range, which makes looping them particularly dangerous. For these enemies, it's better to opt for other methods. Note that this makes looping ineffective against EDAR.s and Husks for the same reasons as well.

The Abomination / Krampus is a difficult boss to loop because he gradually pollutes the environment with Bloat Mines and Abomination Spawns, causing you to eventually have to move. This also applies to Hans because he spams gas and explosives, limiting the available space.

The one boss that IS very susceptible to looping is King Fleshpound. Though he does have a ranged attack (the chest laser), it's very easy to dodge and does not require you to hide behind anything. The only things you have to be careful for are the Quarter Pounds he spawns at certain intervals and his ground pound attack when he first starts raging.

When King Fleshpound gets angry, he will not use any of his other attacks until he finally de-rages. If you can loop him while he's angry, you can keep him that way indefinitely until you kill him!

In-game Examples
Now for a few examples. Keep in mind that the point of this guide is to showcase uncommon tactics and teach people a few good things about KF2, however I do not want to turn this into a "glitch guide", so I will only be showing a few of the most common and effective Looping spots I have found. The rest is up to you. Get creative!

If you understand the rules for AI Pathing behavior that I outlined in the first few sections, most of this should make sense.

Spot 1: Burning Paris - Theater Cafe
https://youtu.be/CWEPt9oqBGI

The window doesn't stop the Scrake from seeing me, so I am always in his LOS. However, it is an obstruction because he cannot fit through it. Therefore he is forced to use the Path Nodes to reach me, which force him to go all the way around the other side of the wall. By the time he makes it to me, I simply jump back through the window and force him to do it all over again.


Spot 2: Burning Paris - Lower Subway Exit
https://youtu.be/tR3HGH9LRcM

Notice how I am standing on the railings. When King Fleshpound reaches the top of the stairs, he tries to take a shortcut to get to me, which causes him to fall. Though he can see me from below, he can't directly get to me, so he must use the Path Nodes to reach me.


Two-Player Looping
Another way to execute a loop is to repeatedly perform an Aggro Swap between two separate players. Recall that once a Zed loses line of sight of the player it is following, it will attempt to find any other nearby players and follow them instead.

This can be abused by purposely letting a Zed follow you and then stepping behind an object, therefore out of line of sight. Meanwhile, a second player needs to be behind the Zed at about medium range, so that the Zed turns around and follows them after the first player steps out of line of sight. Once the Zed has switched it's attention to Player 2, Player 1 steps out and gets ready to take the aggro from P2 again. And so on..

Here's a diagram of what this looks like:

Figure 8 - Two Player Looping using Aggro Swapping


Looping through Aggro Swapping works well against Zeds/Bosses that have ranged attacks, such as the Patriarch. When the Patriarch stops to fire his rocket launcher or minigun, it gives the second player plenty of time to get behind him while the first player hides. After firing, the Patriarch will turn around and follow the second player.

Keep in mind that this method won't work very well in crowded areas. If there are other players nearby, the Zed may choose to focus on them rather than the intended loop target.


Disadvantages
- Heavily relies on quick movement to pull off
- Ineffective against Zeds that have ranged attacks or lingering attacks (like gas)
- Requires a lot of space to properly navigate
- Requires close to zero distractions/interruptions, making it only really viable in the late wave where there aren't as many enemies running around
- Requires near complete isolation. Nearby players can cause the Zed to switch targets, ruining the loop


The biggest pitfall of Looping is that you must not be interrupted while performing it. As you can see in the example clips I posted, you pretty much need to be in an isolated region while doing it, or you can get blocked or attacked. Also other players nearby can cause the loop to fail, as the Zed will target them instead of you.


Tamari's KF2 Servers


Tamari's KF2 is a KF2 community of over 800 Members that I operate alongside Forrest Mark X that aims to bring a modded experience to KF2 that enhances the game through quality-of-life features and changes, new gamemodes, and a chill and close-knit environment. We're a multi-continental KF2 community supporting the NA and EU regions, and now also Southeast Asia / Australia as well!

Our objective is primarily to introduce people to the Controlled Difficulty mod, but we have something fun for players of basically all skill levels and preferences.
We don't like drama and try our best to maintain a stress-free environment that feels more like a small gaming family than a group of friends playing games together.

These are not your typical modded servers. The mods in use aim to enhance the vanilla experience as opposed to drastically changing it. As such, you can expect to find features that remedy some of the more clunky aspects of vanilla KF2 gameplay as well as features that allow players to customize their experience(s). We also have lots of customized content that builds on the original game, such as 25 additional Prestige Levels (with unique badges), 187 custom Server Achievements, and custom gamemodes like Arms Race, True Endless, and ZED Wars.

Come hang out with us!
All types of players are welcome!
http://discord.gg/tamari
Conclusion
Art by littletino
Instagram: @rikavalentine39[www.instagram.com]

Show her some love!



















I hope this guide has helped you to learn a few new tricks to give you that edge out on the Killing Floor. If you have any questions, leave a comment below! I will be updating this from time to time as more things are discovered.

Please give this guide a thumbs up if you liked it so others can see it, and so I know to make more!




Be sure check out the rest of the Handbook, where you can learn a bunch of other odds and ends about KF2 to help you improve your gameplay:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1633641281


Thanks for reading!
- Tamari


20 Comments
shu 19 Apr, 2019 @ 1:17am 
well written +++++++
NouH 25 Mar, 2019 @ 12:16am 
Great guide.
BreadPirate 9 Feb, 2019 @ 9:36pm 
brilliant
Tamari  [author] 31 Jan, 2019 @ 7:04pm 
Just to add too, one of the greatest applications of these two tactics is Kiting, which I will make another full guide on at some point. My goal was to teach people a bit about how the game works from an internal standpoint, so that hopefully they can get creative and start coming up with interesting strategies besides camping every game..
Tamari  [author] 31 Jan, 2019 @ 6:49pm 
Hey thanks for the comment! To be completely honest, I can't be 100% for sure that the AI works this way since I don't have access to the source code, but the guide is written based on my observations over a significant chunk of playtime (nearing 2000 hours now). So I'm PRETTY sure its right ;)

Anyway, glad you liked the guide!
The Shadow 31 Jan, 2019 @ 6:06pm 
I was already cornerhugging without knowing how it works, but it's nice to know exactly how the AI pathing works in this game, it explains a lot about why zeds move and attack in odd ways sometimes. Looping is an interesting way of manipulating zeds, but limited since this is mostly a horde game outside of bosses, who outside of king fp (who is already the easiest boss in the game once you know what to do against him) have ranged attacks that make it mostly obsolete or useless. Also, looping is quite map dependant too from what i understood. Still an entertaining and informative AI pathing guide.
Cyberlisk 31 Jan, 2019 @ 10:55am 
Not related to pathing but important to survival : Make sure to jump just before a big zed is about to hit you , you'll get launched a fair distance away (depends on what attack the zed used) but it can be the difference between dieing and living sometimes.
Tamari  [author] 29 Jan, 2019 @ 10:07pm 
Thanks! Glad you found it helpful.
Ymirage 29 Jan, 2019 @ 8:10pm 
I knew a few of the tactics, but some very nice tips in here. Great guide man.
Sandman332/Docholiday332 29 Jan, 2019 @ 7:08pm 
Very nice in depth look at the Ai Pathing.