The Forest

The Forest

View Stats:
The Forest > General Discussions > Topic Details
TemplarGFX Jun 7, 2014 @ 10:26pm
Delving into the AI and other code
*********These are functions,scripts and controllers - they may be unused code, or overridden elsewhere*************

So I have been looking into the code of the AI in The Forest and found some interesting things. This is all my own speculation and should not be in any way considered concrete


AI
The AI definitely head to the plane crash site and continue to do so for a random number of days. (fsmFindPlaneCrash, fsmDaysToSearchPlane)

At the moment the AI seem to be able to do the following actions :
fsmAttack, fsmStepLeft, fsmStepRight, fsmScream, fsmTreeAttack, fsmTreeClimb, fsmBackAway, fsmDisengage, fsmAwayReturn, fsmAwayScream, fsmAwayFlank, fsmAwayToRock, fsmAwayToBurn, fsmRunAwayDist

AI seem to have 3 Modes: Run, Stalk, Search

AI seem to have 4 States: Aggressive, Default, Defensive and Cave

Killing a female will put AI in Aggressive state and increase the maximum number of attackers allowed.
Killing a cave dwelling female will cause AI to flee

There is special combat and behavior mechanic overrides for the plane crash site. To make it easier if you are attacked at the plane. Could be exploited by building near the plane.

There is evidence that the AI can find your location unfairly, with the function fsmFindPointNearPlayer, but could also be used to randomize flanking or other similar movements like sneaking up on you. However the function fsmFindRandomPoint seems to indicate it is for patrol destination.

looking at the search code, there is reference to a list of recently built structures, indicating it is the buildings themselves, and not the chopped trees that attracts them to your base.
EDIT - Actually I found a function in the follower AI sendTreeDownEvent, so they do react to cut trees

Males have a slightly randomized movement speed, females are much quicker

The amount of damage taken seems to effect the individual units AI state

There seem to the be following types of mutants : Armsy, Default, InCave, Fireman, Follower, Leader, Pale, Vags

AI seem to be able communicate to family members : sendTargetSpotted, sendFleeArea, sendAggressiveCombat

Attacking an AI can cause the family members to : switchToFleeArea, switchToFreakout, switchToGuardFriend, switchToTargetSpotted

There is evidence of code for the AI search and find other groups or individual AI units


I am sure this is temporary, but at the moment, the following seems to be hard coded

Day 1 - Min Aggression, Max Fear, very little roaming during the day
Day 2 - Little bit more aggression, slightly less Fear, significant increase in roaming distance
Day 3 - IDIOTIC aggression level, tiny amount of fear, double roaming distance again

Seems at the moment after 3 days the mutants are hell bent on killing you all the time.

Effigies placed by cannibals are referred to as Art

There is code to suggest that cannibals or mutants become fearless in the dark.

Sound reactions : PlayerNoiseDetected, PlayerNoiseStop

AI have a 200 degree field of view

Mud decreases your visibility by 40m

Inventory
A list of stackable inventory items :
LizardSkins,Sodas,ThrowFlares,BombTimed,Molotovs,Flares,ChocolateBars, Cassettes,Legs,Arms,Heads,Meds,Booze, Batteries,Coneflower,AloeVera,Thistle,Fish, Cloth,CBoards,Notes,Coins,Seeds, Feathers,Teeth,Leaves,Ropes,Rocks,Sticks

Single Inventory Items :
Book,PlaneAxe,Spear,StickUpgrade,Axe,RustyAxe,AxeCrafted,FlareGun,Lighter,PlasticTorch

Other Items :
TornMetal
CassettePlayer

Looks like Cassette Player + Cassette + Batteries allows you to play music. Although I cannot find reference to crafting this, or the Player being in the world

It takes 25 seconds to cook something, and 60 seconds to burn it


Berry : 1 Health, 4 Energy, +2% Fullness
Choc Bar : 20 Health, 80 Energy, +20% Fullness
Fish : 20 Health, 80 Energy, +80% Fullness
Rabbit : 20 Health, 80 Energy, +90% Fullness
Aman Mushroom : 0 Health, 1 Energy, +2% Fullness, Poison (once off -2 Health)
Chant Mushroom : 5 Health, 4 Energy, +2% Fullness
Deer Mushroom : 4 Health, 3 Energy, +2% Fullness
Jack Mushroom : 3 Health, 3 Energy, +2% Fullness
LibertyCap Mushroom : 5 Health, 4 Energy, +2% Fullness
Puff Mushroom : 2 Health, 2 Energy, +2% Fullness
Plane Food : 5 Heatlh, 30 Energy, +45% Fullness
TwinBerry : 0 Health, 0 Energy, 2% Fullness, Causes pain (player makes noise)
Can of Drink : 0 Health, 80 Energy, Suppresses Hunger messages
Alcohol : 0 Health, 80 Energy


There is code for getting bitten by a spider

There is evidence you can get knocked out / pass out
Last edited by TemplarGFX; Jun 9, 2014 @ 4:36am
< >
Showing 1-15 of 209 comments
ChalkHYPE Jun 7, 2014 @ 10:51pm 
Very interesting... I'd much rather read about this than the nudity ;)
McAwesome Jun 7, 2014 @ 11:30pm 
This is awesome stuff. Finally it shines a bit more light on the reasoning behind what the mutants are doing. I'm not liking the idea of the AI being able to unfairly find the player... really takes a lot away from the game in terms of laying low and keeping quiet.

Thank you very much for taking the time to go through the code and get this info out there. Greatly appreciated!
Aerofluff Jun 7, 2014 @ 11:41pm 
Yeah, I knew there had to be something akin to fsmFindPointNearPlayer. No matter what I've tried (stealth, or outright killing all the patrols and moving so that they can't possibly "report back" on my location), they always magically find me and then constant patrol bombarding. Combine that with the fact that they go crazy aggressive by day 3, and it pretty much means that you'd better be done with a basic base by day 3 or they are guaranteed to find you and attack in large numbers frequently.

Originally posted by TemplarGFX:
Killing a female will put AI in Aggressive state and increase the maximum number of attackers allowed.
I'm a little confused about this part and what players should do about it. The females are the most aggressive ones so chances of having to kill one are pretty high, but if you do, you're just screwing yourself over by letting them spawn more cannibals. :|
But if you had to fight and kill the dudes (especially if you want effigies), and don't kill the female, she'll live to tell others where you were spotted. It's a no-win situation.
TemplarGFX Jun 7, 2014 @ 11:44pm 
It seems that when they go to sleep and wake back up, things like aggression and attack numbers are reset according to (hopefully temporarily) the number of days past.

There is nothing you can do really right now. Other than attempting to kill the others so the female flees
Last edited by TemplarGFX; Jun 7, 2014 @ 11:44pm
TheNonMan Jun 7, 2014 @ 11:48pm 
There is evidence that the AI can find your location unfairly, with the function fsmFindPointNearPlayer, but could also be used to randomize flanking or other similar movements like sneaking up on you. However the function fsmFindRandomPoint seems to indicate it is for patrol destination.

Could also be choosing a spawn point for a patrol, which would be disappointing. I was hoping patrol locations would move around the map in real-time and spawn once you got in range, and not randomly appear. However it might explain why some mutant patrols appear to charge out of the ocean sometimes...
Last edited by TheNonMan; Jun 7, 2014 @ 11:49pm
turkeybrah Jun 7, 2014 @ 11:48pm 
I like that they call the cave mutants 'Armsy' and 'Vags'.

Also, is there any indication that all of these functions are currently enabled? For example, I've chopped down tons of trees with cannibals within earshot and they seem completely oblivious.
uaf_omega Jun 7, 2014 @ 11:49pm 
Originally posted by TemplarGFX:

Day 1 - Min Aggression, Max Fear, very little roaming during the day
Day 2 - Little bit more aggression, slightly less Fear, significant increase in roaming distance
Day 3 - IDIOTIC aggression level, tiny amount of fear, double roaming distance again

Seems at the moment after 3 days the mutants are hell bent on killing you all the time.

I'm not liking that, I was hoping the fear values would be variable through action, like number of cannys killed and effigy proximity. Maybe even wearing effigy trinkets as a temprary ward. Maybe even them avoiding your buildies until they mass attack with several patrols or something.

Thats a lot of hoping. lol
turkeybrah Jun 7, 2014 @ 11:50pm 
Skunkie has said that they have lots of big plans regarding the AI.
johncage Jun 7, 2014 @ 11:51pm 
very good.

*cue romomo frantically jotting down notes*
TemplarGFX Jun 7, 2014 @ 11:51pm 
You don't have to hope too much. Its obvious that most of this is just placeholder stuff and "first try" type setups. You can tell it has alot of work left by how its split up into controllers that do seemingly little individually.
TheNonMan Jun 7, 2014 @ 11:52pm 
Originally posted by uaf_omega:
Originally posted by TemplarGFX:

Day 1 - Min Aggression, Max Fear, very little roaming during the day
Day 2 - Little bit more aggression, slightly less Fear, significant increase in roaming distance
Day 3 - IDIOTIC aggression level, tiny amount of fear, double roaming distance again

Seems at the moment after 3 days the mutants are hell bent on killing you all the time.

I'm not liking that, I was hoping the fear values would be variable through action, like number of cannys killed and effigy proximity. Maybe even wearing effigy trinkets as a temprary ward. Maybe even them avoiding your buildies until they mass attack with several patrols or something.

Thats a lot of hoping. lol

Same. Hopefully these are just temporary staples and not the formula the devs will be sticking with in the long run, if this code is actually in use.
nicke85 Jun 7, 2014 @ 11:55pm 
Please do more of this.
TemplarGFX Jun 7, 2014 @ 11:58pm 
I added a disclaimer at the top

Some or all of this may not be used in game (although i highly HIGHLY doubt it). It is much more appropriate to assume that it is what they refer to as "place-holder" code. Simple bits of code that enable larger more complex functions to run. They will be replaced later in development
Last edited by TemplarGFX; Jun 7, 2014 @ 11:58pm
Hannibal Jun 8, 2014 @ 12:00am 
Yes, the AI is actually pretty impressive and if they improve it will be very exciting to see interactions between themselves and the players.

If they encounter burning player effigies and a well lit camp they seem to be far more reluctant to engauge in combat instead "false charging" in and then retreating back to the group. Which usually consists of 1 male 1 female and 1 leader or Lt. as i call them wearing lit skulls on there back and easily spotted from there "flashlight" like glow. But if they have bigger numbers (6-9 tribals) the fire/effigies doesnt bother them and they begin to surround the camp waiting for me to turn my back on them. They will also charge you if you begin hitting a female, most of the time if im beating on a female they all charge in to make me back off. Yet ive killed males 1 on 1 while they watch from the shadows. Killing the Lt. seems to make them retreat and they usually come back with help. I had a male and female pair run off screaming (for help i assume) when i killed there Lt. 1 on 1 when we walked into my camp. They also seem to wait for you to engauge one of the males, like a pawn, before they close in and flank.

Ive also been stalked from the trees. I kept hearing branches breaking. I looked around and saw nothing. Again, a branch breaks. Then i finally look up and a group of 3 were following me from the beach to my camp in the trees. Pretty creepy.
Last edited by Hannibal; Jun 8, 2014 @ 12:02am
uaf_omega Jun 8, 2014 @ 12:13am 
Originally posted by Hannibal Lamb®:
Yes, the AI is actually pretty impressive and if they improve it will be very exciting to see interactions between themselves and the players.

If they encounter burning player effigies and a well lit camp they seem to be far more reluctant to engauge in combat instead "false charging" in and then retreating back to the group. Which usually consists of 1 male 1 female and 1 leader or Lt. as i call them wearing lit skulls on there back and easily spotted from there "flashlight" like glow. But if they have bigger numbers (6-9 tribals) the fire/effigies doesnt bother them and they begin to surround the camp waiting for me to turn my back on them. They will also charge you if you begin hitting a female, most of the time if im beating on a female they all charge in to make me back off. Yet ive killed males 1 on 1 while they watch from the shadows. Killing the Lt. seems to make them retreat and they usually come back with help. I had a male and female pair run off screaming (for help i assume) when i killed there Lt. 1 on 1 when we walked into my camp. They also seem to wait for you to engauge one of the males, like a pawn, before they close in and flank.

Ive also been stalked from the trees. I kept hearing branches breaking. I looked around and saw nothing. Again, a branch breaks. Then i finally look up and a group of 3 were following me from the beach to my camp in the trees. Pretty creepy.
I built a corridor filled with fires and tried to get the cannys to run in and was having difficult making them commit. Even running out and attacking only made them stand at the end for a minute before leaving.

Fire is excellent regardless of origination though, I imagine a aerosol can flamethrower would be devastating.
< >
Showing 1-15 of 209 comments
Per page: 15 30 50

The Forest > General Discussions > Topic Details
Date Posted: Jun 7, 2014 @ 10:26pm
Posts: 209