Thursday 13 December 2018

Assignment hand in day

It's finally come to the last night of working on my project and making sure everything is as good as it can be, and included. I do keep looking at my game and thinking about things I wanted to add, but simply run out of time. It was a bit of a nightmare trying to get my discs burned in the early hours of this morning. I realised the DVD drive on my laptop was no longer being recognised, another problem to sort out later, but I had my desktop I could use instead. Next the files wouldn't copy over to the desktop, seriously it crashed 3 times! Then, when I did get a disc burnt, it hadn't burnt all the files! Why did it say it was complete? In the end, I FINALLY got two discs burned, and they worked (I also made sure they worked on the university computers). 

I have enjoyed working with Unreal, you can get some nice results fairly quick using the blueprint system. It also makes things a little clearer on how different components are working with each other through the nodes, compared to Unity. I would have liked more time to work on the final game though, I feel I did waste too much time with my first attempt that I later abandoned. I did learn quite a lot from working on it, and it did make it easier to produce a second game in such a short time.

Maya is both enjoyable and frustrating in equal measures. I found modelling to be very time consuming, and getting the smaller details in could be quite tricky. I do feel that I have become more proficient the more I have used it, making less mistakes, and relying less on reverting to back ups. I would definitely recommend making plenty of back up copies of your work though, especially when starting out. I did spend more time working in Unreal, but I could of easily spent just as much working in Maya.

The blog. I do actually think its a really good idea to write a blog throughout rather than just writing a report at the end. It does take a bit of time to get used to writing about the process of creating part of the game or model as you go though, hence my blog improving over time. I was going to go back and edit the posts, but its more of true reflection of how my skills and confidence progressed over the semester as it is. I must admit though, when I was frustrated with something not working, or something took a really long time, the last thing I wanted to do was write about it. Also, sometimes I would have to recreate my actions in order to take screenshots, which sometimes made blog posts take longer than actually working on that particular aspect of the game.

Overall, I have enjoyed the module and working in both Unreal and Maya. I've learnt a lot in a short amount of time, and thinking about what else I could create with them in the future is an exciting prospect. Gary and Dominic have been excellent throughout the semester, and have made understanding the tools and software a lot easier with their support. I'm tired now (unsurprisingly), but I'm already looking forward to what we'll be producing in the next semester! 

Unreal: Addng a pause screen

The Next feature to add was a pause menu. I used a couple Virtus's YouTube videos for reference on the nodes that I should use, but generally a lot of the blueprint functionality is similar to what I've used previously. I will go through steps involved in getting it working.

Firstly, a key binding needs to be created, basically setting up an input that will do something in the game. To do this, go to Edit > Project Settings. Scroll down the list on the left until you find the 'Input' option. Now click on Bindings > Action Mappings and hit the '+' to create a new one, I called mine Pause. Next you need to select what key (or controller button) will pause the game, I used the escape button as it generally is the pause key in most games.


Now right click in the content bowser, select User Interface and create a new widget blueprint, name and open it. From the Palette on the left, drag and drop in two buttons, these will be the pause and quit buttons, you can rename the buttons in the details panel on the right or the Hierarchy panel on the left. To finish the buttons off, drag and drop 'Text' from the palette on to the buttons, and enter appropriate names in the details panel and press compile.



Next open the First Person Character blueprint, or whatever is the main character blueprint you are using. Go to the Event Graph tab and find a space to create new nodes. First we need to call an event when the escape key is pressed > a branch is needed to check a Boolean variable, because we only want to have one instance of the pause menu open. If the Boolean is false > we move to create widget, with the class set to the pause menu widget > now we add the widget to the viewport (screen) > as the pause menu is now open, the pause variable needs to be set to true > the game is now set to paused > finally the mouse pointer is set to visible, the target is the Player Controller. Click compile.



Now we just need to add some functionality to the those buttons. Return back to the pause menu blueprint and select 'Graph' in the top right corner. On the right you'll notice that buttons you created now appear as variables. Select the quit button, and scroll down to events and add the on the click event. A new node will appear 'OnClicked(Quit)', we just need this to return to the start screen (or quit the game). 



Next is the resume button. From the clicked on event > game paused is set to false > the pause screen widget is removed > we need to cast to the first person character to gain access to the pause active variable > and set the mouse pointer to false. The last step is to make the pause menu close with the escape key. Starting from Event Tick > we add in a slight delay > this leads to branch which is checking every 0.2 of a second if the escape is being pressed > if it is, game paused is set to false.



Gun Model: From Maya to Unreal

After the test run of importing the barrel into Unreal, it was time to give importing my gun model ago. Most of the steps were similar to what I have explained in my previous post, the only extra step I carried out in Maya was to combine the separate components of the model into one mesh. This was done by selecting everything (right mouse button > select all) and then going to the Mesh tab > Combine. The Model was now ready for exporting to Unreal.



The next step was importing into Unreal. As I wanted the gun to be carried by the first person character, I would need to import the gun as a skeletal mesh. This is done by selecting the skeletal mesh check box in the import options. The skeleton should be set to none, this will force the engine to generate a new one for the model.


The gun model was now in the game, complete with textures, now to get it to actually work. Although I have set up a gun from scratch in my previously disbanded project, the easiest way to get it working quickly is to exchange the existing gun model for the newly imported one. Firstly, you need to find the first person character's skeleton, this is fact just a pair of arms. Once opened in the editor, you should see a list on the left that contains of all the bones that the skeleton consists of. Scroll down the list until you find one called 'GripPoint', this is not a bone but a socket on the skeleton where an another object can be attached. This one already exists as its where the default gun is held. You can use this one, but I duplicated it so I can easily revert to the default gun if needed. Now right click on the newly created socket and select 'Add Preview Asset'. A box with all your available assets will appear, just find your gun and it will appear in the right hand.


At this point the gun may look like its being held strange, or too big/small, this can be changed in a moment. First you need to change the skeleton to a more natural in game pose, such as an idle position. This done through the 'Preview Scene Set' on the right. Change the 'Preview Controller' to 'Use Specific Animation' and then select the idle animation. You should now see the skeleton in much more natural position. Select the socket you created again, now you can adjust the scale and position of the gun until you are happy with it.


After you are happy with how the gun looks, hit save and then close. Next, go to the first person character blueprint and then select the viewport tab. In the components list (top left), find the one called 'FP_Gun'. The details panel on the right will have the default gun as the skeletal mesh, change this to your gun. Don't worry if it looks strange again, or the size has changed, this will be fine in a moment. Now go to the construction script tab and you should see an 'AttachToComponent' node, change the socket name to the one you created on the skeleton, make sure it is spelt correctly! If you go back to the view port you should now see the gun being held as you intended.


The last step is adjust where the bullets are spawned from for your gun. You should notice there is a sphere component as a child of the 'FP_Gun', this is the location that bullets will be spawned at, so just line this up with the muzzle of your gun and now you should have a gun that fires projectiles. I also added a point light to my gun, as my Halo assault rifle has a flashlight mounted on the front.

Wednesday 12 December 2018

Creating a flamming barrel - from Maya to Unreal

I decided that I would try and create a simple flaming barrel to add to my game level, just using what I had learnt so far, and a test run before importing my gun model into Unreal.

Firstly, in Maya 2017, I went to the create tab > polygon primitives and turned interactive creation on. Next, I selected the pipe shape from the polygon shelf, and dragged out the base, height and thickness to create a barrel type shape.



Now I wanted to add a little detail, and metal barrels generally have several ringed ridges. To do this, I added in several edge loops (mesh tools > insert edge loop) by clicking on an edge and dragging the loop into place. Six edge loops were created to make three bands, I then selected face mode and selected all the faces in each band, next I used extrude (Ctrl+E) to pull these faces out slightly. Lastly, I used the bevel tool (edit mesh > bevel) to round the extruded faces.


I just needed to give the barrel a base now, this was done by adding another edge loop on the inside bottom of the barrel. I selected the newly created faces, and went to edit mesh > merge to centre to form the bottom of the barrel. Now the shape was finished, I wanted to add a material. Holding the right mouse button and selecting object mode, I had my barrel selected with a green outline. Pressing the right mouse button again, I now selected assign new material. There are various material types available that represent different material effects, I wanted a metal finish, so I chose blinn. This brings a panel up on the right of the screen where various material attributes can be set. I set the colour to a darkish red, and turned down the reflectivity. My barrel model was now complete.


 The last step in Maya was to export my model for use in Unreal. Before exporting, I went to edit > delete all by type > history to reduce any risk of errors. With my model selected, I then went to file > send to Unreal > selection, and I chose the directory where my Unreal project was located. Next was the export selection settings. I made sure the file type was to FBX export, and importantly for exporting models with materials, I checked the box for embed media in the options. You can also check geometry > smoothing groups to stop Unreal throwing a warning when importing, but found it makes no real difference if I didn't.



Moving into Unreal, I used the import button in the content browser to find my barrel in the import folder, it imported the model and material fine. Next, I created an actor blueprint called 'flaming barrel'. I added a static mesh component and selected the barrel model in the details panel. The model was small, so I scaled it up a little (R). I then added a particle system component, and added the 'P_fire' effect from the engine starter content.



The model was now ready to add to the level. I decided to duplicate it a couple of times, and have a group of three in the corner. I added a point light with an orange glow to give it a little more atmosphere. The finishing touch was a sound effect, this again came from the starter content. I wanted the sound to only play when the player was close to the barrels, to do this I used sound attenuation. This allows a sound to activate and play at different volumes depending on how close the player is to the source. This was achieved by adding the sound directly to where the barrels were, then in the details panel for the sound, override attenuation must be checked. Finally, to adjust the distance the sound travels, the falloff distance can be adjusted, and is represented by a sphere in the editor window.




I'm quite pleased with the overall effect this adds to the game, it just adds to the atmosphere. It was also it was fairly quick to do, in fact it took less time than this blog post!



Monday 10 December 2018

Unreal: Adding a main menu

I've now added a main menu to the game, and although it was a fairly straightforward task, I wasted a few hours trying to achieve something more complex. My main issue was with the in game HUD either always displaying, or not at all. I think I know what I was doing wrong now, but I've stuck with a more simple solution. I used a YouTube tutorial for guidance.



Firstly, I created a new level and a new game mode for the menu. After opening up the menu level, I went to the window tab to gain access to the world settings, from here I could change the game mode override setting for the level to the menu game mode I hade just created.



The next step was to create a user interface widget blueprint, this is essentially where the menu lives. I kept it simple this time, black screen with buttons anchored to the bottom left. I created buttons for 'Play', 'Options' and 'Quit'. Further buttons for resolution settings were created for the options screen.



Visibility bindings were created for both the menu buttons and the option screen buttons, with an Eslate visibility variable allowing an easy transition between them.



The last step was to create On Click Events for each of the buttons. The play button simply opens the selected level, similarly, the quit button just exits the game. The options and return buttons toggle the visibility variables for the associated buttons. Finally, the resolution buttons allow the game to be played in 1080, 720 or 480. This is achieved through Execute Console Command node, and scales resolution accordingly. An example command for changing the resolution is 'r.setres 1920x1080f'. The 'f' is added to display in full screen, where as a 'w' would set a windowed screen.



Although its fairly simple to create a menu screen when you know how, I do think its a little long winded to have to create a separate game mode. Maybe there is another way to do this, but from my research it appears to be the most common solution.      


Tuesday 4 December 2018

Adding atmospheric fog

This is only going to be a short post, as I've just spent the last few hours adding an atmospheric fog effect to the game and adjusting it until I was happy. The process of adding the effect is quite tricky to explain, and better to watch. I used a series of 3 YouTube videos to learn how to create the effect. The fog itself is a particle system, which can react to player (as well as enemy if desired) movement. Overall, I'm really pleased with the visual effect Its added to the game.


Monday 3 December 2018

Fixing new problems

I always find when I add something new, it generally causes more issues to fix. So, I realised that after adding the death animation, the zombies continued to follow the player, even though they were dead. I tried to add a condition in the AI behaviour blueprint, however this didn't work. Again, I found the solution on the Unreal Forums. I needed to use the node "detach from controller pending destroy", this would remove any AI control from the zombie. This caused another problem! Now the radar enemy icon was appearing in game after it was detached from the controller, it didn't take me long to realise I could use the "Set Visibility" node to hide the icon after I detached the controller.


Adding a death animation

Currently the zombies were just disappearing after their was depleted, so I wanted to add a death animation to play before they eventually vanished. Mixamo had a couple of good animations, so I downloaded one and added it to my project. The first thing I had to was to create a condition for the animation to play. This was done by creating a Boolean variable in the AI Character blueprint, which set true after the zombie health reached zero.


The next step is to add a new animation state to the zombie animation blueprint. The death animation will need to transition from both the idle and run/walk animations, but for obvious reasons not back again.




Now a link to the IsDead variable is needed in the animation blueprint. This is achieved by casting to the AI character from the event graph and getting a reference to the variable, this is then used to set a new variable, also called IsDead, in the animation blueprint.


The final step is to set up the transition links from idle and walk/run. This simply tells the game to play the animation when the condition becomes true.



If you remember,I said there was more than one death animation to choose from, but how could I pay a random animation? My first though was to use a random integer from inside the Die state, except you are unable to access the branch node. I found the solution on the Unreal Engine forums, I need to use a node called Random Sequence Player. This node allows you to create an array of animations, one of which will play at random when the transition is called. 




Tuesday 27 November 2018

Blood Splatter Effect


Today, I decided to replace the explosive particle effect I had on the bullet impact for a more effective blood effect. I found a good tutorial on YouTube by Dean Ashford. It would need to be modified to fit my project, but gave me general direction I needed to create the effect, plus some assets. I thought this would be quite an easy effect to achieve, but 3 and a half hours later, I can say it wasn't. 

The actually blood emitting from the zombies was the first problem. I only wanted the blood effect from the zombies, and not everything the projectiles hit. I got this working fairly quickly, the only problem was the game was generating a lot of errors now. I wasn't happy, and needed to rethink my approach. The way around this turned out to be to relocate the Spawn Emitter to the AI Character Blue Print. It seems obvious now, but it was originally in the First Person Character BP and linked to the Ray Tracing.

The second problem, and the one that caused the most headaches was the blood decals that should generate on particle collision, they simply refuse to work. The logic of the blue print is sound, and I've change and modified so many settings, but to no avail. In the end I saw a brief comment on a YouTube page that mentioned freezing the particles on impact, and this worked! It doesn't look quite as good as I wanted, maybe I can modify some settings further, I'm just glad it's working right now. 

Monday 26 November 2018

Minimap/Radar

My first attempt at making a game featured a mini-map in the corner of the screen. It was a little redundant, simply showing an orthographic view of the level from a second camera mounted above the players head. This camera was then fed to a Render Target, through the use of the Scene Capture Component 2D. Finally, the Render Target is turned into a material which can be added to the players View Port.

The mini-map in the shooting range
game. The arrow in the middle was just an
image on top of the map. A blue tint was also added.


For my new game, I wanted less of a map, and more of a radar which could show enemy positions in relation to the player. I found a useful tutorial about creating a simple mini-map on YouTube. I had previously used a second camera to track the player, however this tutorial suggested using a component called a Spring Arm. The Spring Arm essential works like a camera boom, allowing you to attach components to the end of it, which then translate the players movements, offset by the length of the Spring Arm. In this case, it translates the players position to the Target Render. The player position is then indicated on the Target Render by a arrow icon, which is hidden from the players main view. The tutorial also explained how to hide elements of the level being rendered on the map, using the details panel on Scene Capture 2D Component. I decided to hide everything, apart from the icon representing the player, to create something more akin to a radar.

The new mini-map works more like a 
radar, displaying the player and enemy icons only.


The last problem I faced was getting the enemy icons displayed on the radar, this was not part of the tutorial. At first I thought reverse engineering the same technique I had used to display the player icon on the map/radar, but not the main scene. This didn't work, as the AI character was the owner, and was only hidden for that actor. I thought there must be a way to do this through Blue Prints, and then I stumbled across the Set Owner No See node, this allowed me to change the owner of the Sprite icon attached to the AI character to the player character, therefore it would now only show on the radar.

This Blue Print allowed me to change the only of the
Enemy Sprite to the Player Character.
  

Thursday 22 November 2018

Mistakes Were Made...

At the end of week 8, my unreal project was going ok, but progress was slowing down and I was no longer enjoying working on it. After speaking to a friend about it, I realised I had made a big mistake. In the assessment information, it stated that the player must remain in the '"arena" boundary walls of the first person template. I had been working in the third person template, but had modified it to first person (this was so I could get a complete character model), but I had also developed my level way outside of the arena boundaries, which was the main problem. So, last weekend I had a choice, either significantly rework my level, or start a new project.



Since my game didn't seem to be progressing how I wanted, I made the decision to start again from scratch. I needed a basic idea that I was going to be able to get working quickly. I decided an arcade style survival game might be a good idea, and with the help of a short tutorial series on You Tube, I had a basic game working by the end of the weekend which I could build upon.

I quickly replaced the primitive shapes with the mannequin from the third person template. I set up the animation states, and it was already becoming quite a fun little game. I used a lot of what I had previously had learnt to add more features. Although the mannequin was a fine target, their was limited animations, and I really wanted to put some actual zombie character models into the game. I had a quick look on the asset store, but wasn't really impressed with what was on offer. This is when I discovered Mixamo for the first time!


Mixamo is website offered by Adobe, it allows users to download a selection of models and animations for free. It also allows you to upload your own humanoid character and apply animations to it. Although I had heard of Mixamo before, I had never used it. The site offered a large selection of zombie character models and animations, perfect for what I wanted. It also allows you to preview all the characters with different animations applied, and various adjustments to speed, frame rate and other variables before downloading.



After finding a model I liked, I download it, along with idle, walk and run animations to begin with. The model and animations were quickly imported into Unreal, and I used what I had to learnt to create an Animation Blend Space. This is basically a blueprint that allows a model to transition between various animation states depending on a condition, in this case, character velocity. When I first replaced the mannequin with the zombie character, the animation seemed very jerky, I quickly realised that when I downloaded the animations, there was option to animate "In Place" which I needed to check. After that, it was getting the speed right, and they started to look really good. I've been really impressed with the Mixamo site, and plan to add some other zombie characters and animation to the game from there.


Even though it was very late in the semester, I think restarting the project was a good move. Although the shooting range/training game was a solid idea, it wasn't developing how I wanted. I was having issues, my ideas were not always working, I wasn't enjoying developing it and the game just wasn't fun. Although this game is quite a simple idea, it can be built upon, and even as it is, its fun to play.





Saturday 10 November 2018

Maya: Polygon components

When creating a 3D primitive shape in Maya, you can divide the shape into subdivisions. This can be done by selecting the shapes tab in the Channel Box/Layer Editor side menu, from here you can enter the subdivisions for width, depth and height. In this case I have divided the shape into 3 subdivisions for each.



Another way to add subdivisions to a shape, is through the Edit Mesh drop down menu, from here select the Add Divisions option to achieve similar results.



Holding down the right mouse button allows you to have access to various components of the shape. Mostly i'll be working faces, edges and vertices. Below, I have selected face mode, and have used it to extrude certain faces from the shape by pulling them with move (W) . The extrude option is available through the Edit Mesh drop down menu, or by pressing Ctrl+E.



As with most design programs, its possible to duplicate objects by selecting the option in the edit menu or Ctrl+D. You could also use the mirror tool in the mesh menu to make a mirror copy of an object.

Friday 9 November 2018

Maya: Ship Wheel - Tools and Process

On Canvas, there is a selection of worksheets Gary has created to teach the basics of Maya, and helpful tools and techniques we should be using when creating our gun models. I began with low polygon house model, and now this ship steering wheel.

I firstly began by adding a cylinder primitive from the polygons tab. I adjusted the scale (R) to an appropriate size, and then duplicated (Ctrl+D) the cylinder, which I scaled down slightly further. I then used the Booleans tool, which can be found in the Mesh tab. I used the Difference option which allows you to subtract one object from another, in this case, the smaller cylinder from the larger one.

The Boolean tool allows various options, the Difference option
allows one object to be removed from another... 

leaving me with the outside rim of the wheel.
After adding another cylinder for the central hub, I used the Live Snapping tool to have objects snap into place along a grid, to create the spokes and handles of the wheel.


The finished ship wheel.


Thursday 8 November 2018

Working with Maya

In Wednesdays lecture, Gary introduced us to working with Maya. Maya is 3D modelling and animation software, developed by Autodesk. It has become the become the standard in the video game industry, and is widely used in variety of other entertainment mediums. 
Gary gave a brief explanation of the interface, before creating a simple model of a Star Destroyer.

After the lecture, I began working with Maya almost instantly. This was the first time I had used the software, and although I have used Blender for 3D modelling before, it was all very new. I decided to work through the small tutorial first, which had been uploaded to canvas and was recommended to start with. The tutorial guiding through the process of creating a simple house, learning techniques such extruding, offset, dividing faces and connecting edges and vertices.

  
Because I need to model a gun for the assignment, and its a vastly more complex shape than a house, I decided to check You Tube for a weapon modelling guide. Although there weren't as many as I was expecting, I did find one based on a Glock 19 handgun. I found the videos a little difficult to follow as not everything was fully explained, but I still manage to learn some techniques that will certainly be useful.


I used a reference image of the Glock as a guide for the dimensions, and the entire model was extruded from a single cube. Probably the most important skill I have learnt from the tutorial was the use of edge loops. These essentially make it possible to create a complex model from a simple shape.


As you can see from the image above, I have got to point of adding some detail to the model. Using techniques such as splitting the model, and bevelling edges. I also realised that I had some how manage to use far too many edge loops and was having serious problems with vertices and edges overlapping each other. I tried using target weld to eliminate some of the extra vertices, but that lead to further difficulties, such as holes in the model, lots of holes! I may leave this model here now, but it has been a good learning experience, and it has reminded me to save more often, as undo can only go so far back.



Wednesday 31 October 2018

Progress Update

Since my last post I've made some progress, although not as much as I would have liked to. I have constructed a simple shooting range using geometry within the editor, and created a shooting range target which appears randomly at every second at one of eight target points. I'm not sure why, but the hit detection on the target only works correctly if the mesh is of a certain size (for example a cube), this is something I can hopefully fix later.




Another problem I'm having is with timers. From the moment the trigger is activated, I would like a timer to deactivate the target spawning after 30 seconds. However, every way I have linked this into my blueprint, it has failed. Currently, a simple timer running off an event tick is stopping the targets from spawning after the allotted time, but this is not ideal as it starts as soon as the game does.




Finally, after shooting the targets, a door opens through Matinee animation. I thought this would be simple to implement, and it was once I knew what I was doing wrong, but for a while I was just asking "WHY ARE YOU NOT WORKING!".

Wednesday 24 October 2018

Target Spawning Array

With the help of a tutorial by Ben Ormstad, I was able to create a target spawning array using blueprint. The array takes several target points in a level, then using the 'Get' node, returns a random integer within the range of the array. This is passed on to the targets actor transform and it appears in the scene. I did have a problem with targets spawning on top of each other, but this was simply fixed by changing the collision handling override to 'Don't spawn if still colliding'.

Wednesday 17 October 2018

Transitioning From Tutorials To My Project



I've now been working my way through quite a few tutorials, and I've got an idea of how include some of the features of my game and feel like I can actually make a start on it. Because this is the first time I've attempted to actually create a game in Unreal, I wanted to see what I could actually achieve in the time frame, instead of having all these wild ideas with no clue of how to make them work in practice.

I believe I have enough knowledge begin work on FPS style training level, with pop up targets, time limit and score system. I've learnt how to implement, through blueprint,  weapons that work, as well as ammo systems and weapon change. Hit and damage detection, simple AI, objective system and a mini-map.

I have enjoyed working through these tutorials and working with Unreal so far. I'm find it easier than the Unity game project, as I can work out how the systems operate and whether I can can get them to work before planning it further. Where as with the Unity project, we have an idea, but are not always sure 100% how to make it work, or how to explain and plan the system out through diagrams before we start. I'm sure this gets easier with experience, but in general, we lack that experience at the moment.