Thursday, 29 October 2015

Sound Design: Audacity

Our design module has now changed from arts and modelling to covering sound design for a few weeks, which is something I personally think makes or breaks a game. Having the correct sounds in a scene can turn it into a piece of art if used correctly, for example a sad moment in a game will have a much more profound affect on the user if sad music and sound is played. Equally, a strong intense moment of game play will profit from fast paced/heavy music to empower the player.

For our introductory session we were taught about Audacity which can generate it's own sounds, or let you record some, then go on to add effects and edit them. To practice the software I created a selection of spot sounds and loops that could be used for a variety of situations. I had a few ideas of what to do for certain sounds so tried my best to create them first, other spot sounds simply occurred from recording a noise and fiddling around with effects, with the result actually being quite pleasing.


The first of my spot sounds took an auto generated, constant beep, which I broke down into segments to give a phone dial up tone. It isn't hugely impressive but it was the first thing I tried and it could be used for a phone call if ever needed.



The second sound was the result of me hitting my desk and playing around with a few settings. I found one called 'Paulstretch' which stretches out and echoes sounds to an almost eerie standard. The result of this made the slam on the table sound very distant, almost like a rock or object being kicked or dropped in a cave or dungeon.



Using the same 'Paulstretch' effect I recorded myself moaning and applied the effect to make a creepy distant groan. This reminded me of RPG games in dungeons with ambient creature noises and so I entitled the sound 'Ghosts'.


I attempted one more spot sound with 'Paulstretch' as the effect really intrigued me but I needed to have some variety in what I was making. I flicked a glass to make a high pitched ringing sound, then applied the affect and listened to the result. To me the sound is like a discovery noise for something dark or sinister such as a cave entrance or a dangerous scene.



Moving on to different sounds, I wanted to make a very simple light pick-up noise. I auto generated two pings of different pitches and attached them to roll from one into the other. The result sounded like an 80's style coin collection noise.



My final 2 spot sounds were very spacey/futuristic to me in the way that they sound like laser/teleportation noises.While different to each other I believe they could be used for teleport noises or at the very least, lasers.



For the loops, I had to create something that could replay nicely without people knowing when it had restarted. Unfortunately I can't make them loop from the links, but listening to them on SoundCloud allows you to loop it on there. I chose more generic sounds that would be played continuously in game or during a scene, as these are where loops come into play the most.

My first loop was a crackling fire which was actually just light rustling of a plastic bag. I didn't want the crackling to be too loud otherwise the affect would be unrealistic, so didn't normalise the track unlike with others where I needed the sounds louder.



Following on from fire I wanted to do another ambient sound, so decided to attempt a soft rustling wind. I simply blew past my mic for this one and then normalised it so it was easily audible and I think in a scene where the noise is just in the background it could be quite effective.



My final sound was an attempt at crunching leaves underfoot, which involved crumpling a piece of paper. In a loop the clip sounds quite good, however on it's own it isn't so effective, therefore it would sound much nicer in game than here on it's own.

Wednesday, 28 October 2015

Xbox Controllers

For my game I need to have different types of input so that two people can play the game at the same time. Obviously for a PC game I’m going to use the mouse and keyboard for one player, then for the other I’m going with an Xbox controller as it’s set up to work well in Unity. Setting the input axes for the controller has been quite simple and I think it’ll be easy to implement the controls into my final game.

To start with I wanted to add movement and look inputs. I discovered that the input manager is already configured to move the player with the left stick which saved me one job, however the right stick look controls needed to be implemented. I needed to create 2 new inputs called Controller look X/Y which were set to the 4th and 5th axis respectively. Upon playing the game, right stick caused the player to look around, although the Y axis was inverted so I simply checked the box the reverse it.
Two custom inputs

The other things I wanted to play around with was adding the ability to sprint, crouch and jump from the controller. I decided that the controls I wanted were: pressing in left stick (8 on diagram) would sprint, A (0) would jump and B (1) would crouch. Each of these were surprisingly easy as all I needed to do was add an OR condition to my if statements that check the corresponding action can be performed. This solution means that the player can move with either the keyboard and mouse or controller, so for my actual game I’ll need to add a check at the very start of the movement script to assign each player a single input type rather than the ability to use both.
Xbox controls map for reference in Unity

Monday, 26 October 2015

Leap Controllers

Using the Leap motion controller was definitely a new experience for me. It works by using infrared cameras and registering what objects appear in the way, rendering them into game objects. I personally don’t think I’ll be using them in my game but it was a fun experience and I had a few ideas about what they could be used for nonetheless. We were provided with a Unity project containing lots of different scenes that showed off the Leap’s uses and we were told to have a play around, getting use to this new tool.

The first scene simply showed the users hands and responded to you doing different things like clenching your fist, wiggling your fingers and moving them around. This scene is only to show how the Leap controller registers you, so doesn’t have much to do in it.
Simple hands scene

The next scene allowed me to interact with an object, in this case a flower. The flower grows in the centre of the screen allowing you to pick it and hold it. From there you can move it around to look at it and even pull off petals one at a time. This could be a little fiddly at times and the Leap can be a little temperamental, especially if something is covered from below so the Leap can’t see it entirely. However this was a nice little scene to show some basic interaction.
Scene showing how delicate the Leap can be

My favourite scene was where you had 6 little cubes that you could gently pick up and stack upon one another. Again the Leap could have slight problems of freaking out making it very difficult to stack all of the cubes, but as long as your hand wasn’t too near the tower you would be alright. This example of the ability to move objects around and place them down could be very useful in a two player platform game of some form. 
Tower stacking scene

The final scene was very enjoyable and contained a room full of boxes which the user can scoop up and throw about at will. This is more of an example of mass movement/control over a situation using the Leap. It was quite fun and relaxing to spend a minute or two throwing boxes around and watching them bounce off the walls for a while.
Messy block scene

Saturday, 24 October 2015

Tutorial and UI Flow

At this point in the design process we have our game mechanics pretty much figured out and everything is falling into place. The next step is figuring out what goes on outside of the main game, by which I mean we need to plan out the menu system the players will interact with. Having an amazing game is one thing, but if the player struggles to get into it then the experience of the game will be damaged.

Upon starting the game, the player will be shown the splash screen and then taken to the main menu screen. Here they’ll have 3 buttons they can press: play game, options and quit game. Clicking play game will first play the optional tutorial video, then take the players into the game. Upon finishing, the win screen is displayed and players can choose whether or not to go again. If they press yes the game restarts else, if no, both players are returned to the main menu.
The options menu gives players a choice of another 3 buttons: audio, video and controls. The audio option allows players to adjust the overall volume and the SFX volume. Video lets players adjust the brightness and resolution to suit their needs. Finally, controls can be configured to meet the players needs/preferences.
Quit game brings up a yes or no option. Clicking yes exits the application, no returns them to the main menu. 
UI flow diagram

Something I was debating about whether to add to the menu or not was a tutorial. I was considering a small section where players could read up about what to do and how everything plays out, but felt something visual was more interesting. My new plan was to play a small ‘cut scene’ at the beginning of the game for players to watch and learn from. Both players can opt to skip it if they already know what they’re doing because being forced to watch a tutorial you already know is very boring.

It starts off with the main camera panning around the town then zooming in on targets and explaining the controls and to shoot as many targets as possible in the time remaining. The camera then pans over to the power ups and briefly explains each one before cutting the screen to black and starting the game.

Thursday, 22 October 2015

3D Materials

For design work this week we focused on improving texturing and the appearance of objects when they are imported from 3DS Max into Unity. Setting a block of colour to an object gives it a very unrealistic appearance so effects can be used to make them look much nicer. In real life, objects like walls are slightly bumpy and never completely smooth, therefore adding a single sheet of colour will make it look strange. This can be helped by adding a layer of noise, which will create a form of static and make the wall look slightly bumpy, giving it an overall more realistic feel.

To practice to texturing we did last week, we were tasked with creating a cube and adding a different texture to each side. The six different textures were: brick, gravel, window, carpet, clean wall and dirty wall.
Carpet, clean wall and dirty wall

Gravel, brick and window

We then went into Unity and learnt about editing materials to change their appearance and tailor them to specific objects. The two settings we focused on were metallic and smoothness. The metallic setting determines how light is reflected off the object; the higher the setting, the more reflective the object is and the less colour is visible. Smoothness increases the objects micro surface detail and makes things look more or less glossy. For example, a wooden or stone object will have very little, if any, of either of these settings. Whilst a plastic or metal object will have larger values of each.
Stone(left), plastic(centre) and metal(right) materials

The final thing we were taught was that when an object from 3DS Max is imported into Unity, it's textures can be edited to change the materials appearance. This is very useful when you import an object and want to make the separate components look like different materials. To practice this I created a table in 3DS Max and imported it, then changed the settings to make the legs look metallic and the actual table top look like varnished wood with a plastic edging.
Render in 3DS Max
Changed materials in Unity

Wednesday, 21 October 2015

Fading Bullet holes

When I was playing around with the bullet holes, something I definitely wanted to do was cause them to fade out over time rather than just disappear immediately. The effect is slow and subtle so won't pull people out of the immersion of the game unlike constantly destroying the texture instantly would. After a bit I research I discovered that textures have an alpha setting along with the RGB settings. Alpha is the transparency of the texture, so in order to get my bullet hole texture to fade I needed to adjust the alpha setting over time. The way I thought of doing this was to use the interpolation mechanic I'd been taught the other week, to slowly adjust the setting from max to 0 over the course of three seconds.
Fading alpha interpolation code

After figuring all of this out and getting it to work I added it to my prototype scene to show it off.
Bullet hole partially faded

Monday, 19 October 2015

Pendulums and More Shooting

Continuing on from last weeks work about shooting, we added a few modifications to the scene. The first addition was adding a cross hair so the player could see where they were going to hit when firing. Using the new Unity 5 UI system makes adding text and images to the UI incredibly easy. Rather than having to code the entire object in a script, you can add a canvas to the scene and place an object upon that canvas. For images just move it into the position you want and for text items, do the same them add the text in and even stylise it if needs be. So I placed the cross hair image dead center of the screen, adjusting my bullet spawner to fire at the same point upon clicking.
Cross hair in scene used to destroy block

The second thing added to my shooter this week was a bullet hole upon impact. In order to do this I had to use Ray Casts for the game to judge on whether an object would be hit upon firing. If this is found to be true then a bullet hole will be instantiated at the point of impact giving a more realistic affect to the scenery. To stop graphical glitches, the bullet hole is not applied directly onto the object it hits, but set as a quad 0.01 units in front of the collision point. This stops the created bullet hole and target object from fighting for the same world space and flickering when looked at by the player.
Bullet hole created by bullet collision

When this was all implemented however, I very quickly found that the holes stacked upon one another. On top of this, since they were just placed where there was a collision, if the object the bullet hits gets moved then the bullet hole is left floating in space. To solve the first problem I needed to destroy the bullet holes after a little while to stop them from filling up space, so created a script which waited for 3 seconds after being created, before destroying it. To stop floating holes I had to set the object getting hit as a parent of the bullet hole. This means wherever the object hit goes, the bullet hole will go with it.
Code to create bullet hole and set object collided with as parent

After we finished with the new shooting mechanics, we moved onto something new: pendulums. Making a pendulum was surprisingly quick and easy, since all you need to add to an object is a Rigidbody and a hinge joint. When applying the hinge joint you add the object that will be the connected body and that causes the two objects to act as a hinge. Adding multiple objects in a row and hinging each to the previous one creates a chain that we added a sphere to the end of. After creating a wrecking ball it only made sense to add a wall to knock down with it, which is exactly what I did.
Pendulums swinging to destroy wall