09/05/18
Today focused on adding AI bots into the layer. With the level being a death match game that could also be used as a capture the flag level too, AI bots were put into the level to help demonstrate this.
Following some more YouTube Tutorials, https://www.youtube.com/watch?v=3GV6-4uhkYc, (Virtus Learning Hub / Creative Tutorials, 2016), https://www.youtube.com/watch?v=xPb3sV4lZuY&t=31s, (Virtus Learning Hub / Creative Tutorials, 2016), on creating AI's for the level, in how to give the AI ability to chase the player and roam around in a perimeter guarding an area and once the player appeared the AI would move to intercept the player.
From the modes menu and dropping first person character into the content browser, then opening up the blueprints to add the blueprints so the AI can chase and guard.
The first person character was re-named AI in the contents browser. In the mode section a nav mesh bounds volume was placed into the level and scaled up to cover the level so the AI knows where it can go.
Open up the AI blueprints, go to add component, add pawn sensing AI component, compile, click pawn sensing and view port. This shows a graph of where the AI can detect players. Using peripheral angle vision, the AI's detection area can be changed, angling it to the front, behind or sides, where the AI can detect the player and intercept them.
Once the peripheral vision angle is adjusted to the angle required, then go back into blueprints and add an event on see pawn, drag out node to search for first person character, hook up object to pawn, drag node out from cast to first person character to AI move to, which will give the AI instructions to move to a location, however in this case move towards the player once the player is detected. Target actor is dragged to first person character, pawn dragged out to get reference to self, compile. Once this is done the AI will move to the player once it has detected the player in its proximity.
The next stage was to allow the AI to create a guard perimeter alongside its command blueprint to intercept the player. Add an event tick in the blue prints section, drag the node out and search branch nodes, create 2 branch nodes. Add two variable nodes, re-name one in range and the other moving, drop into blueprints graph editor.
Attach in range to first branch and moving to second branch. Drag false node from first branch to second branch, then right click AI move to. From there drag false node from second branch to AI move to and destinations to get random location. Right click, get actor location, connect return value to origin and setting radius to 500- 600, to give the AI a large area to roam around.
From there drag another in range node into the graph view towards on see pawn, connecting on see pawn, in range and cast to third person character, ticking range true. Drag two more set moving towards AL move to, dragging node from AI move to towards set, tick moving and another node to the second set moving box, as well as dragging the on fail node to the second set moving box and compile. From the self node made previously for the AI to intercept the player, drag the node out towards AI move to and connect with pawn, then compile. The AI will then move around patrolling its perimeter.
Although the AI is working as described, player only sees a floating gun coming towards them, rather than a mesh body of character than had originally been envisioned. This is disappointing, however the AI bot does work. The other problem is the AI does not shoot its gun and the player can not destroy the the AI. The tutorials were set out for third person rather than first person which is what this level is. With third person the player would be able to see a AI mesh body coming to intercept them, however, the AI still would not be able to shoot the player or the player be able to kill the AI. However, on hindsight, and not realising, the third person AI would have looked more impressive than just a floating gun chasing the player around the map.
AI Bots
Today focused on adding AI bots into the layer. With the level being a death match game that could also be used as a capture the flag level too, AI bots were put into the level to help demonstrate this.
Following some more YouTube Tutorials, https://www.youtube.com/watch?v=3GV6-4uhkYc, (Virtus Learning Hub / Creative Tutorials, 2016), https://www.youtube.com/watch?v=xPb3sV4lZuY&t=31s, (Virtus Learning Hub / Creative Tutorials, 2016), on creating AI's for the level, in how to give the AI ability to chase the player and roam around in a perimeter guarding an area and once the player appeared the AI would move to intercept the player.
From the modes menu and dropping first person character into the content browser, then opening up the blueprints to add the blueprints so the AI can chase and guard.
The first person character was re-named AI in the contents browser. In the mode section a nav mesh bounds volume was placed into the level and scaled up to cover the level so the AI knows where it can go.
Open up the AI blueprints, go to add component, add pawn sensing AI component, compile, click pawn sensing and view port. This shows a graph of where the AI can detect players. Using peripheral angle vision, the AI's detection area can be changed, angling it to the front, behind or sides, where the AI can detect the player and intercept them.
Once the peripheral vision angle is adjusted to the angle required, then go back into blueprints and add an event on see pawn, drag out node to search for first person character, hook up object to pawn, drag node out from cast to first person character to AI move to, which will give the AI instructions to move to a location, however in this case move towards the player once the player is detected. Target actor is dragged to first person character, pawn dragged out to get reference to self, compile. Once this is done the AI will move to the player once it has detected the player in its proximity.
The next stage was to allow the AI to create a guard perimeter alongside its command blueprint to intercept the player. Add an event tick in the blue prints section, drag the node out and search branch nodes, create 2 branch nodes. Add two variable nodes, re-name one in range and the other moving, drop into blueprints graph editor.
Attach in range to first branch and moving to second branch. Drag false node from first branch to second branch, then right click AI move to. From there drag false node from second branch to AI move to and destinations to get random location. Right click, get actor location, connect return value to origin and setting radius to 500- 600, to give the AI a large area to roam around.
From there drag another in range node into the graph view towards on see pawn, connecting on see pawn, in range and cast to third person character, ticking range true. Drag two more set moving towards AL move to, dragging node from AI move to towards set, tick moving and another node to the second set moving box, as well as dragging the on fail node to the second set moving box and compile. From the self node made previously for the AI to intercept the player, drag the node out towards AI move to and connect with pawn, then compile. The AI will then move around patrolling its perimeter.
Although the AI is working as described, player only sees a floating gun coming towards them, rather than a mesh body of character than had originally been envisioned. This is disappointing, however the AI bot does work. The other problem is the AI does not shoot its gun and the player can not destroy the the AI. The tutorials were set out for third person rather than first person which is what this level is. With third person the player would be able to see a AI mesh body coming to intercept them, however, the AI still would not be able to shoot the player or the player be able to kill the AI. However, on hindsight, and not realising, the third person AI would have looked more impressive than just a floating gun chasing the player around the map.
Comments
Post a Comment