Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Thank you!

So the customer AI is actually a chain of goal-oriented behaviors. The goals themselves are just transform references, and the behaviors started with an abstract class to define checking if a transform is the goal, what to do when the goal is reached, and what the next behavior is once the behavior is complete. The goal transforms are just sphere triggers that check if the collision is a customer. Every shelf in the store has one of these nodes, as well as the shop entrance, the queue positions, the start of the checkout, the end of the checkout, etc. 

Also to note, the behaviors are all components that attach to the customer directly, and replace each other every time the next behavior is to start. 

The simplest behaviors are the enter store and leave store behaviors. They simple get the store entrance transform, set the pathfinding target to its position and let it head there. 

The actual shopping behavior is more of a loop. The customer gets a random amount of items to purchase and the behavior finds a random shelf node to go to. Once there, it "adds" the item to the cart, and if it hit the desired/possible number of items the behavior gets replaced with the queue behavior. If not, it keeps finding shelves to go to until it hits the desired/possible number of items (you might run out of items in the store and they have to end their shopping early)

Does that makes sense?  

The pathfinding is just the A* algorithm with a grid.

And then I wrote a similar behavior system for the zombies, but more customizable as the zombies actually need to do something to be able to enter the store

(+1)

Wow, thank you for your explanation! Great game indeed!