Fast Gear – Week 6

This week I have been fixing some small hiccups that occur with the AI. For example when the frame drops I talked about in an earlier post appears and I have no idea why. Luckily this time it was relativelty simple to investigate and find the problem. In order to understand the problem you first have to understand the basics of the A* algorithm. A* searches among all the possible paths it can take to reach the destination and chooses the one with the smallest cost. f(n) = g(n) + h(n) is the equation where n is the last node on the path, g(n) is the cost from the start to n and h(n) is a heuristic that estimates the cost of the cheapest path from n to the goal. This might seem a bit confusing, because it is. The problem I had with this was when we swapped tracks to a new one. This made the waypoints which the algorithm is calculating towards move out of the track and onto the “ground”. I have it set so that the road costs nothing to travel on but the ground costs 1000. This makes it so it wont go over the ground since it costs too much. When the waypoints were outside the track it had to do a lot of calculations with very big numbers and that is why it caused a spike in memory.

AstarExampleEn.gif

This week I have also been working on a FOV(Field Of View) for the AI. It creates a circle around the object and then you can change how big the FOV is going to be. If another object is in that FOV it will sense it and I can then tell it to do something. We have not yet figured out exactly what we want the FOV to do as of yet and I imagine that I will be working on that the next week aswell.

Image result for fov

Field of view example.

Leave a comment