Showing posts with label Level 6. Show all posts
Showing posts with label Level 6. Show all posts

Thursday, 3 May 2012

Scripting sounds...

I added the sounds into the animation scripts to trigger when the animations are played. Here is the script broken down:

This var is needed so the file can be selected in the Inspector window in Unity.

'audio.Play();' shows the audio being played inside the update that triggers the animation.
'audio.clip = swing;' sets the current sound that the 'Audio Source' plays. This allows all of the sounds to use the same audio source. The 'AudioSource' is shown attached under the collisions script, both attached to Gutsy.





Updated HUD system...


Updates:

- Aligned health and score GUI elements
- Game instructions added
- Damage indicator
- Updated health icon and counter display
- Added sounds (Attack, Coins pickup, Heart pickup, background music)

Scripting animations, pickups...

Having never scripted animations within Unity I used the Lerpz tutorial found here. My initial script for the animations showed a sliding effect when moving. As this script would not do I used the ThirdPersonController script included in the Lerpz tutorial. This allowed the animations to move smoothly based on the player's input.


This video demonstrates the Third Person Controller script in action, with the animations blending smoothly. The attack animation is triggered separately when the player clicks the mouse heres the script for that:


In this script it shows the wrapmode of the animation to be on loop for a continuous animation. It also detects the Fire1 input which is the default left mouse click control name. GetButtonDown means once the left mouse is clicked the animation will play once, if it were GetButton it would continue looping while the mouse was held down. I adapted it to be a one click hit for our game.






Third Person Controller
This has slots for the animations that can be selected in the Unity. The animations are stored in the player prefab, where the animation is split up into the run idle and attack for Gutsy.

Here the Gutsy animation keyframes chosen, broken up and named correctly.


 In the collisions script I added a point system which is controlled by the points manager script. You can specify in the Inspector window of Unity how many points to take when colliding with the coins/health.


This shows the animations that are attached to the Gutsy model separated into 3 elements. I have deselected the play automatically button as I want the animations to be triggered by the script only. 

The collision script:

Here is the spawn system used for the coins. I have created 4 Empty Objects within Unity which are invisible objects used as a reference points. The script spawns the object selected in the chosen spawns. This was adapted from the enemy spawn hence the variable 'amount of enemies'. This section allows you to change the amount of objects spawned, when they start spawning and how often they will spawn after the initial spawn.



Updated build..

These builds were shown at final crit, demonstrating imported assets and the pick up system in action:


Assets

This video shows:

- Imported textured Gutsy model
- Added particle system to show pickups

The Gutsy model's pivot point was not correct causing strange camera movement as seen in the video.



Pickups

This video shows:

- Improved Gutsy model for better rotation with camera
- Collisions with the coins
- GUI with added score (test font)

The feedback from the crit was that the floor texture looked stretched and it could be changed through the textures titling within Unity.
Also the particles needed to be reduced and the score gui.Text displaying the score needed to be aligned.

Animating..

Now that the models were both rigged weight painted and ready for animating. I knew that I needed to have all the animations on one timeline before being imported into Unity. When imported I will break the animations up into the run, idle, and attack animations. The main things to remember when animating walk cycles is to make them loopable, easily done by making the first keyframe the same as the last. Putting the keyframe start and end values correctly i was able to work on the first frames for the run then the idle and then the attack all on one timeline of 100 frames.




Here are the Playblasts of the Skeleton and Gutsy animations:



The Gutsy animation below shows the run animation, idle, then attack. I halved the run animation later in Unity.


Importing Assets...

Now that the scene assets were textured, I could now add them into the game scene. I also modelled the pickups including the coins, gems, crowns, and hearts. These were all exported from Maya as fbx files, then imported into the Unity project. Once they were imported there were a few issues with missing textures on some objects this was resolved by going into the Maya scene file and re assigning a few materials so that they related to the correct object when imported into Unity.

Here is the main scene mesh. This was imported as one to improve performance within Unity and because I knew it would be a static object. The other assets need to be imported separately as they would be duplicated and moved within the scene after import. This was done to allow the level to be customised, to create variated levels and environments. It makes for a more adaptable game with an asset library that can be reused. Baking textures was an idea to reduce processing power but wasn't essential for the build as the level was minimal. Therefore using an in-game light will do, i adjusted the cone angle and intensity to suit to scene.


Here are the individual textured scene assets imported into Unity. The grass was imported as a single asset then duplicated throughout the scene. As the camera will not rotate I rotated them to face the camera.







Rigging Gutsy...

Having received the Gutsy model from Ken I was then able to go straight onto the rigging. I followed exactly the same process as with the skeleton model and there were few alterations I had to make from the skeleton rig. When it came to the weight painting of the Gutsy model the long coat of Gutsy proved difficult to accurately paint the weights as there wasn't a lot of room. There were further problems with deforming that took longer than anticipated to complete. Mainly due to a lack of time I had to move onto the next process of the project, importing the newly animated models into Unity and scripting them.





Gutsy weight painting:


 Outliner in Maya showing the skeleton hierarchy:

The Spine2_control constraints in Maya:


Wednesday, 2 May 2012

Exhibition..

The DFGA exhibition was a chance for us to receive feedback from other people within college and display Gutsy's Quest in a formal way. The build despite being basic demonstrated the basis of the game, with added concept art on display to demonstrate the final look of the game.
The feedback was positive although the controls were not clear even thought they were added through gui.Text. They would also travel to the corners of the game space as it was currently square there were inactive corners. These were mainly due to the stage of development in the game but despite this they were noted and discussed in mine and Ken's meetings. It would have helped to have a more developed bild to demonstrate but this could not be helped due to us falling behind on our time schedule.

Rigging the skeleton..

After receiving the textured skeleton models I had to create the skeleton that would be used to control the geometry. I created the humanoid skeleton in a similar way to previous projects, heres a breakdown of what was used. Creating the skeleton in the right view ports within Maya helped to make sure the skeleton was perfectly straight otherwise this would result in the geometry deforming badly. I used the joint tool to create the joints, to form a minimal rig. The hands and most other features were made with minimal joints to match the reduced model.
It was essential that the joints in the skeleton hierarchy were named correctly as in the next step I would be adding in the controls to move each joint. This is done in the Outliner in Maya.
 Adding the controls to the skeleton will allow to move the geometry without having to move each joint. The joints will be parented together through the Outliner to allow them to move correctly and follow each other. The controls are made from NURBS circles and are purely to control the rig during the animating stage. I added contraints to the different controls to specify which joint they will be controlling and how they will control it, either its rotation or translation. With the elbow for example it only moves in the y rotation as the model will be acting as a human skeleton should. Therefore there is only a constraint in that variable within Maya. Orient constraints were added to the rest of the relative controls as well as knee controls made from Locators which will allow the knees to be moved during animation. A master control was placed at the bottom that is parented to the rest of the rig, and is used to move and scale the controls and skeleton proportionally. Once into Unity the skeleton will have to scale with the geometry to prevent problems with animating. Putting each element into different layers within Maya as, Geometry, Skeleton and Controls, made the process easier to follow. Allowing me to hide certain elements while working on the skeleton.
Once the controls worked correctly the geometry could be binded to the skeleton using the smoothbind function. This then attaches these two elements together, however another process is needed called weight painting.

Weight painting is used to set how much influence each joint has on its surrounding geometry. Using the paint tool i painted the weight until the model geometry did not distort. It was helpful to put the model in extreme positions to see the distortion more clearly. The sword distorted very badly initially, so I solved this by making the wrist have full influence on the sword.






Modelling the scene..

After modelling basic scene assets for testing purposes after receiving the concepts for the scene I modelled the environment. What I had learnt from importing the test assets was that the polycount of the gates were way too high causing frame rate issues within unity, modelling the fences corrected this. The concepts were very useful to create exactly what was intended for the scene. The actual modelling process was straight forward using the same techniques of smoothing edges and reducing polycount generally. I knew these were intended to be duplicated within the Unity scene so I created a few variations of each asset. The trees from testing were left in as I was pleased with the initial result. I then sent these to Ken to be textured.

Maya scene:


Presented images at crit (ambient occlusion):






EnemyAI...


I chose to use a c sharp script that projected an invisible line that would locate the player. This would allow the enemy to know where the player was. The script also moved the enemy towards the player at a certain rate and rotation. As the enemies spawn they will instantly locate the player and change their orientation accordingly. Time allowing I could change the speed variable as the gameplay goes on to increase the difficulty over time.

Initially the health system was scripted with a targeting system. The player would be able to press any button (tab while testing) to cycle through the enemies and only that enemy could be damaged. This proved to ruin the flow of the game also the target would be highlighted this retracted from the enemy model's appeal and would ruin the flow of the game. Also the enemy could not give damage to the player without facing them, since I have updated the 'enemyAI' script to find the player quickly therefore the enemy will always be facing the player.

Health system...

The health system would work in a similar way where the script would look to see if the collider of the sword or skeleton are colliding with the player, if so they will trigger the health system to update the amount of lives.

Originally the health system was to be displayed in an array, which is a number of images that a script can run through to display on the screen. The starting images would be Gutsy's health bar in the top left, with a full meter of hearts. Once the collision takes place with the enemy the array will update to display the next image of a lesser health. This system in theory was ideal, but hard to implement, due to errors conflicting with other scripts for an unknown reason and a lack of experience on my part.

I then decided that we could not use this system. As I knew I could operate the pickups system, to display a value. I decided to display the lives in the same way. The idea would be similar to the Crash Bandicoot series with a logo for the player in the top left, then followed by the number of lives. The lives will be displayed with a 'guiText', this is a layer of text that can be displayed on screen and aligned to any part of the screen. The logo displayed as a 'guiTexture' would be displayed before the 'guiText' to show what the number indicated.

Here is an early build of the game demonstrating the enemyAI script and the health system:


In the video you can see the enemyAI script is working correctly and they are colliding with the player and each other to prevent and glitches in the gameplay. Once they reach the player they will stop within a certain distance and attack and take damage. This however only worked with the gui.box health shown in the top left. This was later adapted to work as a counter as mentioned above.
The camera in the video is the default unity camera with a default smoothfollow script attached with the target set as the player. The height and the distance from the player were edited to my liking.
Since looking at Spiral knights while researching influential games I implemented a script to make the player rotate towards the mouse, i found this a good addition and after a few problems with the scripts it got it to work with an adapted move script for the player.

Here is is a screen of the build when I had implemented a few other elements: 


GUI
In this image you can see the three health systems. Top left shows the default gui.box used purely from script indicating the players heath and the enemies health in two bars, displaying 1 health point to 100. This was functional but could not be customised with the current script. The top left displays my second version of the health where the gui.texture was used displaying gutsy's hearts in an array. This as mentioned above did not function properly and therefore a counter system was used.

ENEMY
The skeleton models were imported as fbx files through Maya. To test the anchor point of the model and to make sure it would move correctly.

SCENE
The scene shows a basic layout of our game level. I modelled basic geometry before receiving the concepts from Ken to test them within unity with colliders added and meshes imported.


Pickups..


Pickups are a major part of this genre of games, so we came up with gems, crowns, coins and hearts. These would represent the player's score and health. Different points would be added to the score as they were picked up, the player would be rewarded for collecting the most in a certain amount of time, or until they died.
When thinking of scripting these pickups I will be using Unity's collision system. I will use colliders attached to the objects/player, then using a collision script I could detect when the player interacted with the object. This could then be used to display additional points/lives on the players screen.


Modelling in Maya...

My role for the modelling process was to model the skeleton. I received the side front and top images from Ken to allow me to put them in the correct view planes in Maya. This made the process a lot easier, although there were a few corrections needed. As the image planes didn't line up exactly I had to improvise the skeleton using other reference images. Despite it being fairly anatomically correct, the cartoon style needed to come across so it was a very reduced version. As the skeleton was symmetrical I could mirror the geometry to line up exactly by typically modelling half of the body then mirroring across the center line. To reduce the poly count the eyes and other features were left to be textured instead of modelled. I also used the Soften Edges tool in Maya, to give the impression of a smoother geometry without needing the additional polys, to achieve the stylised look.







 Here is the final model turnaround within Maya:
This was a refreshing experience that went a lot smoother than anticipated. Many solutions such as mirroring the geometry, smooth edges, as well as general shortcuts and tools sped up the process. As I knew this was only part of my role in the project I was pleased that it went well as I could then focus on areas I was less confident about.

Here are some renders with ambient occlusion added:



These files were then sent to Ken to texture in Maya.


Scripting revision..

Having used javascript to a degree in my previous projects I was fairly familiar with how I wanted the game to work. I looked back at my previous scripts and decided I would have to add additional scripts. I decided to review the unity website for reference.

The tag system built into unity allows me to tag an object with a label, to allow me to reference them through the scripts.
An example of the player tag being assigned to a game object:

Colliders are used to detect when objects collide. They can be applied in variety of shapes, from boxes, spheres, capsules or even to a mesh of an object. I used these in previous projects mainly for the combat system. A typical scenario would involve two colliders colliding to trigger the health of the player to decrease, or increase when collided with a med kit. This will be used for our combat and health system, but without the scripts these functions will do nothing.
An example of a mesh collider being added to the scene geometry:


Collider.OnTriggerEnter is needed in the script to detect the collision of the collider attached to the enemy. Here is Unity's reference to the code:
 CharacterController.OnControllerColliderHit is used on the player as it uses a character controller to move the character around the scene. Here is Unity's reference to the code:




Game Space


We knew what type of game we wanted to create now it was a matter of deciding what the game space would be like. We had considered to have a linear path from goal to goal in an adventure style game, hence quest. There would be other modes such as time attack and an endless wave mode. Deciding that this was slightly too ambitious we opted for the wave system for the prototype.

We then thought that a circular game space was appropriate as it gave the player the most freedom, and could be easily scaled. Looking at games like Minigore we were able to see that this form of gameplay lent itself to a circular shape game space. We created a few mock ups of where the enemies would spawn and where the player would start. The basic form of 'wave survival' gameplay starts with the player typically in the center of the screen with the enemies surrounding the player. As the gameplay goes on the speed and the waves or the enemies typically get faster, we thought of implementing this time allowing.


Monday, 16 January 2012

Environment modeling: Graveyard



Medieval was a hack and slash title released for playstation one. In this game it predominantly features graveyards. As our only level will be in a graveyard I need to se how previous titles had achieved the look. From what I have noticed most of the features such as the railings/gates are simply 2D image planes, allowing for less polygons in the scene, but not reducing the aesthetic. The bare trees are another classic feature that I will include in our scene. I will be considering statues and various styles of gravestones, that will be guided by Ken's concepts.