Monday, 29 October 2018

Game - Main Menu Attempt #1

In my game, I have added a Main Menu user interface to display when the user loads the application. 

In this post, I will mention the two different sets of blueprint classes which I used to add a Main Menu feature.

FirstPersonGameMode blueprint:
I started with adding an event, on the start of the game (Event BeginPlay). On this event, the game will display a widget (using Create Main Menu Widget), and add it to the camera viewport (using Add to Viewport). The player's input will be disabled using Disable Input (inheriting from GetPlayerCharacter and GetPlayerController). I will then set ShowMouseCursor to true.




Main Menu widget blueprint:
To add a user interface element, I have used a Widget component in Unreal. The widget for my game includes two buttons - one button is used to load the game, and the other button is used to quit the application. On the buttons, I used the OnClicked event to execute a series of functions.

When the user clicks the Play Game button, it will remove the widget from the parent object, set 'Show Mouse Cursor' to hide, and enable the input.  When the user clicks the Quit Game button, it will run the built-in Quit Game node.


Graph view of the Main Menu widget

Designer view of the Main Menu widget

In-game view of the Main Menu widget


Conclusion
I felt this was a difficult concept to add to my game, in comparison to Unity. In Unity, the developer can use an in-game Canvas game object to set up and display user interface elements. However, in Unreal, I was not able to find a way to physically display the UI in the game scene.

I feel I could have also made the Main Menu widget in an alternate scene, which could have made it easier.

Game - Pause Game mechanic


In my game, I have been able to implement a game pause mechanic. This is a mechanic which is included in so many published game titles. It allows a user to temporary stop the game action, and resume the game when they wish to.

Blueprint:
Unreal contains a predefined action which allows the user to pause the game called Set Game Paused. The user will start to press the 'P' or 'Escape' key, to execute a  'Flip Flop' action. This will either 'Set Game Paused' to true, or 'Set Game Paused' to false. The Flip Flop node is used to toggle between two outputs.

Conclusion
I feel this was a simple and easy mechanic to incorporate into my game. In comparison to Unity, I feel this is an easier process. This is because Unreal has a pause game mechanic built into the engine. If I wanted to pause the game in Unity, I would need to set the time scale of the game to 0 secs, which might not be necessarily pause the game.

Monday, 22 October 2018

Game - Lighting issue during development

During the development stage of my game, I experienced an issue regarding the lighting of my project.

The lighting in my project was not working for an unknown reason. When I started the run the game in play mode, it was not loading the lighting of the scene, and would only show the player's weapon, door objects and the static turrets. Movement and other mechanics appeared to work. This was not an issue which I have experienced before in Unreal.

I spent time attempting to re-build the lighting to see if it works, but this failed. Even in play mode, it was not showing the error to suggest the lighting required a rebuild. I also spoke to my lecturer, who was unsure how to fix the issue, and further searches online did not reveal any fixes.

I decided to update the static mesh material on all of the affected objects, and this appeared to fix the lighting. The issue appeared to be regarding the static mesh on the cubes.

The issue is visible. You can see a white box in the bottom left of  the map, which was one of the targets


Conclusion
With regards to the lighting, I dislike the fact that the user needs to build (update) the lighting when they add a new game object, or move an existing game object. This can slow down the development process, and usually takes 30 seconds to 1 minute to complete. In comparison to Unity, this is a slow process, as the lighting updates instantly, and you do not have to rebuild it.

Game - Developing the shooting

In this post, I will be describing how I set up the shooting mechanic into my game.

In our assignment, we were asked to use the FPS template built into the Unreal engine, which gave us the basic shooting mechanic. The Blueprint class was set up so when the user presses the Fire key (from the InputAction Fire event), it would retrieve the camera's rotation and forward vector, and fire a projectile forward.

However, I have removed the projectile shooting, as a laser would not shoot an object - instead I would use a LineTraceByChannel. The LineTraceByChannel function is used to check for collisions based on two Vectors, and I will return the LineTrace hit with the BreakHitResult function. The Start Vector is the current gun's position, and the End Vector is the player's forward Vector (multiplied by 10,000).

With the BreakHitResult function, I can retrieve what object that the player aimed at. I compare the BreakHitResult output, to see if the component has a tag of 'Shootable'. If so, the object hit will receive damage (using the ApplyDamage function), play a shooting sound effect (using the PlaySoundAtLocation function), and add one to the score.

Score + 1 function
I wrote a small custom function to add a point to the score. I chose to write an independent function, as it lets me re-run this small step in numerous pieces of code. Score is an integer variable, and it uses the Addition method to add '1', and set the score.



Conclusion
The LineTraceByChannel function in Unreal could compared to the Raycast function in Unity. Both features allow the user to compare two Vectors, and check for any collisions. This seems to be one of the best methods for shooting, as it can give you an instant response for what object has been collided with.

Friday, 19 October 2018

Game - Developing the static targets


In my game, I was planning on adding static turrets (or targets), which could be destroyed when the player shoots them. The turrets would also rotate to face the player at all times. This blog post will mention Blueprint actions. The turret component was created from a basic cylinder class in Unreal, from the Nodes tab.

The final static turret, after the Blueprint development.

How I set up the blueprint:

I used two blueprint classes. One class is attached to the player, and a second class is attached to the turret.

In the First Person Character blueprint:
Firstly, the player can shoot at opposing targets using the LineTraceByChannel Blueprint action, with the result of the line trace coming from a Break Hit Result action. The 'hit component' from the Break Hit Result would be checked to see if it has a Component Tag called 'Shootable'. If true, apply 150 damage.

Click to enlarge the image. This shows a section of the First Person Character blueprint, in relation to accessing an object through the Component Tag.

In the StaticTurret blueprint:
An AnyDamage Event is used to see if any damage has been done. If so, it will destroy the actor.

An Event Tick event is ran on every frame, and is used to rotate the turrets.  The FindLookAtRotation action is called to set the new world rotation, based on the player's location (GetPlayerCharacter -> GetActorLocation) and the self location (Static Mesh Component -> GetWorldLocation).

I chose to split up this vector, to keep the component on a 90* y-axis angle, and only rotate the object left-right in the 3D space.

Click to enlarge the image. This shows the Blueprint class that allows the static turret to receive damage (Event AnyDamage) and rotate on the X/Z axis towards the player.

Conclusion
In this section, I have learned that Unreal chooses to use two different tagging methods. There is the Component Tag, used to add a string to access components, while there is an Actor Tag used to add a string to access actors.

In comparison to Unity, I discovered this to be relatively challenging at first, because I struggled to understand the difference between Actors and Component classes (in Unreal). In Unity, there is only one tag mechanic which I see as much easier to learn and use, while Unreal extends this approach - which can be useful to control only specific classes and use similar tag names. Both applications allow the user to store multiple 'tags', but Unreal separates these to base them on Actor/Component classes.

Both Unity and Unreal also share the ability to run actions on every frame. Unreal has the 'Event Tick' action, while Unity has the 'Update()' script method.

Monday, 15 October 2018

Game - Level Design (Development in UE4)



In this blog post, I will describe how I was able to implement my map design into my game.

In the assignment, I was asked to use UE4's FPS template to use as a guide to build my own game. The template's scene include a floor, outer walls and some placeholder blocks scattered, with working box colliders.

I kept the floor and the outer walls, to give me an 'arena' to add my map design to. I also removed the inner placeholder blocks, as they would not be relevant for my map. I started off by enlarging the arena size to help me fit my design, as I felt the existing arena was too small to build an interesting, large scale level.

To build the walls, I used the existing 'box' shape from the Geometry classes as a starting object, and then adjust the scale to fit the needs for each specific wall.

Unreal contains a tab which contains a series of predefined shape classes. These are essentially 3D shapes. In comparison to Unity, Unreal has more pre-built shapes to use, such as the stairs and curved shapes.

Image showing a series of geometry classes, in the 'Modes' tab of Unreal.

Image highlighting the Scale section of the transform component, for one of my wall instances in the game.

I spent around 2 hours laying out the map design, and trialing different sizes of the walls. I would go into 'play mode' to get an idea of the space for the player to move around in. This would help me determine the space to place walls and doors, whilst giving the player enough room to walk around in a slightly open environment.



Conclusion:
To conclude, I feel that I have been able to recreate my 2D map design in the 3D environment in Unreal.

To improve this process, I feel like I could have produced a scale of the map during my original design. This would have made it easier for me to work out the area for the player to move around it. In a future game project, I would look into making a map design on a scale (in relation to the final game environment).

Monday, 8 October 2018

Game - Level Design (Map Overview Design Photo)

In this post, I will be describing a map overhead design which I have created, in the development process of my game.

Map overview inspiration
In my planning phrase, I originally considered producing a laser tag game which could be considered a training mode to introduce the controls and mechanics. From previous knowledge of computer games, I was aware that lots of shooting games, especially FPS games, tend to use a map plan of a level. 

Below are two examples of images which I used as inspiration for a map radar style, when drawing my game. These two images use dark, grey shades and colours to keep it plain. 

Map overview of 'Terminal', one of the maps in Call of Duty: Modern Warfare 3.

Map overview of 'Dust 2', taken from an early version of Counter-Strike: Global Offensive.


My Map Design:


How the player progresses through the map:
The player will start off in the green zone (top left) and they need to progress to the red zone (bottom right). They will encounter stationary enemy turrets (green circles on image below), and targets (red/yellow/black combined circles on the image).

The player begins by walking and turning around stationary walls, which introduces them to the movement mechanic. They will turn right and encounter their first set of enemy turrets, which can be shot with their gun (introducing the aiming and shooting mechanic). 

Following this, there will be a yellow door which stops the player from progressing. They will need to shoot a rotating target, to unlock the door. After progressing through the door, they will have some further enemies to shoot down.

At this point, they will be at the bottom left of the map, and need to unlock a door again through hitting a rotating target. When this second door unlocks, the player will encounter a laser minefield, filled with lasers at different positions on the y-axis to avoid. This introduces the crouch and jumping mechanics to the player.

Afterwards, the maze will open up slightly to allow the player to explore slightly more, but will still encounter stationary turrets which can damage the player.

At this stage, they will be in the top right corner of the map, and will need to continue to progress by travelling over an orange bridge with moving walls which can push the player into the water on the floor and cause them to restart the maze.

When they pass the bridge, the player will enter a boss battle arena, and need to defeat a large scale moving AI enemy. If they win, the red area will be unlocked, which the player can enter to complete the map.



Evaluation:
In conclusion, I felt that I should produce an overhead map design of my level to help me plan out how mechanics could be used. Having this map design should make it easier for me when I build my final game in Unreal, as I've got plans and a layout to build upon.

Wednesday, 3 October 2018

Game - Inspiration

This post includes a series of videos which I am using for inspiration.


Call of Duty 4: Modern Warfare
In Call of Duty 4, the opening mission serves as a tutorial to teach the controls and mechanics to the player.

The player learns how to perform movement, jump, aim and shoot, use weapons, and go prone.




Counter-Strike: Global Offensive
In Counter-Strike: GO, the game has a training mode which allows the player to learn the basic mechanics.




Overwatch
In Overwatch, the game includes a training mode.




Conclusion:
In this training mode style arenas taken from commercial videogames, I have concluded that lots of these areas help teach the player the basic mechanics and controls of the game. I  would be interested in going for a similar design in my game. These games include  teaching mechanics such as shooting, jumping, running, crouching and using in-game items. These mechanics are ideas which I will keep in mind when creating my game.

Monday, 1 October 2018

Game - Planning and ideas

In this post, I will talk about some of my plans and ideas for my game, which will include the player holding a gun.

Laser tag training course arena
My first idea is a shooting game revolving around laser tag. Laser tag is an activity where individuals use a handgun 'shoot' their opponents by firing an infrared visible laser. These are held in small dark mazes and arenas, and are played for fun, or a sport. There are different game modes such as 'capture the flag', 'protect the VIP' or 'capture the base'.

I feel like this would be a good idea because it is a unique idea which is not common in first-person games. I would incorporate the laser tag theme into a training course mission - similar to those seen in tutorials or opening missions of FPS games.

Mechanics which would be incorporated include:

  • Moving the player within an arena
    • Movement on X and Z axis
    • Jumping and falling on Y axis.
    • Going prone (crouching under an obstacle)
  • Shooting the laser gun
  • Scoping in and aiming with the laser gun


In terms of guns, there are a range of laser weapons in numerous video games which could be modelled. Examples include the PRL 412 Laser gun in Resident Evil 4, the M6 Spartan Laser from Halo 3, or rifles which include a Red Dot Sight attachment (seen in the Call of Duty series).


Duck Hunt style shooting
My second idea is a shooting game where objects fly into the sky, and the player is required to shoot them down before their escape. It would be inspired by the 1984 NES game Duck Hunt, where the player shoots flying ducks in a first-person perspective.

There could be some time-based challenges, where the player needs to shoot down objects within a certain amount of time. Some of the objects which fly in the air could be bonus items, which drop extra ammunition when shot, or multipliers to double the player's score.

I feel like this could be a good idea, because I could extend the original Duck Hunt idea, by converting it into a 3D environment, and building extra functionality through bonus items, or adding items to avoid shooting.

Mechanics which would be incorporated include:

  • Moving the player within an arena
    • Movement on X and Z axis
  • Shooting the gun
  • Aiming the gun while scoped in
In the original Duck Hunt game, the player would shoot using an external 'zapper' controller. There was no evidence of a gun in-game, so I could be unique with my gun model.


Final thoughts and conclusion
Some further ideas which I did not look further into, included a paintball arena and a water-gun summer style game. I chose to avoid these ideas as I was stuck for ideas on guns which could be modelled.

I decided to make a game, based on my laser tag idea described above. This is because I was keen to build upon these early thoughts and I received positive feedback from my tutor with this idea.


References
https://www.telegraph.co.uk/sponsored/why-not/11692983/where-to-play-laser-tag.html Accessed 01-Oct-2018.

http://www.lasermatrix.biz/about-us/what-is-laser-tag/ Accessed 01-Oct-2018.

http://mentalfloss.com/article/26875/how-did-duck-hunt-gun-work Accessed 01-Oct-2018.

https://www.mobygames.com/game/duck-hunt Accessed 01-Oct-2018