Greetings, 👋

It’s a lovely Friday in September, and you know we’ve got your update ready. This episode is about how we adjusted the pathing system to make customers move more efficiently to a food stand. Since we are using a 2D environment and handling thousands of city residents, this problem was slightly more challenging.

After a customer collides with the stand range and decides to buy a burger, they are assigned a queue point near the stand, and they proceed to that queue point.

In the image below:
– The stand is in red, and the stand range is in transparent red.
– The person’s path is in blue, and their path’s intersection points (where they can change their direction) are the green squares.
– The decision point in yellow is where they collide with the stand range and decide whether to buy a burger or not.

Previously, after colliding with the stand range, they would first head to the next path intersection point on their preset path before proceeding to their queue spot near the stand. This resulted in an inefficient movement along the yellow arrow to their queue spot, as shown below:

We wanted them to follow the shortest path to their queue spot from any intersection point. Like below:

To do this, we had to implement a path-finding system for everyone using a graph structure and Dijkstra’s algorithm, an algorithm for finding the shortest paths between specified points.

Now customers can find the shortest path to a food stand from any point in their journey across a location.

That’s it for today, Cheers 🥂

Don’t forget to Wishlist the game if you haven’t:

Live Long and Prosper 👋,
Kunal & the team