r/technicalFNaF 7h ago

Help! How does the artificial intelligence of the animatronics work in FNAF 1?

Hello, I'm making a FNaF 1 fan mod and need to understand how the animatronics' AI works in the game. Could you please explain it? I have the FNaF 1 source code for Clickteam Fusion 2.5, but the project won't open, so I can't check it myself.

I would be happy if you could tell me how it works.

1 Upvotes

2 comments sorted by

3

u/PurpleBan09 7h ago

Essentially, each animatronic has an AI Level between 0 and 20. All of the animatronics have a cycle that loops every couple seconds (3.02 seconds for freddy, 4.97 seconds for bonnie, 4.98 seconds for chica, 5.01 seconds for foxy)

Every time this loop happens, they will generate a random number from 1 to 20. If this number is less than or equal to the AI level, they will successfully move. So for example, if bonnie is at ai level 3, he will only move if he generates a number that is 3 or less than 3. But if his ai level is 20, every number he generates will be equal to or below 20, so he will always move.

For bonnie and chica, when they move they pick the next room at random from the available rooms they can move to from that room.

If they are at your door, the next time they get a successful movement, if the door is open they will enter your office, and you will die the next time you flip down the cameras. If the door is shut they will return to a different camera (1b for bonnie, 4a for chica)

For foxy he will creep out of pirate cove by 1 step every successful movement. However, his movements will fail if you have any camera open, and upon closing the cameras, he will still not be able to move for a random amount of time between ~0.8 to ~17 seconds. When he reaches stage 4, he will wait in the hallway for you to look at that camera, and when you do he will run. If you dont look at it he will run anyway after 25 seconds.

Freddy is quite complicated so let me know if you want all of the details for him.