Thursday 19 January 2017

AI

Basics - When the player is inside the casino I wanted to try and have a bodyguard who attacks you. This simple AI will only to sense the character and follow the character. While there is other more advanced AI like pathfinding which works out the faster rate for point A to point B without bumping into walls or running into tables. Behaviour tree allows the AI to make to use basic logic on how to act to different events. In the end, I felt like the bodyguard doesn't need to be complex as it only needs to sense the character and follow.



How-  I watched a tutorial called 'How To Create AI And Enemy Basics' (Virtus Learning Hub / Creative Tutorials, 2016) which explained out to make a basic AI. I started off with creating a character class and added pawn sensing to the enemy. Within the blueprint I made this code 'OnSeeSapwn' then I cast it to third person character. So this only work when the character is sensed. Next, I added the node 'AI Move to' which makes the move where ever the Character is. 
After creating simple AI, I needed to code which allow the player to be able to kill the enemy. With the enemy, I added a trigger box called 'Killbox'. Next, I have made a 'BeginOverlap' event and linked that to a gate. The function is if the character is in trigger box and presses 'E' the enemy will be destroyed. 

Testing-

Testing this I felt that it was too easy as the enemy is following you, just press e and you're fine. I needed another function for the enemy. My original plan was for the enemy to die and the star which the player needed to collect would spawn from his body like loot. Instead, he will be guiding the star which I have changed to a poker chip. When you get next to him he will push you away. 

The reason why I have done this is that I made most, the amount of sense with the AI I have coded. The blueprint below is how the enemy pushes the character away. I created a custom event within my third person character and reference it in the enemy's blueprint here. Next, I have a node that launches the character with other nodes to randomise the position you are launched in. 




Why - Designing with the flow channel in mind I wanted to introduce the player to an enemy but this enemy can't harm you as you can't harm him. If I was able to create this prototype into a full game this would be how I first introduce the character to the concept of facing enemies and give the character a safe environment to interact with the enemy. The enemy gives the level more life than just yourself, which Add immersion. 


Industry expectations


Usability in games. While limited in function this is a good start for getting AI which is usable within a game. I would re-use this blueprint and add more functions to it. This blueprint is a good foundation for AI in a platformer style game but would lack any use in open world games. 


 This blueprint only refers to third person character. If this code had errors it would affect the player character which is a downside but it's independent of the rest of the blueprints and wouldn't effect the open level blueprint.

This blueprint is efficient because it doesn't have any unnecessary add-ons or nodes that don't need to be there.This is the fastest and least costly method of creating simple AI.



Ready made libraries - Pawn sensing was a crucial part of this enemy. I could have made AI without that ready-made code from the actor class.


Re-usability - If I was going to make more enemies that just followed the player I was re-use this blueprint it's easy to change to suit a new character and enemy. While I would be better if it made more function and complex AI. It still functions, it's easy to adapt and all correctly named.


Time management 

As I have now finished my first prototype and completed my second deadline. It's time to look at my time management. Looking at my taskboard I sadly haven't been able to stay on target as I wasn't able to complete Instantiation, Loop or Arrays. I will have to add those tasks to my second prototype section on my taskboard. Other than that I have been able to complete most of the task before the deadline which is a great sign of progress. I am not worried about the progress I'm at, so I can now move on to my next prototype. 





Bibliography

Virtus Learning Hub / Creative Tutorials, (2016). How To Create AI And Enemy Basics - #42 Unreal Engine 4 Beginner Tutorial Series. [online] YouTube. Available at: https://www.youtube.com/watch?v=3GV6-4uhkYc&t=1s [Accessed 19 Jan. 2017].

No comments:

Post a Comment