11/05/18

AI Conitnued 


Today has seen the continuation of fixing the AI bots.  Following more tutorials on AI bots, health and HUD displays, in an attempt to rectify what might be the problem with the AI, in terms of getting the AI to die, and kill the player and the level to re-start again.

Following on from  yesterday and following a tutorial on creating health for the player and the AI, https://www.youtube.com/watch?v=9CW46uMjch8, (Virtus learning hub, 2016). 
Having watched two Youtube tutorials yesterday from the same channel, it was decided to go back and investigate whether there is a missing element for the AI bots, in why they are not being destroyed or killing the player and restarting the level.  One possibility was that the a health bar was required.  Following the tutorial steps into how to create a health bar for the player and to be transferred for the AI later, health capacity was created for the player blueprints.  Variables needed to be added such as player health.




 In the details section, changing the variable type to a integar and player health to be 100.  From there going into the blueprints section and beginning the blueprint sequence for the player to have health.  Left control to set, set to player health, and setting the players health to decline 25, each time it is hit.  connecting set to print string, then to branch and to destroy actor, with target as self.  To an extent this worked.  However, only when ctrl is hit on the keyboard, thus essentially the player is killing itself rather than the AI.  This was not quite what was envisioned before embarking on watching this tutorial.

The next phase, it was decided to change the collision box around the AI mesh and its gun.  Although the AI can not fire, the idea would be when the AI made contact with the player it would cause damage to the player, and when the player shot the AI, it would kill the AI.  This was done for both AI and player.



 


 It was hoped by adding collision boxes around the meshes, that this might resolve the caveats being caused and have the AI and player both being able to kill and die.  This had been advised by following another YouTube tutorial, https://www.youtube.com/watch?v=xpipnTo4gWQ, (Virtus learning hub, 2018).

This time going into the AI blueprints and view port and creating another variable, naming it health and changing the variable type to float and changing health default value to 1, so that 1 shot would kill the AI.Other variables such as in range, moving and just been hit were created for the blueprint, in particular, just been hit was a indicator for when the mesh had been hit and would be taking damage.


From there, moving into the blueprint section, starting with event actor begin overlap, connecting to cast to AI, branch, from branch condition drop in the just been hit variable.  From branch, false node, drag to set, set to print string, print string to set, set to delay, keying in for example 0.5 to make sure the mesh has been hit, and delay to set, just been hit.  Going back to set health, drag node to health and add 0.35.  This is the number that will be reduced from 100 every time the AI gets hit.
As the tutorial progressed, it advised more additions to the AI's blueprints.  These additions were to be more specific with the hits that made contact from the player to the AI, in particular, the players gun shots.  From this the AI would know that the players gun shot had made contact with its mesh and the the AI's health would be reduced accordingly.  Furthermore, when the AI was destroyed it would explode into flames by linking a particle to the the AI's location once destroyed.  This was done by adding branch's add additional minor adjustments from what had been done earlier.


Despite all these additions and changes, the AI does not seem to be able to destroy the player and re-start the level.  The player is capable of killing the AI and the AI does explode into flames, however, this is inconsistent when this happens and it has been observed that this happens when there are two AI bots in the vicinity of each other rather than one at a time.

Further YouTube tutorials were watched to create a HUD, (Heads up display), in that creating health bars and a HUD might resolve the on going problems with the player and AI's.  The first tutorial advised on how to build widgets and buttons.  This would allow the player to get notices on screen and interact with menu's once a menu had been created or re-starting a level. 
https://www.youtube.com/watch?v=XVU5vNnhgxo, (Virtus learning hub, 2016).
This was helpful in how a menu could be created and help notifying the player during the game about different situations, kills, hits, health and so on.  Essentially building a user interface for the player.

The next YouTube tutorial went further by looking at the HUD in more depth.   https://www.youtube.com/watch?v=ra-G2qEWbuQ&t=419s, (Virtus learning hub, 2016). The idea in particular for the HUD in this instance would be creating player health.  Which in turn might resolve the problem of why the player will not from contact with the AI.


 From event begin play, to create user widget to add view port, connect target to return value.  Then from owning player to get player controller.  More was required than just blueprints.  However, with the problems still persisting with the AI and player not being able to kill one another, more time was focused on resolving that problem than creating a HUD.



Traps

The level had been designed with the concept of being a death match and being converted for a capture the flag tournament.  With this in mind, not much development was put into that of puzzles or traps.  However, some research using YouTube on what was available and could be created in Unreal 4 was carried out using the following YouTube videos.   https://www.youtube.com/watch?v=l79bcdWBZ1s, (Unforgiven, 2016).  https://www.youtube.com/watch?v=nuUMwV08Zhg&t=144s, (CrazyB gaming).

The purpose for researching what traps and puzzles are available in Unreal 4, was to assess what could be implemented into the level, even though it had originally be unintended to have any puzzles or traps in the level and the focus just being on killing AI's and avoid being killed by AI's.  Although these videos were insightful, there was nothing that could be added quickly with the deadline looming.  Some of the ideas would not have worked with the theme of the level, whilst others could have, however, more models would have needed to be created in Maya and then moved into Unreal to create these traps and puzzles.  The decision was then taken not to add puzzles or traps and to try and fix the AI and player problems with not being able to kill one another in the level.

Comments

Popular posts from this blog