Devblog: Artificial Intelligence Movement
By Rancy
Bon Appawtit! logo

Thinking about AI movement, one possibility is that they all could stand in one spot for eternity waiting for you to talk to them. Another possibility is that they could also have a predefined path that they follow during different times of the day. However, if these two types of movement for the AI are the only movements available, the whole system becomes rigid, kind of like a scarecrow in place, but at least they are doing their job.

Furthermore, if static and predefined positioning are the only two types of movement implemented to the system, this implies restrictions to customization and placement of objects within a space! For example, you would only be able to place furniture within a single place on the map because the AI's movement would have been predefined. Boring!

AI Movement Decision

Player movement decisions are simple because it is controlled by... the player! You want to move left? Press the corresponding left button. You want to bump into a chair? Go ahead! It is your choice to do so. Or perhaps you want to walk around a table to get around it, slightly more complex, but a combination of "wasd" should do the trick.

However, for the AI, we need to implement that very complexity of getting around objects because the AI doesn't yet have the ability to see the whole screen (it is basically blind) to be able to make decisions visually like you do.

AStar Traversal

Imagine you are blindfolded and placed in the middle of a huge room. You hear your phone ringing far into the distance and your goal is to find your phone. The increased difficulty comes from being blindfolded, and to make it even more complex, there are numerous obstacles in the way between you and your phone. The solution here is to place your hand out to determine whether there is an obstacle in front of you, and walk towards the direction of where you hear your phone ringing. As the ringing gets louder, this means that you are closer to the phone.

Applying AStar

Creating nodes/cells and then labelling whether they are traversable, the AI can then determine a path to take to get to the end and weave around objects on the map.

In Bon Appawtit! the AI will navigate around objects on the screen, and this is great for customizing rooms however you want, and the AI will do its best to navigate through it all.


Brainstorming

Other Potential Traversal Detection Methods

A* Basic Traversal