During this module, I was required to produce an first person character game artefact using the Unreal game engine, where the player holds a gun.
The brief of our assignment said that I was expected to use Blueprint or C++, and produce a one level game using the first person template, where the player remains within an arena area. I feel that I have been able to produce a game which matches the above specification, and I am happy with the outcome. The game is titled LaserTagged, to go along with the original project theme of a laser-tag style arena experience.
Is my games objective clear?
I have added an instructions screen on the menu, which tells the player that they need to defeat the enemies and escape the maze. In the game, there are some text elements around the level which help tell the player about mechanics, and how to perform certain actions.
Can my game be completed?
When the player defeats the boss at the end of the level, it shows a screen which says the game is completed, and a button which returns you to the menu.
Is there a lose state to my game?
If the player loses enough health, or hits some of the lasers in the level, they will lose their life, and need to restart the game to continue.
Functionality on top of the existing template:
The mechanics of the FPS template originally saw the player fire a projectile from the built-in weapon. However, I changed this and I went for a laser-tag style experience, which changed the shooting mechanic. Instead of spawning a projectile, the player now uses a LineTrace shooting mechanic. This LineTrace mechanic became complex near the end of development, because it was responsible for comparing what the player shot towards, and what action to take from the object fired at.
The projectiles originally used for the player shooting are now used for the enemies shooting. This was easier to include, instead of creating a new projectile, because it previously worked fine. The material was also changed to a red colour, because the red colour can give a negative connotation to the player.
I removed the VR sections of Blueprint code from my level, because it was not necessary to keep in the project, and I felt it also tided up the player's Blueprint class.
I changed the colour of the crosshair, because I wanted to use a different colour during the development. In the end, I felt the colour looked nicer and stood out to others.
Throughout the scene, I have added targets, which the player must shoot to unlock doors to let them progress in the level. This is because lots of training modes in FPS games include targets to fire at, and I wanted to include a similar feature in this game.
I have added a series of static enemies which fire bullets at the enemies in short bursts. This is because I wanted to add a challenge to the game, and it gave the player something to try and defeat in the process.
I added the ability to crouch - something not included in the first-person template - because it was a mechanic I was looking to add into the game from my early plans, and it was a mechanic which the player needs to use to progress through a section of the level.
Thoughts of polish/quality/UI
I was happy with some of the final level design elements which I included in my game. This includes textures of the walls and floor, the user interface elements, and the audio included.
I chose the minimize the numbers of textures in my game, to try and keep my game running efficiently (avoid too many textures which could cause lag), and to keep a consistent art style throughout my game (ensures the player know they are in the same arena).
With the UI elements, I tried to keep a consistent design, as it means the players will be used to the colours and button layout throughout the games. I also wanted to ensure the players could stop when they wanted, which is why I included a pause menu. The pause menu, game over screen and end screen all allowed the player to return to the menu, or restart the game. From the main menu, the player could choose to quit, meaning the player does not need to perform Alt+F4. With regards to the Heads-Up Display (HUD), I tried to keep the display simple, because most games try and minimize the information on-screen. If there was any information to display on screen, I planned to keep it minimal and simple - such as saying how much health the player had left.
With the audio elements, I did not want to overload the player with music and sound effects. I chose to include some sound effects for shooting and taking damage, to help give the player understand when they took damage, without looking at the HUD always. I only wanted to add music during the boss battle, to try and add tension to the battle.
I added an instructions screen on the main menu, to allow the player to have a basic understanding of the game. But I tried to keep the instructions simple, to let the player experience the game to learn more. This means the player can learn tricks and tips by playing the game repetitively.
Issues which I noticed in the final game:
I noticed a series of issues in the final build of my game.
Firstly, I noticed that the game begins to lag (drop frames) over time. I am not sure why this was happening, and it was cutting the enjoyment out of the game as the player progresses forward. This might be because there are numerous m\ethods running during the Event Tick. I used the Blueprint Debugger to try and understand this issue, but it did not prove to cause any direct issues.
Secondary, I attempted to create a mini-map in the bottom left of the screen. I was interested in adding this in, because it helps add some perspective to the level from an alternate angle. However, I noticed that this would sometimes glitch out, and produce a pixelated image, which I was unsure about. I received some mixed feedback for this; some people said it was good because it adds to the spookiness of the level, while some people felt it was looking buggy.
I was disappointed with both of these issues in the final game, but there was no answers when searching online for the issues.
What I could add in the future:
If I wanted to continue development of this product in the future, I could add some new mechanics or gameplay elements to the game, such as the ability to use grenades or explosives, or introduce a melee weapon to allow for close-range combat.
I would also like to add in some animations for the reload, because this can make the game feel more immersive for the player.
I was also interested in adding a mechanic to allow players to change their crosshair colour. This is because different users have their own preference for a colour - some people may use a different colour as they experience some colour-blindness.
Final thoughts:
Overall, I was really delighted that I was able to produce an FPS game because it is a genre of game which I enjoy playing, and it gave me some insight into how these games are produced. I was really happy that I was able to add a custom shooting mechanic, with the LineTrace shooting, and also able to get enemies which could hurt the player. I was also really happy to add a secondary input mechanic - which allows players to use a controller instead of mouse and keyboard. I like to add this to games, because some users prefer to use a controller, instead of mouse and keyboard.
I was also happy to be able to incorporate my custom model of a MAC-10 gun into the game, because it made the game feel much more personal to myself, and this also proved to myself that I could build my own assets for a game.
I did not think the game was perfect, and the issues mentioned above made the game feel uncompleted, and if I got a chance to look into the issues further, I would want to fix those. Despite the issues, I was impressed with the outcome of the product, and this is a game which I'd happily add to my portfolio.
With regards to using Unreal, I was happy that I got a chance to use the software, and it gave me experience in a new game engine. I struggled in the early stages with Blueprint, but it took time and practice to understand how it works. In comparison to Unity, I feel I would use Unity over Unreal. Unreal's collision system is a lot more complicated, and there were lots more options than actually needed. I also dislike how moving objects in the scene causes the engine to rebuild the lighting - which can take up to minutes to fix.
Showing posts with label Unreal Engine. Show all posts
Showing posts with label Unreal Engine. Show all posts
Thursday, 13 December 2018
Wednesday, 12 December 2018
Game - Debugging errors
Unreal contains a range of debug tools which allow the user to look at how they can fix any errors or issues which arise during development of a game. In this post, I will describe and provide screenshots of some of the key debugging features which I noticed during my usage of the engine during development of the game.
The debug tools can be found under the Developer Tools menu, in the Window toolbar menu. There are a range of different tools available here.
Blueprint Debugger
A tool which shows what methods and classes are executing. This is really useful to show what is happening if someone wants to work out if a certain piece of the Blueprint code is running or not.
Call Stack
A tool to show what is happening during breakpoints. This is where a pause is placed to see if everything is executing, as expected. Similar to Visual Studio and other IDEs, you can skip frames, step into, step over, and step out of a method.
Breakpoints can be added to a step in the Blueprint by pressing F9 on the method you wish to add a break-point to.
Collisions Analyser
A tool to show what collisions are occurring within the scene involving all actors and non-static objects. This can be used to detect what type of collision is happening (overlap/sweep), the owner of the object, how many blocking results there are, and how many objects are colliding with the object.
Debug Tools
A tab which allows you to debug a series of features for the game engine, such as clearing the font cache, and reloading textures.
Message Log and Output Log
Two different tabs which allow for the developer to get feedback on the execution. This is usually where errors will be output. This is similar to the Message Log which is seen in Unity.
Two different tabs which allow for the developer to get feedback on the execution. This is usually where errors will be output. This is similar to the Message Log which is seen in Unity.
- The Message Log displays a series of output messages with regards to any Blueprint class errors, editor errors, and build & runtime errors.
- The Output Log goes into extended detail regarding the execution of the game, giving feedback on the game engine files, plugins, specification of the computer, the shading details, and the building process of the file.
Asset Audit
Allows you to review assets which have been imported into your project. The tab lets you import an asset, and review the properties of the file. You can review this, and compare the different outputs if it was formatted for different platforms (e.g.
- E.g. for an image, you can see properties such as the disk size, image dimensions and compression details.
- E.g. for an audio clip, you can see properties such as the disk size, compression rate, sample rate and duration
Session Frontend
A tab which allows you to review to performance of the game during runtime. This includes a console to debug information on the execution, an automation tab which allows the developer to run tests on tasks to ensure the game engine is running correctly, a screen comparison tab, and a profiler tab to capture information on the game's performance (some of the key factors include looking at threading, tick time, memory usage, input tick rate).
This can be useful to developers with a good technical knowledge of the engine, as this could allow them to debug some of the factors which affect the performance, and help review technical issues.
The profiler in Unreal can be compared to the similar feature which Unity includes to debugging the performance of the game.
There are some other debugging tools included in the Unreal engine, in that menu, and are listed below.
- Class Viewer - Retrieves a list of classes included within the project. This can be used to allow developers to easily find Blueprint classes. This can be useful to see if there are any classes which could be removed or deleted.
- Device Manager - Retrieves a list of devices which the developer's computer is connected to. This shows what platforms the computer is connected to (Windows, HTML5, iOS), and also shows a list of processes running on the computer. This is similar to the Task Manager in Windows. This can be useful to see what tools the developer has got connected, and allow them to connect another device, if they wish to release their game on another platform.
- Device Profiles - Retrieves a list of 'profiles', which are ways for the developer to review CVars (texture settings, console variables) and Texture LODGroups. This can be useful if the developer wishes to set up a specific texture output file.
- Widget Reflector - a tab which allows the developer to review the technical output of the UI reflections and visibility. This also allows the user to review the C++ widget code, show if the widget component can be focused on, if it is visible, and other details.
- Pixel Inspector - A tab which lets developers review pixels, such as colour and texture details when hovering over objects in the Unreal scene. This can be useful to help the develop get access to a colour of a few pixels, if they want to reuse the the colour elsewhere.
- Merge Actors - A tab which allows developers to join actors together. The tab contains settings which let you change the settings of the new, merged object such as the pivot point, merge of materials, and reviewing the culling.
Labels:
Unreal Engine
Monday, 10 December 2018
Game - Adding Controller Input
In my Unreal game, I was interested in adding custom controller input. This is because I enjoy giving players an option of which controller method to use - keyboard and mouse, or controller.
Input methods supported in Unreal:
Within Unreal, the software allows you to use keyboard and mouse input for the player input for PC games, but the software also allows you to add input for PC controllers, touch-screen (for mobile and tablet games), console controllers (Steam, Xbox and Playstation), and Virtual Headsets.
How to add a custom input:
To adjust the input to the game, I went to the Project Settings under the Edit menu toolbar. Scroll down on the left to find Input under the Engine header.
In the Bindings section at the top, there is a series of arrays containing to map input keys and input axis's. Under Action Mappings, there are a series of pre-existing action keys for Jump, Fire and ResetVR.

I wanted to add a new action to allow the player to reload. I added a new item under the Action Mapping array, which I titled 'Reload'. I added two different input methods - the keyboard key R and the left face button on the controller (usually known as X on Xbox controllers and Square on Playstation controllers).
Blueprint code (right-click and drag):
In the above Blueprint class, I have demonstrated how I previously got the player to reload, and how I ended up getting the player to reload. Previously, I relied on the player reloading with just the R key, but now they can use the special Reload input mapping, which works with R and the left face controller button.
In conclusion, I am happy that I have been able to add controller input, as I enjoy trying to make my games work on different input types, and it could give players a different experience with using the controller.
Input methods supported in Unreal:
Within Unreal, the software allows you to use keyboard and mouse input for the player input for PC games, but the software also allows you to add input for PC controllers, touch-screen (for mobile and tablet games), console controllers (Steam, Xbox and Playstation), and Virtual Headsets.
How to add a custom input:
To adjust the input to the game, I went to the Project Settings under the Edit menu toolbar. Scroll down on the left to find Input under the Engine header.
In the Bindings section at the top, there is a series of arrays containing to map input keys and input axis's. Under Action Mappings, there are a series of pre-existing action keys for Jump, Fire and ResetVR.
I wanted to add a new action to allow the player to reload. I added a new item under the Action Mapping array, which I titled 'Reload'. I added two different input methods - the keyboard key R and the left face button on the controller (usually known as X on Xbox controllers and Square on Playstation controllers).
Blueprint code (right-click and drag):
In the above Blueprint class, I have demonstrated how I previously got the player to reload, and how I ended up getting the player to reload. Previously, I relied on the player reloading with just the R key, but now they can use the special Reload input mapping, which works with R and the left face controller button.
In conclusion, I am happy that I have been able to add controller input, as I enjoy trying to make my games work on different input types, and it could give players a different experience with using the controller.
Labels:
Game,
Unreal Engine
Game - Importing my model into Unreal
After completing my model of a weapon, I needed to export it out of Maya and import it into Unreal.
Step 1: Exporting out of Maya:
Before exporting the model, I was required to group and combine the objects together, to allow the model to import as a single item.
I used my mouse to select all of the items in the scene, which I wanted to export. I used the Combine tool, under the Mesh toolbar menu, which joined all of my gun model items together. This allowed me to have a single object to import into Unreal, as opposed to different polygons and shapes. I was also able to use the Split tool (also under the Mesh toolbar menu), which forced the model to be broken back into the individual components.
To export the model out of my weapon, I used the Game Exporter plugin, a tool recommended to me by my lecturer. To find the tool, I went to 'Game Exporter' under the File toolbar menu, as seen below.
This will show a popup box, which allows you to adjust numerous settings, such as exporting specific parts of a Maya scene, smoothing edges and polygon subdivisions, adjusting parts of an animation, or adjusting the output file (changing the file path, or fbx version). I did not feel the need to change any settings, so I just kept this the same.
Step 2: Importing into Unreal:
To import the model into Unreal, I use the Import into Levels feature under the File toolbar menu. I felt this was a suitable option, instead of dragging it into the assets, as Unreal would be able to process the file correctly.
Step 1: Exporting out of Maya:
Before exporting the model, I was required to group and combine the objects together, to allow the model to import as a single item.
I used my mouse to select all of the items in the scene, which I wanted to export. I used the Combine tool, under the Mesh toolbar menu, which joined all of my gun model items together. This allowed me to have a single object to import into Unreal, as opposed to different polygons and shapes. I was also able to use the Split tool (also under the Mesh toolbar menu), which forced the model to be broken back into the individual components.
To export the model out of my weapon, I used the Game Exporter plugin, a tool recommended to me by my lecturer. To find the tool, I went to 'Game Exporter' under the File toolbar menu, as seen below.
This will show a popup box, which allows you to adjust numerous settings, such as exporting specific parts of a Maya scene, smoothing edges and polygon subdivisions, adjusting parts of an animation, or adjusting the output file (changing the file path, or fbx version). I did not feel the need to change any settings, so I just kept this the same.
Step 2: Importing into Unreal:
To import the model into Unreal, I use the Import into Levels feature under the File toolbar menu. I felt this was a suitable option, instead of dragging it into the assets, as Unreal would be able to process the file correctly.
I chose a location to save the file to, within my Unreal assets folder.
A window popped up which allowed me to review what would be imported into my project. I could use this to adjust what parts of the model are imported, such as mesh shapes or materials . After clicking 'Import' at the lower right of the box, my model was imported into the project.
To add the model onto my player, I opened up the First Person Character window, in the viewport model. I removed the existing gun models on the scene, and added my model in the place.
Final model viewed in Unreal:
Labels:
Game,
Unreal Engine
Sunday, 9 December 2018
Game - Shooting enemy turrets
In my Unreal game, I wanted to add a series of enemy targets to shoot at the player. I decided to add these turrets into the game, as it adds a challenge for the player to overcome, and I feel it adds an element of enjoyment and fun.
The enemy turrets are static gameobjects, which perform a series of mechanics using the Sequence function.
Enemy Model:
The enemy model was taken from the Unreal FPS template kit. It is a built in object which felt like a turret-like model. I added a custom red material onto this component to give it a distinct look. The red color was used, as it usually represents a negative connotation.
How the code works:
The Blueprint class works around the On See Pawn (PawnSensing) event, and runs the exact same as the enemy boss class.
If the player is within a close proximity of the enemy turret, then the enemy turret sets the look rotation (using FindLookAtRotation, starting at the turret's location with GetActorLocation, and targets the new rotation to be towards the player's location with GetActorLocation).
To fire the projectile, the Blueprint checks a custom boolean variable (SpawnProjectile) to see if a projectile can be spawned. If not, a projectile will be spawned (SpawnActor), and an impulse (AddImpulse) towards the forward vector (GetForwardVector) multiplied by a large speed will fire it. It will then set the boolean to false and add a delay (Delay).
Just like the boss, the boolean acts as a cool down mechanic to avoid an overload of projectiles to be fired. If there was an large number of projectiles in the scene, it would cause the game to lag, and make it difficult to play.
The boss enemy class extends on this mechanic to perform the movement, which is something I did not plan to include on this.
About PawnSensing:
PawnSensing is a feature within UE4 which allows an actor to use logic to understand the movement of other actors. This is a feature which is a good way to add an AI which could perform a mechanic, such as movement.
PawnSensing can be added as a component onto a game object. It will add a series of lines and shapes onto the viewport of the affected actor. The green shapes in the image below show the 'eyes' or area which the actor will look to find other actors - the distance and radius of this can be adjusted at the developer's preference.
The developer can change different features such as checking for only player-controlled actors (which I have set to true, to avoid enemies interacting with each other) and listening for footstep sounds.
There is a similar feature called AI Perception, which is a newer feature which allows for sensing of actors in the scene.
Blueprint code (right-click and drag):
What I have learnt:
In this mechanic, I was happy to be able to utilize a built-in Pawn Sensing method which I have not encountered within Unity. I found this method to make it easier to add add logic to the enemy characters, and I would happily use the PawnSensing mechanic in the future again. I have been able to understand the PawnSensing mechanic, which I have described above.
During development, I was experiencing an issue relating to the shooting of the projectiles from the enemy point of view, which gave me the error below:
FirstPersonProjectile_C_0.Sphere FirstPersonProjectileMesh has to have 'Simulate Physics' enabled if you'd like to AddImpulse.
The enemy turrets are static gameobjects, which perform a series of mechanics using the Sequence function.
- Rotates to face the player
- Shoots projectiles in the player's direction
Enemy Model:
The enemy model was taken from the Unreal FPS template kit. It is a built in object which felt like a turret-like model. I added a custom red material onto this component to give it a distinct look. The red color was used, as it usually represents a negative connotation.
How the code works:
The Blueprint class works around the On See Pawn (PawnSensing) event, and runs the exact same as the enemy boss class.
If the player is within a close proximity of the enemy turret, then the enemy turret sets the look rotation (using FindLookAtRotation, starting at the turret's location with GetActorLocation, and targets the new rotation to be towards the player's location with GetActorLocation).
To fire the projectile, the Blueprint checks a custom boolean variable (SpawnProjectile) to see if a projectile can be spawned. If not, a projectile will be spawned (SpawnActor), and an impulse (AddImpulse) towards the forward vector (GetForwardVector) multiplied by a large speed will fire it. It will then set the boolean to false and add a delay (Delay).
Just like the boss, the boolean acts as a cool down mechanic to avoid an overload of projectiles to be fired. If there was an large number of projectiles in the scene, it would cause the game to lag, and make it difficult to play.
The boss enemy class extends on this mechanic to perform the movement, which is something I did not plan to include on this.
About PawnSensing:
PawnSensing is a feature within UE4 which allows an actor to use logic to understand the movement of other actors. This is a feature which is a good way to add an AI which could perform a mechanic, such as movement.
PawnSensing can be added as a component onto a game object. It will add a series of lines and shapes onto the viewport of the affected actor. The green shapes in the image below show the 'eyes' or area which the actor will look to find other actors - the distance and radius of this can be adjusted at the developer's preference.
The developer can change different features such as checking for only player-controlled actors (which I have set to true, to avoid enemies interacting with each other) and listening for footstep sounds.
There is a similar feature called AI Perception, which is a newer feature which allows for sensing of actors in the scene.
Blueprint code (right-click and drag):
What I have learnt:
In this mechanic, I was happy to be able to utilize a built-in Pawn Sensing method which I have not encountered within Unity. I found this method to make it easier to add add logic to the enemy characters, and I would happily use the PawnSensing mechanic in the future again. I have been able to understand the PawnSensing mechanic, which I have described above.
During development, I was experiencing an issue relating to the shooting of the projectiles from the enemy point of view, which gave me the error below:
FirstPersonProjectile_C_0.Sphere FirstPersonProjectileMesh has to have 'Simulate Physics' enabled if you'd like to AddImpulse.
To fix this, I was required to enable Simulate Physics on the Projectile game object details, and change the Collisions Preset to Ragdoll.
Labels:
Blueprint,
Game,
Unreal Engine
Game - Rotating target and door opening
In my Unreal game, I added a series of targets which the player would have to shoot to progress through the level.
I decided to add these targets into my game, because it adds an objective to help the player progress. In some of the commercial games which I researched, I noticed that this 'shooting a target' idea was used frequently, so players might expect this as a mechanic in the level.
How the code works:
I use two different classes during this process. I use the Level Blueprint to allow me to access the target game objects, and I use the individual target blueprints to run the Destroy event.
In the Target Blueprint class, I use an Event AnyDamage to check if the target has taken any damage. If so, then destroy itself (DestroyActor).
In the Level Blueprint, I use an Event Tick to add the rotation onto the targets. These targets are attached to a parent cube (which is an actor, to allow it to move). Each delta second of Event Tick will be multiplied by a rotation speed, changing the rotation on the Z-axis. This is then applied to the actor using AddActorLocalRotation. When the two targets are destroyed, I run the OnDestroyed event to run a custom function - OpenDoor.
The OpenDoor custom method will get the door which I choose to open, and change the object's position (SetActorLocation) and rotation (SetActorRotation).
Level Blueprint Code (use right-click and drag):
*Please note, the OnDestroyed methods in this class would link up to 'Target1' and 'Target2', instead of 'None'.
Target Blueprint Code:
OpenDoor custom method:
Final Mechanic:
What I have learnt:
I have been able to understand that you can use multiple blueprints to create one mechanic. In this mechanic, I used two different Blueprint classes, because I needed to access different game objects within the level, while also changing the state of the game objects (destroying them).
I was happy that I was able to make the targets rotate, as it helped add a bit of a challenge to the gameplay, instead of using a single static target.
If I did this in the future, I would attempt to change the custom method by creating one method, instead of creating two separate methods. I could do this by creating one method, and pass a series of parameters between them. I feel that this is bad coding practice to create two individual methods.
I decided to add these targets into my game, because it adds an objective to help the player progress. In some of the commercial games which I researched, I noticed that this 'shooting a target' idea was used frequently, so players might expect this as a mechanic in the level.
How the code works:
I use two different classes during this process. I use the Level Blueprint to allow me to access the target game objects, and I use the individual target blueprints to run the Destroy event.
In the Target Blueprint class, I use an Event AnyDamage to check if the target has taken any damage. If so, then destroy itself (DestroyActor).
In the Level Blueprint, I use an Event Tick to add the rotation onto the targets. These targets are attached to a parent cube (which is an actor, to allow it to move). Each delta second of Event Tick will be multiplied by a rotation speed, changing the rotation on the Z-axis. This is then applied to the actor using AddActorLocalRotation. When the two targets are destroyed, I run the OnDestroyed event to run a custom function - OpenDoor.
The OpenDoor custom method will get the door which I choose to open, and change the object's position (SetActorLocation) and rotation (SetActorRotation).
Level Blueprint Code (use right-click and drag):
*Please note, the OnDestroyed methods in this class would link up to 'Target1' and 'Target2', instead of 'None'.
Target Blueprint Code:
OpenDoor custom method:
Final Mechanic:
What I have learnt:
I have been able to understand that you can use multiple blueprints to create one mechanic. In this mechanic, I used two different Blueprint classes, because I needed to access different game objects within the level, while also changing the state of the game objects (destroying them).
I was happy that I was able to make the targets rotate, as it helped add a bit of a challenge to the gameplay, instead of using a single static target.
If I did this in the future, I would attempt to change the custom method by creating one method, instead of creating two separate methods. I could do this by creating one method, and pass a series of parameters between them. I feel that this is bad coding practice to create two individual methods.
Labels:
Blueprint,
Game,
Unreal Engine
Game - Static lasers which kill the player
In my Unreal game, I added a series of static lasers which would kill the player on collision. These were added in to allow the player to use the jumping and crouching mechanic in-game.
How the code works:
To detect the collision, the Blueprint class would use the Event ActorBeginOverlap. The code checks to see if the other actor is the player (OtherActor == GetPlayerController). It uses a Branch function to check if the condition is true. If so, the game will display a game over screen widget (Create Game Over Widget), add it to the viewport (Add To Viewport), display the mouse course (Set ShowMouseCursor to false) and disable the input (Disable Input). We will also play a sound to confirm that the player has died, with Play Sound2D.
Blueprint Code (use right-click and drag):
Final laser:
How the code works:
To detect the collision, the Blueprint class would use the Event ActorBeginOverlap. The code checks to see if the other actor is the player (OtherActor == GetPlayerController). It uses a Branch function to check if the condition is true. If so, the game will display a game over screen widget (Create Game Over Widget), add it to the viewport (Add To Viewport), display the mouse course (Set ShowMouseCursor to false) and disable the input (Disable Input). We will also play a sound to confirm that the player has died, with Play Sound2D.
Blueprint Code (use right-click and drag):
Final laser:
What I have learnt:
From this mechanic, I have been able to produce a basic collision detection set up, which I could copy in other different mechanics in Unreal games. In comparison to Unity, this feels easier to access to check collisions to the player, as 'Get Player Controller' exists. This is a method which Unreal does not specifically have for the player.
I was happy with the outcome of this, because it felt simple to set up, and it gave me the result which I wanted.
Labels:
Blueprint,
Game,
Unreal Engine
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: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.
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.
Labels:
Game,
Unreal Engine
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.
Labels:
Game,
Unreal Engine
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.
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.
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.
Labels:
Game,
Issues,
Unreal Engine
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.
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.
Labels:
Blueprint,
Game,
Unreal Engine
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.
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.
Labels:
Blueprint,
Game,
Unreal Engine
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).
Labels:
Game,
Unreal Engine
Monday, 24 September 2018
Unreal Engine - Opening impressions
In this first blog post, I will be giving my first thoughts and impressions on the Unreal Engine.
We have been asked to use Unreal Engine as part of our System Modelling module in my second year. This was the first time which I ever experienced the Unreal Engine, after previously using Unity in my first year at university. I was aware that Unreal existed, but I never used it before. I have setup a scene in Unreal which uses the First Person Blueprint template, and will be experimenting with the features.
Positives:
I like the fact that you can move the camera's position in the scene view with the mouse and keyboard: I find it easier to control the camera's position and look rotation.
I appreciate some of the popups which show in the bottom-right of the screen, such as when you 'undo' a change. This makes it much clearer, for if you are trying to fix a specific change not fully clear (e.g. changing a game object's position by a few pixels). This is a feature which I've not seen in Unity.
Negatives:
I experimented with changing a game object's position. I moved a grey cube, which gave me an error saying that 'Lighting needs to be rebuilt'. To fix this, I found a method which involved 'rebuilding' the lighting.
This process took a few seconds to rebuild, but it fixed the lighting. However, if I perform this action when I always move a game object might add use up more time. In comparison to Unity, this is a much slower process, as lighting automatically refreshes in Unity.
From experience in Unity, I enjoyed being able to play the game in one window, and have a live scene view in an alternate window/tab. I've been unable to find this feature here, so I would not be able to test different camera viewpoints, unless I change the player's position/rotation.
I feel like I will learn more about Unreal throughout the semester, and I may continue to draw comparsions with Unity.
We have been asked to use Unreal Engine as part of our System Modelling module in my second year. This was the first time which I ever experienced the Unreal Engine, after previously using Unity in my first year at university. I was aware that Unreal existed, but I never used it before. I have setup a scene in Unreal which uses the First Person Blueprint template, and will be experimenting with the features.
Positives:
I like the fact that you can move the camera's position in the scene view with the mouse and keyboard: I find it easier to control the camera's position and look rotation.
I appreciate some of the popups which show in the bottom-right of the screen, such as when you 'undo' a change. This makes it much clearer, for if you are trying to fix a specific change not fully clear (e.g. changing a game object's position by a few pixels). This is a feature which I've not seen in Unity.
| An example of a pop-up notification. |
Negatives:
I experimented with changing a game object's position. I moved a grey cube, which gave me an error saying that 'Lighting needs to be rebuilt'. To fix this, I found a method which involved 'rebuilding' the lighting.
| The menu option to fix the 'build lighting' in the scene. |
This process took a few seconds to rebuild, but it fixed the lighting. However, if I perform this action when I always move a game object might add use up more time. In comparison to Unity, this is a much slower process, as lighting automatically refreshes in Unity.
From experience in Unity, I enjoyed being able to play the game in one window, and have a live scene view in an alternate window/tab. I've been unable to find this feature here, so I would not be able to test different camera viewpoints, unless I change the player's position/rotation.
I feel like I will learn more about Unreal throughout the semester, and I may continue to draw comparsions with Unity.
Labels:
Unreal Engine
Subscribe to:
Posts (Atom)