top of page
Assignment 1

06 AI Assignments

--------------------------------------

-Assignment 1-

--------------------------------------

AIAssignment1.png

For Assignment 1, we were tasked to create a simulation by creating AIs with multiple states. So I created a restaurant simulation with 5 different AIs (Customer, Receptionist, Waiter, Chef, Baby)

A1 State Diagrams

--------------------------------------

Screenshot (74).png

Customer

The Customer queues up and upon reaching a table, would take a random time to order. Each customer has different amounts of patience. While waiting for food, his patience would drop. He would then tip at the end based on how much patience he has left.

< Mouse over         for state             diagram

--------------------------------------

Screenshot (75).png

Receptionist

receptionist.png

The receptionist waits for customers to queue. If there are empty tables the receptionist would then go and bring the customers to the table and seat them. If the group has a baby, he would then go bring a baby chair to the table.

--------------------------------------

Screenshot (78).png

Waiter

waiter_Serve.png

When all customers at a table are ready to order, he would go to the table and take the order. If the chef has served a plate on the counter, he would pick it up and bring it to the correct table.

--------------------------------------

Screenshot (79).png

Chef

chef.png

The chef has energy. When there is an order she would proceed to cook. She would also need to use energy to put out fires. After cooking, if her energy is <0, she would rest instead, only being ready to cook when she has max energy.

--------------------------------------

A1 Learning Points

Baby

baby.png

The baby has a random chance to cry. If the baby cries, the patience of the customers at the same table would drop faster.

Screenshot (81).png

--------------------------------------

A1 Sample Video

Through this assignment, I learnt how to create AIs with multiple states and how their behaviours would change depending on who/what they are interacting with.

--------------------------------------

You can watch the sample video here:

Assignment 2

--------------------------------------

--------------------------------------

-Assignment 2-

AIAssignment2.png
A2 State Diagrams

For assignment 2, we had to implement tile-based movement and pathfinding into the game.

--------------------------------------

StatePlayer.png

Player

player.png

The player can click on any of the green markers to take a step. The red markers show how much energy the player has left. The player's job is to catch all the thieves and then proceed to the next floor.

--------------------------------------

StateThief.png

Thief

thief.png

The thief has to find the treasure. So by using Depth-first search, he has to scope the entire level until he finds the treasure.

--------------------------------------

A2 Learning Points
StateAssassin.png

Assassin

assassin.png

The assassin will patrol along a path until the player gets close enough which he will then use AStar pathfinding to reach the player by the best route as there are puddle/door tiles which cost more energy to go through

--------------------------------------

A2 Sample Video

Through this assignment, I learnt how to create AIs that can traverse tile-based maps using DFS, BFS and AStar pathfinding.

--------------------------------------

You can watch the sample video here:

Assigment 3

--------------------------------------

-Assignment 3-

--------------------------------------

AIAssignment3.png

Assignment 3 was a very short assignment where we had to make a game where we can play against an AI in a game where you summon troops down a lane.

--------------------------------------

In this assignment instead of being grid-based, we had to do node-based pathfinding instead which is displayed by the red circles being the nodes while the lines showing the connected nodes.

A3 AI Strategies

--------------------------------------

AI.png

Troops

There are 3 different troops all having the same 3 states (Move, Chase, Attack).

However, each of them has a different amount of 'point' so that the AI can decide which lane needs help and what is the best move for it.

 For the AI, 4 weights are considered:
    1.Player's towers' health in the lane.
    2.Enemy's towers' health in the lane.
    3.Number and type of enemies in the lane.
    4.Number and type of minions in the lane.
 -->There is also a random noise added to randomize the spawning
a little

--------------------------------------

A3 Learning Points

The AI also has changes playstyle.

Offensive(ignores player's towers' health).

Defensive(ignores enemy's towers'health).

Changes to Defensive strategy if damage taken is too much.

Changes to Offensive strategy if damage taken by the opponent is more than AI.

--------------------------------------

A3 Sample Video

Through this assignment, I learnt how to create an AI that can make decisions based on what is on the map to get the most optimal results.

--------------------------------------

You can watch the sample video here:

More Info

--------------------------------------

You can check out the game, source code and documentation here:

Password : references

--------------------------------------

bottom of page