[Music] hi my name is tobias carlson and i'm an ai programmer at sony ben studio and today i'm going to talk about scored coordination in days gone will the focus on combat first of all what is days gone well those of you not familiar with the game day's gone is an open world game set in a post-apocalyptic world where a virus outbreak has turned the majority world's population into these rabbit creatures called freakers that just attack anyone on site as a natural consequence of this civilization has collapsed and the few survivors have fled the cities and fractured into various factions that are all hostile to each other in the game we follow dickinson john a veteran and a biker and his best friend booser as they're trying to survive this hostile world while at the same time deal with their emotional scars
this gun is currently available on the playstation 4 and playstation 5 platform as well as on the pc so we are mostly famous for our freakers or rather our hordes of freakers however this talk is not about our freakish instead it is about our human ai's and we got plenty of human ai's in our game and they end up fighting both each other and the player and the various freakers and wildlife so that means we will have groups of ai fighting together in combat and as with any human endeavor when a group of humans come together and try to achieve a shared goal they will strive to cooperate and coordinate their actions so if we want to make our ai look believable then our ai need to be able to cooperate effectively also it's much more difficult to fight
an enemy that is coordinated that attacks in unison rather than attacking piecemeal one by one so this is a much better way to improving our ai's difficulty than say increasing hit points or hit accuracy the thing is though coordination is hard and coordination is particularly hard in an open world game as anyone who has tried to write ai coordination is probably well aware of the thing is in our open world game our enemy can come from any direction at any time and we don't even know what kind of enemy might be coming so this makes it difficult if not impossible to script for any possible scenario and what we need to come up with is a more systemic approach which in our case means ai for group coordination and our solution we feel is a comparatively simple solution yet very
powerful which allowed us to solve all the problems that we came across we also think that it is a solution that should be easily transferable to many different kinds of games that face the same kind of problems so the things we need to solve is first of all the group needs to figure out a goal that the group is trying to achieve and then on a group level the group needs to exhibit a behavior that furthers that goal individual group members will be playing roles within that group behavior that will further these behavior and these roles need to be assigned to the right character or right group member at the right time we also need to deal with positioning both relative to the enemy relative to our friends within the squad and also appropriate for the role
and finally we also need to deal with timing so if we have a group member who is assigned to provide covering fire for an hour group member so that other group member can do his thing then that's no good if that group member jumps out of cover enters uh his gun and then dives back down to reload just in time for the other group member that he is covering for to be ready to actually make its move so for the rest of this talk i will use these blue circles to symbolize this chord whose defective i'm talking from and these red circles will be the enemies of our blue circles so when we started working on dayscon and the human hais in daysgon we started working on individual ais and their behaviors so we made sure that the ais could fire their guns and actually hit their
targets reload those guns when the rod ammo get around the level and get into cover when need be and this kind of looked good if we were spawned in a single ai in a level and fought that ai then i knew what to do and was it reasonably good opponent but as soon as we added more ais particularly if we had two groups of ais that were enemies of each other things didn't look as good anymore and the obvious reason for that was that we had no coordination so the biggest problem was combat was very difficult to read without coordination and what we would have would be that our two sides would intermingle with each other so we would just have a mix of enemies trying to attack each other and this was something that was exasperated by the relatively short distances that firefights in dayscon uh happen at uh firefights and days gone are very up uh close and
personal even with our longer range weapons and one thing that also happened here was that because descan is a cover shooter any ai that is in cover needs to have a cover that is valid and with valid we mean that cover provides cover against all enemies so if there's an enemy that's in a position that the current cover is not valid for well that ai will have to move and get to a new cover so what we would see is that when these the rai just got mixed up like this at least one of these ai's colors would invariably be invalidated and that would force that ai to move and as that ai moved well that air would invalidate at least another ai's cover and what we would end up with was these cascading cathode valley ledations where each ai would just get cover invalidated over and over again and the whole group would
just be milling around so obviously if you want to be in a firefight and be an affected combatant you want to be shooting at the enemy and when you're moving to a new cover you're not shooting at the enemy and even worse when you're moving you're not a cover so you get very exposed and our ais turn out to be very ineffective opponents when putting groups without coordination on top of that our combat kind of lack direction it was hard for us to tell whether uh what was going on like all the blue enemy attacking from the top are the red ones coming from the bottom left here uh if you weren't there for the beginning of that combat it was unclear what exactly they were fighting about on top of that our eyes weren't red in blue circles instead they kind of looked like this so
there were mostly in green grays and brown and there were an environment that was predominantly green gray and brown so instead of having this we had something more akin to this and it was impossible to just look at what was going on at a glance and see who was fighting who so the first thing we realized we needed to do was to separate the two sides and as soon as we did that it became very obvious where a work was going on here we see that the blues are on the left and the reds are on the right there might be environmental clues that will help us understand if the blues are defending or the reds are attacking or not and also when we turn our guys all back to green it's still fairly easy to distinguish the two sides from each other and on top of that this separated sides also give the player
more tactical options because now there's a front here between the two sides and each side has a flank or two flanks and a rear and that means if the player happens upon this obligation in the world and decides to support one side over the other the player can now attack his enemy in the rear or decide to shore up a weak flank and decide the player is supporting so we need to start organizing and in our games we organize our ais into something called squads which is just our name of our groups and all ai's are organized in a squad so when an ai spawns we create a school for that a y and put that air on that squad now obviously having a score with just one ai in isn't all that interesting there's not a whole lot of corporations gonna happen so what we do is that if
two squads get close to each other or so we have two members of the squads one from each wall that are within a certain distance well then these quotes will merge together and now there are one squad and they will operate and cooperate as one so for instance when we spawn ras they tend to be spawned next to each other so any ai on the same team will naturally merge into a single squad similarly if squads break up we also split up the scores into one two or more squads and this means that we don't need to figure out which ais are going to be cooperating which with other ais we know that because we have this automatic system two ais on the same team that are close enough to each other they will always cooperating and while two is as that are too far away from each other to effectively be cooperating will not
so squads in daysgon are full ai entities which means that they run our equivalent of a brain and run actual behaviors the squad's behaviors are primarily concerned with assigning roles to the individual squad members and examples of roles is providing cover fire being a grenadier or flank to enemy individual ai's responsibility disability squad is to perform those roles to the best of their ability so roles in days gone are self-contained behaviors that are added to pre-determined slots in the ai's behavior hierarchy this has a number of benefits first of all because the roles are self-contained that means that if we want to write a new role we don't need to touch any of the existing roles also because we put the role in the ai's
behavior hierarchy that means that there are roles that behaviors that ai has that are higher priority than the role so for instance if the aia is get attacked by a grenade the air has a behavior for trying to avoid that grenade and because that one will have a high priority that rules that means that no roles actually need to deal with the problem being attacked by a grenade also we have other behaviors that just have lower priority than the role and these roles will never these behaviors will never be performed as long as we have a valid role assigned to us we also need to understand the tactical situation and for that we have something called the frontline the front line defines the spatial relationship between the squad and its enemies and it consists of a directional combat
a width of the front a neutral area and an area controlled by the enemy so to calculate the directional convert we find the center gravity of our squad and this is simply just the average position of our squad members and then we find the center gravity of our enemies and the directional company the direction of combat is simply the direction between those two points next we have to figure out the width of the front and this is uh eager the width that the enemy is presenting to us so if the enemy is spread out well then our front line is going to be wide so that we can spread out and meet gently or a minimum with if the enemy is not that spread out which is defined as the width that the squad would have if it's lined up abreast along the front line with a specific distance between them each
other now we we do this to make sure that there's enough room behind the front line for a squad to be able to fight effectively because the sport is not allowed to move outside the width of the front line as for the neutral area the front line can be operated either in a close or a far mode in a closed mode the neutral area extends a fixed distance from the nearest enemy so this means that the neutral area will move with the enemy and the score is not allowed to enter the neutral area which means that if the enemy is pushing in on this chord while that will push to called backwards but if this chord moves so at the end he moves away from the score well then the uh squad can follow the enemy in far mode which is uh used a lot less frequently the neutral area extends all the way to the
closest chord number and we use this in special scenarios when we want the score to stay in place for instance if the score wants to is set to carb as particularly like object or a place or something like that and because the neutral area extends all the way to this cord it doesn't matter how far away the enemy moves the score is not allowed to enter the industrial area so it will stay in place and continue guarding with its guarding and the enemy control area is simply the area that contains the enemy plus a little bit of an additional depth behind and the reason we add this additional depth is that as we'll see later with flanking it's good to have a little bit of depth to the enemy control area because particularly if we were just fighting a single enemy the enemy control area would otherwise have nearly no depth on the other side of the front line that
space is divided into lanes and we have one lane for each squad member and each squad member is assigned a lane in such a way as to minimize overall movement and the reason we have the lanes is to ensure that all the squad members are appropriately spread out along the front line and don't get into each other's way and particularly they each have this line of fire so when a squad member is assigned a lane that squad member will attempt to perform its role inside that lane if at all possible now it's worth noting that lane assignment is not just a one-off because as the frontline moves around what is the optimal lane assignment can change particularly if the front line rotates this can change the optimal lane assignment quite drastically even with small rotations
but we also need some motivation for our squads and for that we have something we call confidence and confidence is a measure of how confident the ai is that it will win its current encounter so a confident ai thinks that it's likely on the winning side while an unconfident ai suspects it's betting on the wrong horse confidence is a major factor in decision making both for individual ais that have several behaviors that are fully or in part driven by confidence but also for the squad which in combat is almost exclusively driven by confidence squads to have do not have a confidence value of their own instead instead they use the average confidence of the squad members rounded towards neutral our confidence is not an analog value instead we use discrete levels and we do this because it's much easier for the
player to read distinct state changes rather than a subtle increase or decrease in the particular behavior our confidence levels are heroic which is super confident i don't think anything will touch it confident that i think it's on the winning side neutral we don't really know how things are going worried we're definitely not probably not winning this and panic which is i'm out of here so to calculate an ai's confidence we calculate the total strength of each side and when i say side i mean for the friendly side it's the squad members and any other friendly units that are fighting on the squad side and for the enemy side similarly all the perceived enemies that we are aware of and when we calculate the total strength what we do is we sum up all the individuals strength of each enemy or
each friendly that we found and then we take the quotient between the friendly and the enemy side and compare that to threshold values to get our actual confidence level so the way we calculate confidence or the strength of a single character is that we first get a starting strength and this starting strength is dependent on both the fraction of the character whose strength we're calculating but also the strength of the fraction of the character viewing this faction so we have something looking like this a matrix of how various factions view each other so for instance we have certain factions like our militia faction that everyone kind of agree that they are stronger than your average uh enemy and uh they are hence
well respected we also have something like our crazy uh celtic faction called the riples who think they are just superior to everyone and we all know those kind of people and hence they think that everybody else's starting strength is pretty low normally though most factions kind of agree on which faction is the stronger which one is the weaker but we can have situations where both factions think the other one is superior which will cause them both to have lower confidence and be more careful in combat or perhaps we could have two sides that think the other side is inferior which will make them more aggressive and more confident fighting each other so once we have the starting strength we modify the strength with various multipliers the most important multipliers is what kind of weapon the ai is carrying so for instance a machine gun is much
scarier than a pistol if the ai is armored or not the health of the ai and here again we have a distinct level so we only check if the ai is severely wounded or not and finally the confidence of the ai so a confident ai will lift up its chord's confidence while an unconfident ai will bring its score down and panic ai here has a specific uh effect and is a special case so if you're fighting enemy score and you see one of the squad members just freak out and run off we want that score to be close to breaking and in order to emphasize that we add panic ai strength not to the friendly side but to the enemy side we also add the strength of casualties so not just strength of the living to the total strength
and the reason we do that is if we have a squad that managed to deal out a disproportionate number of casualties to the enemies we want that squad to become extra confident and extra aggressive and likewise if your side is taking an unnecessarily or unreasonable number of casualties that will negatively affect your confidence casualties is something that i degrade over time and this is a time scale that is much longer than your typical combat encounter and the reason we do this is to make sure that if the player follows a squad for an extended period of time well that that score isn't permanently elated or permanently depressed for something that happened way back then maybe even before the player started following that squad so it turns out the confidence is a good predictor of outcome in our game a confident ai is very likely to be on the
winning side and unconfident ai is very likely to be losing and this is great this this is just a um uh like a receipt that what we're doing with confidence is what uh we want to it's working but when it comes to the player we want something more because we we want to use confidence in a way to encourage the player to play with a certain playstyle and the way this works is a confident area as we'll see will become more aggressive while unconfident becomes more passive so if we're noticing that the player is not really engaging with the ai instead trying to hide behind a cover for a way and take pot shots well then we start increasing the confidence of the ai and in order to make the ai more aggressive
and force the player to do something else well if the player is himself being aggressive and doing flanking and invalidating cover going to melee and just using all the tools available to the player well then we start decreasing the confidence of the ai well we which will make the a little bit less uh aggressive and this will give the player a better chance of pulling these behaviors off and hopefully make the player more likely to try this in the future so now that we have both the confidence to tell us how we're feeling about things and the frontline to tell us all about how things are looking for us where everyone are well it's really do we're ready to create some behaviors so in combat the squad can either be forming up and in normal combat retreating or pushing the attack
forming help happens when one or more squad members are out of position and this is either the squad member is too far forward so the squad member is in the neutral area or maybe enemy control area too far to the side so its cord member is outside the width of the front line or too far behind so the front squat member is outside its weapons affected range on this happen any squad member that's already in position will just hold that position and engage the enemy to try to keep the enemy occupied ais that are far away from the front line and the enemy will just run in a straight line towards the front line to try and get into position however if we are close enough to the enemy that that is not safe the ai will instead move from cover to cover until it makes it back to a good position
once everyone is there we are ready to go back to normal combat so during normal combat which happens when confidence is neutral we're focusing on the basics so we trying to maintain good spacing within the squad which is what the lanes are there for we make sure we have a clear direction of combat which is what the front line gives us and we also make sure that our sides are well separated which is what the neutral area is there to do and this creates a very good looking and interesting dynamic combat because as the uh scored and the enemy moves the front line will uh move and rotate with that and that will cause the squad uh to counter any enemy moves which uh look quite uh impressive when you look at it however if the as confidence is low the ai will go uh try to retreat and when
retreating the best direction to retreat in is obviously the away from the enemy and that happens to be the exact opposite of the direction of combat in the front line so when we're retreating we select half of the squads members to retreat and we prioritize those squad members that have no cover but otherwise we take those squad members that are the closest to the front line any ai that is not selected to retreat will provide cover fire for the retreating ais the retreating end only move a short distance back because when you're retreating you're at your most vulnerable because you have to turn your back on your enemy and then this behavior repeats and the interesting thing is that because the ai's that were closest to the front line now move back uh in the next uh iteration of the retreating the ais that we're providing covering fire will probably be the ones for trading while the ones that were treated
previously now provides copper fire so what we get is two groups of ais that are changing up between retreating and providing covering fire which creates a very nice looking leak frogging ava the score will continue to retreat until either it's blocked it managed to break contact with the enemy or forever for whatever reason it managed to regain its confidence if the score has high confidence on the other hand the ai will go on the defensive offensive and try to press the attack first thing there will do is try to move closer to the enemy and this is a behavior that is very similar to retreat behavior only it goes in reverse so the ads that are those for the front line are selected to move forward while the remaining ass will provide cover fire and we continue doing this until the score gets close enough to the enemy
at which point we will try to flank the enemy and flankers are picked among the squad members as those that are already in a good flanking position which means that they are either on the extreme left or right of the front line so when we're uh flanking the flanker will try and find a position in an area perpendicular to the enemy controlled area and this is where it really comes in handy to have a little bit more depth to the enemy control area and the reason for that is that the squad member has more opportunities to find a good position uh to attack from in here and also if you're a little bit behind enemy that makes for a better flanking position than if you're perfectly in align with them as some of you may have realized by now the quality of frontline is really key to our the quality of our behavior so if
our frontline is bad and so is our behavior particularly the front line determines if an ai's position and that is valid so repeated small changes in the front line can cause the ai's position to be invalidated over and over again obviously this causes the same kind of problem that we talked about before moving instead of shooting and also it makes the ai look very indecisive which generally speaking is uh does not make for a good looking ai so what we realized was that there were a number of things that caused the frontline to move when it didn't need to so we spent a fair bit of effort finding and addressing a lot of these one of the first things we realized was that certain ai archetypes just did not play very well with the front line the first such one was our snipers who as their name implies are snipers and
want to engage their enemy at extreme distances and they live in these little areas called sniper nests that they are not allowed to leave so if they would be part of a squad then because the the sniper can't move with this chord is called center gravity would be pulled towards the sniper all the time and the squad would not be able to properly move with this enemy and hence we just don't add snipers to us codes the other extreme we have some an archetype we call rushes and the brushes are armed with shotguns that have very short range or miller weapons so their tactics is to run straight apart up to the enemy and attack at really close distance obviously this means that they run straight through the neutral area well into the enemy controlled area and this would cause problems with our frontline calculations both for friendly
and enemy rushes and again we just ignore them and don't add them to the frontline calculation and the the squad doesn't need to deal with russia specifically anyway because we have high priority behaviors that will kick in if a russia get really close to an ai now days gone is as i mentioned a cover shooter which means that almost all our combat happens in or on cover and the way ai uses cover in descon is that we have something called a cover slot which gives the position where the ai is supposed to go in order to use the cover and it also has some additional information on the details of how to use that cover but when the ai gets to the cover slot its position doesn't stay right on top of the slot there's a number of behaviors and animations that causes the ai ai to move for instance our reload
animation has the ai take a step back away from its cover to make sure that its weapon doesn't intersect with the cover when it's playing the reload animation and uh even more extreme when attacking an enemy front cover particular high cover the ai may need to step out of that cover in order to get a clear line of sight to the envy and this movement can be as far as two meters so the ads moving around while in cover close below the jitter and the front line and what we realized was that it didn't really matter exactly well the ai was as long as it was using a color slot so what we ended up doing was using the the position of the as cover slot rather than the ai whenever the air was in cover and this had to settle on the front line quite a bit we also calculate the front line as a sliding window average so that means that its position and direction
is calculated as the average in a certain time window and this moves out the movement of the front line and leaves us with the general trend while removing a lot of noise but using the average overtime makes the ai kind of slow to react to big changes and so what we do is that if the change becomes significant then they are adopted at a higher rate than small changes and if the change is large enough well then we just take that new position and rotation and start working from there and this is to deal with situations where we might be fighting a small group of enemies over here and then a massive enemy force show up from the other side and we need to pivot to deal with them flankers are great that's one of the coolest behaviors the ai does in combat but they also cause a bit of problem
so if we were to have flankers and treat them as normal members of a squad during combat that would be an issue because as the flanker flags the center of gravity would have to move with the flanker and when the center of gravity moves that means that the front line moves and as you can see in this example when the front flank moves like this the flanker is no longer in a valid flanking position and even worse the two ais that stayed behind to support the flanker's flanking move are now out of position and this board would have to go back to forming up so fortunately for us identifying friendly flankers is easy that's just the people that the squad has told to be a flanker and who has started performing the flag enroll so we don't need to add them to the
center of gravity however if we do that that also comes with a bit of a problem so again if the flanker flanks and the flanker no longer contributes to the central gravity well the center of gravity is going to move again which will cause the front line to move and again the flanker's position is not invalid admittedly this is not quite as bad as the previous example but it's still not good so what we do is that a flying curve on the flank leaves a ghost behind in the front line now the ghost is just the position the flanker had before the tanker started flanking so whenever we now need to calculate the squad's position and center of gravity we use the ghost position rather than that of the flanker and this greatly stabilize the front line that ghost is removed if the front line moves far enough and this is because the
ghost cannot move it's just a position and the whole point of adding the ghost is to stabilize the front line when the flanker flanks and if the front line needs to move well then there's no point in trying to stabilize the front line because if it needs to move it should move the ghost is also removed if the flanker rejoins the uh front line that is no longer flanker or for the funker is no longer part of the squad for whatever reason enemy flankers are a lot more complicated and the reason for this is that our front line may not necessarily be the opposite of the enemies frontline so we may not have a mirror image front line first of all we might be fighting multiple enemies chords in which case their front lines will look very different from our frontline or the enemy might be
fighting r squad and another friendly squad so then in that case the enemy's frontline will be different and also there's nothing guaranteeing that there's only two sides involved in a particular encounter there may be three or more factions battling it out at the same time and finally the flanker or the potential fighter could be the player and the player doesn't have a squad that lets the player know whether the player is assigned a flanking role or not so the way we deal with enemy flankers and enemy center gravity calculation is a little bit more calculate complicated compared to the friendly ones so first we identify all clusters of enemies and this is just a simple clustering algorithm that runs on distances and once we have these clusters we find the largest such cluster
and then add any cluster that's within a given faction of the size of that largest cluster this allows us to calculate a tentative frontline and then we can add any cluster that is covered by that frontline to which then allows us to calculate the final frontline this may leave us with one or more clusters that not covered by the front line and these are our flankers so we we like flanking as i said but the technical tactically sound option for a squad that is being flanked is to try to do something about it you should really not just stay being flanked but that wouldn't be fun because that would mean that the flanking would pretty much just fail because the enemy would move every time so what we do is we let the anchor
flank us for a given amount of time so whenever we see a flanker then we give the flanker a time stop and as long as that timestamp hasn't expired we let the flanker be but as soon as it expires then the flying curve is put back on the center gravity calculation and with the rest of the enemies and this will cause the front line to move and that will cause uh in turn the score to move and deal with the flanker and if that flanker wants to continue flanking us well that flanker will have to make another flagging move now another thing we noticed was that the player that is able to move a lot more than a simple ai and part of that is that the ai doesn't have the weight for all its friends to be ready and in position to make a move like a icing scored but also the player
has this sprinting ability that makes the player the by far fastest human in the entire game and we would see the player running wide circles around the ai which was caused the ai2 perpetually having to re-arrange itself to meet the player's student position and we did a lot of work on trying to make the aib faster at repositioning but all the things that we did were simply just not enough there was not even close and what we eventually realized was that when the player is running fast like this the player has no chance of hitting anything with its gun but the ai on the other hand doesn't have a big problem hitting movement targets so what we do is that when we identify that the player is starting to move at a
very high speed the ai just waits for the player to settle down and the player will settle down sooner or later or rather sooner than later because the ai will start building accuracy on the player relatively quickly and the player will be forced to get into cover or closer to melee distance and when that happens that gives us a little bit of a pause that allows the ai to rearrange themselves and meet the player at the player's new position now so far the um front line that we use is only looking at the enemy's position relative to our own position but it doesn't have any environmental information and the thing is environmental information and environmental analysis is uh quite a lot of work and we're a bit lazy so we realized that we were very fortunate that we knew some people who had an intimate knowledge of the environment at
which the ai was going to operate in and that's our level designers so a level designers can provide context and identify features and defensive opportunities within our levels by adding a number of markups the most important ones of these are our defense zones um our home areas and our fortification zones defense zones are large areas in which the ai operates and you can kind of think of them as the ai's uh sort of territory each score is bond to its defense zone with a given strength and all but the strongest binding strength allows the ai to temporarily lead its defense zone and the reason why we want the ai to be able to leave the defense zone is that if you have arbitrary invisible lines in the world that has a tendency to create weird behavioral artifacts and on the team we call that the mime in a box problem
so the way we ensure that the ai doesn't just permanently want us off from the defense zone is that we use confidence so a confidence call is allowed to press the attack and go outside of its defense zone if the enemy moves outside the defense zone as the scored at least the defense zone start including a confidence penalty and as uh discord moves further out that squad's confidence will eventually drop to point of neutral which will force the score to stop and the score will then hold its position and eventually this chord's confidence will drop even further and will cause the squad to move back to its defensive once back in this defense zone the escort will slowly re recover its confidence and the reason why we
do this slowly rather than immediately recover the confidence is that if these cause real confidence was saying confident and we immediately gave back his full confidence when it came back in the defense zone the score would immediately leave again and we don't want that kind of flip-flopping behavior the home area can be used in conjunction with the defense zone or on its own and this is a much smaller area that marks up where the ai is anchored so this could be the ai's base or camp or maybe a resources guarding and when a squad is assigned to your home area a number of things happens first of all the school will always retreat towards its home area and once it reaches the home area it will never retweet any further so effectively it makes a loss stand inside its home area and when if an enemy managed to get in between
the squad and his home area the score gets really upset and is allowed to press its attack even in neutral so i said that the score always retreats to the home area but if we take two arbitrary points in the world representing two central gravities for a score our enemy and with the corresponding uh front line it's very unlikely that the retreat direction will be towards the home area so the way we deal with this is that we bias the uh is called center gravity towards the home area's position and the closer the score gets to the home area the stronger the home area's influence is until if the sport gets close enough the home area's positioned completely overrides that that is called center of gravity and regardless of how far away the squad is from the home area we ensure that the front line is never rotated 90 degrees
or more and that way always when the score retreats it will get closer to the home area so the score also needs to take advantage of strong points and show points and other good defensive opportunities and for that our level of design is place fortification zones a fortification zone consists of an area to fight from and a kill zone in which we're going to attack so the area to fight from is where we're defending from and the kill zone is where our enemy is coming and it's worth noting that the kill of summon is frustum because generally speaking if you're defending from position you will be defending in like a frustum in front of you and that the kill zone isn't necessarily attached to the area to fight from and for instance this is useful for if you're on a elevated position and
defending the ground below well then you want to kill someone down below proven up where your area to fight from is and also if you're in a fortification and your enemy managed to get right up to that fortification that probably means that your fortification is about to be overrun and you should have abandoned it a little bit earlier so the way the killson worked or the fortification zone worked is that normally it doesn't really do much for the ai but if the as target moves into the kill zone then the fortification zone becomes active and as soon as that happens the ai will move into the area to fight from and attack the enemy from there so the way this all comes together is if we look at this example ai stronghold so the a this is a good stronghold because it is surrounded by a bunch of natural obstacles
it has this nice little house in the middle that the ai can uh sleep in and be safe from the elements it has two entrances that the ai will have to guard against intrusion and of course since we're a cover fighter there's plenty of cover around first we place a defense zone and you can see that the defense zone is covering the entire stronghold and that is an irregular shape also the defense zone extends outside the entrances for a bit and this is to allow us to be able to engage someone who's just hiding around the corner we also had a home area and we put that in the house so this is what the uh the ai is really concerned about and this is what it feels safe and finally we identify a couple of good defensive opportunities and add some fortification zones there
so if an ai or an enemy were to attack from the south well first i would go in to the kill center of this fortification zone which would activate this fortification zone now most fortification zones have a limit to how many ais can be and find in that fortification zone and this is generally just based on the size of the area to fight foam so any ai that's assigned to a fortification zone that at the fortification zone can accommodate will immediately move to the area to fight from when the enemy comes in here remaining ais will be fighting as a squad using cover and the front line just like normal if the enemy manages to push through the kill zone well then the ai's assigned to the kill cell or fortification zone will uh leave that fortification zone because it's no longer valid and rejoin the rest of the squad and fight like normal
as the enemy pushes further in the score will be retreating towards the home area and if the enemy pushes the score all the way back the squad will get into that house and make a loss stand there now this solution worked really well for us but it's worth noting that the front line is inherently two-dimensional it works on a slope so you can pitch it and twist rotate it but you can't twist it or turn it so a worst case scenario would be fighting on a spiral staircase fortunately for us there are very few of those in our game we also have special behaviors for fighting in and around buildings and the reason for that is that frontline doesn't does quite a good job to describe what's important in a construct constrained space and where you want to be in those
scenarios it's much more important to look at openings between the different rooms that is windows and doors and for that we have special behaviors for fighting from room to room from inside a building against enemies that are outside and also if we're outside a building and try to find a way inside a building the frontline is also not really good at fighting animals and freakers it's primarily there for our human opponents that are uh ranged opponents but even when fighting uh the wildlife and the freakers the front line gives us a good start to organize and position our squad even if other high priority behaviors will take over when those enemies close into melee distance finally it's kind of interesting to note that the player sort of intuitively
respects the frontline the player may not know exactly where the neutral area is or what the width of the front line is but when the ai is well lined up along the front line it became comes obvious to the player that this is the area where the ai is in control and uh this is over here there i am so i should get too close if i'm in that range combat and the kind of fight like our ais in many ways and this is all i have on this topic uh i would like to thank the rest of the day scans ai team who contribute a lot of the behavior for our ai as well as to the people at penn studio who helped me prepare this presentation speaking of ben studio ben is a great place to live and band studio is a great place to work we're always looking for uh new talent
and uh you should check out us out at our homepage to see if there's something there for you so i will be in the live q a session after this talk finish streaming thank you all for watching and have a great rest of your gdc [Music] you
Auto-generated captions from YouTube — names and numbers may be misheard.
Distilling the key insights…
Game Developers Conference · 2026
Game Developers Conference · 2026
Game Developers Conference · 2022
Comments