[5SD033]Potato Pirates, Week One – The beginnings of an AI
|
The first few days of this week was spent planning how our AI should behave. We started by outlining the different states of the enemy:
![]() I took it upon myself to give the enemy a “field of vision”, an area around the enemy which when the player enters will make the enemy move into chase state an begin chasing the player. This was done by drawing a circular shape around the enemy. The collision box around the circle was still rectangular, so the player would only need to enter the rectangle. I got around this by getting the difference in X and Y positions of the player and the enemy while the player is inside of the collision box. Then using the pythagorean theorem to get the distance between them, if the distance was lower than or equal to the radius of the circle the enemy would “see” the player. We chose to have a circular field of vision to simulate the enemy pilot being able to turn their head and look around, the radius of the field of vision is so short so the player will have a chance against the enemies. As of now the enemy does not actually do anything when the player enters its field of vision, it only writes “I see you” to the console. We intend the field of vision to increase slightly when the player have been found to make it a bit harder for the player to escape the enemy/enemies. Every type of enemy will also have slightly different fields of vision, the Anti-Aircraft gun for example will have a much larger field of vision than any other enemy but will not be able to chase the player since it is mounted and can not be moved easily. |
