Week 2 of the 304CR module was about movement and pathfinding in use with AI.
The first lab task was about movement and asked us to check out an example of boids, inspect the code and figure out how do cohesion, separation and alignment values affect it. After checking out, I can tell that the alignment value affects singular boids and how fast they’re turning. The cohesion weight affects how fast the boid will try to go towards the centre of the swarm and the separation affects the distance between the boids that they try to achieve.
Another task was about pathfinding – we got a program which allows for creating maps and running different pathfinding algorithms on it – for the first part we had to check Djikstra algorithm (which goes in all directions equally until it hits the goal point), and next BFS algorithm which is faster since it estimates how far each point is from the goal, but it is a greedy algorithm in a way that it goes towards the goal as much as possible without realizing that there might be an obstacle that takes a long way to go around if you go straight at it. The next algorithm was A* - it combines Djikstra and BFS and is known to be the best out of pathfinding algorithms. It estimates the cheapest cost of arriving at the node as well as the heuristic estimate of the cost and based on that decides whether to use Djikstra or BFS to pathfind from any given node.
For the zombie game the next step was creating a simple Finite State Machine for the enemy AI – we created three different states and figured out how to make them work. For wandering state, the AI has a list of points it will go between at random. Additionally, I learned how to grab characters from sites such as Mixamo and use them in Unity. This is helpful in my future endeavors.