Project Implementation pt.2

Working more into the Game AI’s today’s session was focused around working with the Third Game AI. The behavior of this AI is to follow the player whenever he is not looking and slowly get closer and closer.

This AI is composed of 3 scripts, Chase Script, State Machine Script and Player Movement Handler.

The Chase Script, is basically just telling the AI to move to the player position.


The State Machine hold that current states that are available, working together with the Player Movement Handler, the state machine controls when the states will change. By using the player positions x position.

This slideshow requires JavaScript.

Player Movement Handler is where we send information on the players movements to the State Machine, the AI reacts to the movement of the player, this was for the testing stage, but now I want the AI to react to the way the player is facing, so if he faces towards the AI it won’t move, but if the player shows his/her back to AI it will move towards the player.

This slideshow requires JavaScript.

I tried altering the code in the Player movement handler, in an attempt to get the facing position to work as previously discussed, I don’t know if I’m just having a brain block, but anyway, taking a break from that, I started working on a new script that could potentially do the trick and it did, however this script is super small and does require any kind of state machine handler.

New chase script, this script is pretty basic, the Game Object AI Three which is the current AI being worked on, chases the players transform position, however the two On Trigger functions, using the Looking tag, the AI will not move if it is in the radius of the box collider that is attached to the player object, this is because the box it self holds the Looking Tag, so when the AI is inside the radius of the box collider it will not move, but once the player has moved outside of that range, the AI is free to move towards the player.

This slideshow requires JavaScript.

I found that this version of the chasing script worked particularly well, however I would of liked the AI to move a bit better around the maze, as it is currently just moving into walls, more development will be required into this one, but right now the simplicity of this AI is perfect for a prototype.

Also, I realized the other day that the maze that was created is way to big !!! Downsizing it, is going to be necessary, but that is a good thing, VR games require a lot of optimization, so decreasing the amount of assets or objects being used will help with the end result of development, loading speed, latency etc.


Project Implementation

Working on the final workings of my project. I have decided to code three different AI that will function differently. This is standard best practice for game AI that run of state machines. Instead of having one big complex Ai, I will create three simple game AI.

AI no. 1 – Pluggable AI

I have talked about what Pluggable AI is in previous blogs. I have started trying to implement what I had learnt from the tutorial that was created by Unity, into my final implementation. Unfortunately, the theoretical side of the Pluggable AI is easier to understand than the actual implementation.

The main problem I seem to have with it, is a null reference that appears when trying to receive the Way Points from one of the scripts, the Way Points are used for a Patrol action that will make the AI move to certain points of the map. I have been continuously working on fixing this error but to no luck.

AI no. 2 – Standard One Script State Machine

Working on the second AI was a lot easier than the Pluggable AI. It runs of one script, and moves through the states judging on the actions it is given. This Ai is able to react to player presence, if the player is within range of the AI’s eye sight.

Example code:

This slideshow requires JavaScript.

This slideshow shows the script that is used to make the AI work. While Idle, it will choose a random position on the NavMesh and move towards the spot it has chosen, the position is random every time. When running this script for the first couple times, I notice that when the AI was traversing through the maze it was quite fixated on staying in the same general area.

All of the states occur in Update, the states I am using in this script are as follow, “Idle, Walk, Chase and Kill”, when the player is within sight of the AI it will chase towards him, increasing in speed to give the visual affect that you need to run.

The player will also require this script in order for this Ai to chase him.


This script s quite simple, basically it just saying if the player enters the eyes of the AI, get checksight from DollTwoAI, Checksight will check to see if has hit the player with its RayCasthit and proceed to enter the Kill State, which will use the chase state to increase its speed.

AI No. 3

Still in planning stage of development.

So far I have been testing with a basic first person to get general functionality down before implementing the VR solutions.

Scriptable Objects

I realized as I was reading through my blogs that I never talked about how I plan on implementing my Game AI. Before I can really do that, I have to explain what scriptable objects are, as the Game AI will be derived from this.

What is a scriptable object?

‘Scriptable Objects are amazing data containers. They don’t need to be attached to a gameobject in a scene. They can be saved as assets in the project. Most often they are used as assets which are only meant to store data, but can also be used to help serialize objects and can be instantiated in the scene.’

  • Scriptable objects don’t often work on their own.
  • To work with Scriptable Objects we often use editor scripting.
    • Editor scripting uses Unity’s Immediate Mode UI
  • Scriptable objects contain data
  • A Scriptable object is a data container
  • A Scriptable object is very similar to a monobehaviour, which we attach to our game object.
    • Parallel to monobehavior
    • Derives from the base Unity Object
    • Are Subject to Unity’s serialization technique
  • A Scriptable object doesn’t need to be and cannot be, attached to a gameobject
  • Instances of a Scriptable object can be saved as assets in a project

Why use Scriptable Object?

  • Scriptable Objects have two major uses
    • Saving and storing data during an editor session
    • Saving data as an asset in our project for use at run time on deployed builds.
  • In the editor, we can save data to Scriptable Objects during edit & runtime
  • In a deployed build, we can use the data saved in a Scriptable object.
  • No need for a 3rd party file format.
    • When reading data from a Scriptable Object there is no need for xml, json or text.
    • Therefore no need for writing a parser or other manner of accessing the data.
  • Can save large amounts of data (Millions of ints).
  • Optimization of loading the data as we need it.

Those are the technical points as to why use a Scriptable Object, the reason I want to use Scriptable Objects is because it’s not something I’ve ever used before, I’ve also worked on a tutorial that gave me the idea to use this technique to create my Game AI. The main reason is because I can create large amounts of states for the Game AI to use, with each state holding little amounts of data(code), this way provides a simpler way to create a State Machine AI, I think this provides a sense of Best Practice for a Game AI, this way will also make it easier to make changes to the Game AI.

(Link to blog on Scritable Objects Tutorial – Pluggable AI Blog )



NavMesh and Maze Generator

Short blog..

Working more on the random maze generator, I tried to implement the NavMesh, so that I could start working on the AI’s traversing states. But in order to bake the NavMesh the objects being baked need to be static objects, this was troublesome because the maze generator always implements a different map every time, meaning that if I did want to bake the maze, the only way it could possibly done would be via code, unfortunately I was unable to find information on that being possible, so in order to make this game more possible, I started the maze generator and I copied the maze that was built, and copied it into a new scene, getting rid of the gameobject that called the random maze generator, and making the new static maze into static objects, now when going forward with the navigation system, I was able to bake the inside of the tunnels as walkable areas.

Blue indicates the NavMesh, walkable areas.

This does change what I originally wanted, but a work around can be done, simply by running the maze generator I can make and abundance of mazes and save them into new scenes as a type of level system.


Pathfinding/Unity Nav Mesh


Unity Pathfinding and Navigation

Unity provide a navigation system inside of their development program that is extremely simple and useful to use when implementing pathfinding in a 3D game.

The navigation system allows users to create AI that can intelligently move around a 3D game world that has been created, using navigation meshes that are created automatically from the scene geometry.

Dynamic Obstacles allow you to alter the navigation of the characters at run time, while off-mesh links let you build specific actions like opening doors or jumping down from a ledge.

Navigation Overview

  • Built in navigation system
    • Allows characters intelligent & accurate movement
  • Traditional navigation around 3D objects in a scene is considered slow and inefficient due to the complexities of the models.
  • Unity us NavMesh
    • NavMesh is a very simple 3D mesh which is derived from the geometry of more complicated elements in a scene.
    • easier to navigate and pathfinding within.
  • Process of creating a NavMesh, called “Baking”.
  • Off-mesh links
    • Control movement across meshes.

NavMesh Baking

Navigation requires the use of a simplified geometrical plane, often called NavMesh.

  • Baking (Creating a NavMesh)
  • In order to bake a NavMesh, Unity must be told which objects are navigation static. (Objects that don’t move, e.g. floor, walls, obstacles), this is so an accurate calculation can be done to obtain the walkable areas of the scene.

NavMesh Agent

Responsible for moving of the characters around a scene and finding paths in a NavMesh.

  • Can easily navigate a game object with a NavMesh agent component.
  • Moving of the agent is done via code.

Off-mesh links

Provide simple paths between pieces of NavMesh.

  •  Connecting two NavMeshes together to allow movement between them.
  • Pathways that connect pieces of a NavMesh, so NavMesh agents can traverse them, e.g. Jumping off ledge.


Using Unity’s Navigation system, I should be able to get my game AI to traverse through the maze, the only thing that I am worried about, is the fact that because the actualo maze is made up of individual pieces coming together to form a random maze, is if I will need to add a navmesh to each piece of tunnels or if it possible to run the NavMesh after the maze has generated, this is something I will work on for the demo.

I have actually practiced using the NavMesh on other various prototypes AI games, and it was pretty straight forward. Implementing it will be a bit of a challenge for the maze.

Supervisor Discussion #3

Meeting with my supervisor on Wednesday 11th of October. We started off by talking about the report, Craig says I will have no problem writing up my report with the amount of research that I have done into this project. So the main focus was discussing how we can turn what I am doing into a poster, for the poster evening event at NMIT.

In order to get a general idea, we went through the research journey I have under gone for the project in order, from where I started to where I am at, in the present. This was helpful because if there were things that I had missed, I could quickly research into it.

Craig took down notes in order to create a visual graph of the project, this is to help me with the poster, but I also think it could help me with my report.


Web Application Vulnerabilities

Lab 14

“DVWA (Damn Vulnerable Web Application) is a web-based application that has been deliberately designed to include various vulnerabilities.In this lab, we will install the application and investigate some of the vulnerabilities.”

Exercise one: Installing Xampp

This slideshow requires JavaScript.

Exercise two: Installing DVWA

This slideshow requires JavaScript.

Exercise three: Exploiting a Command Execution Vulnerability

Size of the packets are only 32 bytes.1.PNG

We have set the amount of bytes for this one, so its 800.


If this is the correct thing that was meant to display from the command /?, then this basically works like a command prompt. -l we sent the size of the of the bytes to the server, this pings whatever we type in.


What was returned when typing in “server | dir” into the ip address text box, was information that looked like it regarded the extracting or editing of the DVWA files or the information log of me accessing the site via the browser. Because dir is a command used for file and directory listings?


Exercise four: Exploiting a SQL injection Vulnerability

During wokring on this website I noticed that when entering the commands given to us from the lab book, This worked like a database.


Entering the 1′ command into the textbox, gave me back admin information.


Exercise five: Exploiting a Cross Site Scripting Vulnerability

This part of the lab, worked like executable scripting.



LAB 13

“HTTP transfers are all in plain text or use simple encoding methods. This makes the protocol extremely vulnerable to packet sniffing. HTTP transfers can be protected by encrypting them with SSL/TLS.”

Exercise one: Sniffing HTTP

This exercise involved capturing HTTP packets between the client vm and server vm, surprisingly this seems to be quite an easy process. Packet sniffing can be used to steal sensitive data, of people who become victims of identity theft, etc.

This practical example was very interesting to participate in, as I am not an expert in this field.

This slideshow requires JavaScript.

Exercise two: Securing HTTP

Being able to secure the the HTTP from the server, really shows the power you can have over a network.

This slideshow requires JavaScript.

Data Leakage Prevention

Lab 12


Exercise one: Installing Rights Management Services

There was an error that wouldn’t allow the install to go as planned, using the forum, was able to fix this by getting rid of the conflicting site that was done in a previous lab.

This slideshow requires JavaScript.

Exercise two: Exploring the DLP Options


Network Access Protection

Lab 11


Exercise one: Installing Network Access Protection

During this exercise I was forced to skip step 5, 6 and one step inside of 9, purey because they just would not appear as they instructed in the lab, I think the reason for this being that I may have done it once before in a previous lab and without a way to revert everything after each lab, it is hard to keep track of what I have done.

This slideshow requires JavaScript.

Exercise two: Configuring Network Access Protection

This slideshow requires JavaScript.

Exercise three: Configuring a NAP Client

This slideshow requires JavaScript.

Exercise four: Testing Network Access Protection

When asked to run the command prompt and type in ipconfig/release or ipconfig/renew, I am given the same error message “The operation failed as no adapter is in the state permissible for this operation”, this could be from the fact that I skipped those few steps in the beginning. I went back to try and redo them but the fact I could not do them, still remained the same.

I also did not know what the commands were trying to do, so I did a little research.
ipconfig /release is executed to force the client to immediately give up its lease by sending the server a DHCP release notification which updates the server’s status information and marks the old client’s IP address as “available”. Then, the command ipconfig /renew is executed to request a new IP address.

This slideshow requires JavaScript.

Exercise five: Circumventing Network Access Protection

When trying to ping the server, the ping request could not find the server, then when I check my ip address, it was changed by an auto-configuration.

Even after changing the IP address, I still could not ping the SERVER.

This slideshow requires JavaScript.