Monday 10 October 2011

Development of Initial Designs

The Saloon
With the battle damaged Saloon chosen as the setting for the game, it was now time to take the design further and begin to add the element of 3D. Within Autodesk Maya I began to model the set directly from the perspective drawing, focusing on the main feature wall (the entrance) first; rendered below.




Using the "Mentalray" rendering engine I was able to showcase the model with sunlight and shadows to help add some realism to an untextured model. 


The next step was to include the 2 side walls, one of which shows sign of damage from the alien attack. To achieve this look I added several "edge loop" lines to give me a range of vertices to play around with - this was to create that jagged uneven effect which my research showed me. The downside to adding these edge loops was the increase to the poly count - which for a game needs to be as low as possible for optimum performance.


Finally it was time to add the roof, and using the same technique as the previous wall add a damage hole (another line of sight for an alien target); rendered below.




With the Saloon structure now modeled, the next step was to model the contents of the room such as the bar, chairs, tables and rubble. Before this though I decided to jump ahead a bit and begin with texturing the Saloon walls as this is what really makes the model come to life.


For textures I used one of my research images as a referance to get a general idea as to what kind of materials western interiors contained. I concluded it was generally a mix of brick and wood, which is what I applied to my model below;




I first went for a green wooden trim - which I took from the reference image in my research. I found that this did not suit the mood of the situation at all - it looked too friendly. Instead I wanted a dark hostile atmosphere, so I changed it to a dark shade of brown, pictured below;



Although it is difficult to see clearly in the render, the outcome was far more suitable for the theme. The next texture issue came from the bricks - having already modified them once for being too bright, they still didn't give the correct mood that I wanted the scene to give. I therefore took them back into Photoshop where I made them even darker and saturated some of the red coloring out. The end result was a much more desired effect, so I did the same with the floor to match. After correcting the existing textures I decided to colour the roof in the same dark brown as the doors and windows to match, then finally moved onto the last remaining areas - the burnt out holes. For the roof hole I used a burnt wood texture which I acquired from www.cgtextures.com (which is where I download all of my textures from) which I adjusted in Photoshop to my liking in terms of brightness. For the wall hole I used the same brick texture I used on the actual wall, but painted black over the top in Photoshop to make it appear burnt. The final result is below;


The next stage was to import the Saloon into Unity, as I decided to add the furniture etc. afterwards. Little did I know how many problems this would cause, and took me roughly 6 hours to solve. I firstly exported the model as an "fbx" format which is most friendly for use in Unity. My first problem was that multiple models (and fragments of the model) were imported on top of the actual model, so at first I had to delete my way through until I found the correct one (pictured below);




The next problem was the texture had not imported in properly - only 2/5 had saved onto the mode (also pictured below); 




This was the main problem I had to try to solve, and after the many hours searching the internet for people with the same problem I finally found the technique of "baking textures", in particularly "batch baking" using the Mentalray rendering software. This took a while to complete, and once I then saved the model again as an fbx and imported it into Unity, all the textures were loaded with it and in the correct places. However, this did not work 100% correctly as some small areas such as on the window frames are still the standard lambert shade instead of the dark brown - but this is unnoticeable from the first person controller so therefore not an issue. 


Here is where I found my fix - and I would like to thank this person for saving my project: http://www.stephenglover.info/maya-to-unity-bake-textures-and-lightmaps-for-export/


The below image is the corrected model now in Unity;




My next step was to add some lighting back into the scene. I first used a directional light to act as the sun which I placed infront of the camera looking through the windows. This did not provide enough light (or at least not in the way I wanted it to) so I also added a point light which I placed in the center of the room and adjusted to the correct intensity and colour tint to produce the desired effect. I also added a plane of sand outside the entrance for the enemy targets to walk on;




I then added a suitable backdrop to replace the blue background, similar to the one in my initial design drawing. All that was left then to complete the scene (without furniture models) was some particle effects to show that the structure had just came under attack. This would also provide some cover for the alien targets moving outside the structure, making the game that bit more difficult;



With the scene now complete apart from furniture models, I thought I would make a start on getting the game working incase time ran out for some reason or other. I therefore needed to begin with making the player's weapon and it's bullet, so I returned to Maya to begin with the modelling.

With the game only being a casual game the detail didn't need to be high - therefore it took no longer than an hour to model both the bullet and the player weapon, both rendered below;


With the player weapon I knew that only the front half would be visible from the 1st person controller so I therefore saved time by leaving out the back of the rifle. The textures were also very simple yet effective - particularly the wood on the rifle. Again credits go to www.cgtextures.com for the downloads. Below is the rifle attached to the 1st person controller in Unity;


By this stage I could see that the project was well on the way - considering the previous day I was having major importing issues which threatened the project being completed for the deadline. However, the problems did not end there - when it came to getting the bullet to fire again I was faced with a dilemma. This was not the first time I had faced this issue though, as when we had previously tested out a shooter within session the same problem happened then. This was where the bullet would fire, but fired sideways. From my memory I remembered rotating the spawn point would change the direction of the shot - which indeed it did, but then I was still faced with the problem of the actual bullet being projected in a sideways angle and not ahead - image below;


As with before I turned to the internet to try and resolve the issue, but after an hour or so I had no luck. I therefore decided to invest my time more wisely and return to the modelling for now, as it was an issue that could probably be corrected within session. 

All that remained was to model the furniture for the Saloon and the alien targets. With the items of furniture being easier and quicker I got started with those, firstly with the bar counter, rendered below;


Using my research images of western saloons I was able to get a good representation of the western style, such as on the bar counter above. They generally used simple decoration such as rectangular "cutouts" in a slightly different shade of wood. This made the modelling very easy and not too time consuming.

The next piece of furniture I made was the chair, rendered below;


Again a very basic design thanks to western architecture. I used one of the wood textures that I used on the bar to create some consistency - this ensures that the same theme is apparent throughout the structure. 

Next was the table;


Again using one of the wood textures from the bar, and for the table support I used a blinn texture for that shiny metal effect - similar to on the player rifle. Considering that there should be a table where the wall has been blown in I decided to modify the original to create one that appears as if it has been in the blast, rendered below;


By this stage the room was starting to look believable, but for that extra realism I decided to make some extra models such as candles for the tables (which would also be used to project a light source) as well as a wanted poster to help set that wild western scene. Both images rendered below;




Knowing that the candle would be particularly small I didn't worry too much about the textures and used colours instead. For the wanted poster I added a wooden frame to it to match the rest of the wooden furniture in the room and added a realistic looking image for the poster itself, displayed below. The use of the realistic image really helped to bring the scene that bit further to life, despite the game only being  "casual" where detail and realism aren't that important.


The end result of adding these models into the scene is below - a big change to the last image of the scene;


As you can see the scene is also a lot darker which came about after an inspiration I had from a soundtrack I found for the game. This was the "Dalek Theme" from Doctor Who, composed by Murray Gold;


I found this composition so inspiring that it effected the design of my project - instead of fighting off the martian enemy character that I had designed, it would now be to survive an attack from the Daleks! I realized that this would be far more suitable for the project as the Daleks dont require rigging and animation - they simply hover. With me having no experience with rigging and animating yet this was ideal as time was running too short for me to self-teach those skills and put them into practice. I therefore got straight to work on modelling my Dalek target, which I must stress that I take no credit for and is intended for educational use only.



To assist with my modelling I used the above image of a Dalek toy which was really useful being in 3D. Although the Dalek shape isn't that complicated, I did struggle with certain areas such as the base and it's alignment to the upper structure. However after a couple of hours I had a model I was pleased with, rendered below;


Once I imported the model into Unity there was one important addition I wanted to make - a blue light source coming from the eye, pictured below. Not only did this make the model come to life in contrast to the dark surroundings but it also illuminated the target area (Dalek's could only be destroyed by shooting their eye piece). This therefore added more variation and difficulty to the game - the player has to shoot the Dalek eye accurately to be able to destroy it.


The next step I worked on was to animate the Daleks. I already had a good idea in mind of how I was going to do this so it was just a matter of implementing my idea to the scene. Having already had some animating experience from class within Unity I didn't encounter many problems. One problem that did occur however was once I made my startup screen - when I returned to the game scene after linking them the animations had strangely changed and moved, so I therefore had to reprogram them again. 

By this stage I was now struggling to make any more progress on the game level. I had now encountered numerous problems which searching the internet was not solving, so I compiled the following list of issues which I needed help with in class the following day;

- Restricting camera movement so the player can't look behind.
- The bullet projects at a sideways angle.
- Colliding issue; the bullet doesn't collide with anything in the scene and goes through.
- Collision to Dalek eye piece to cause object destruction with particle effect.
- Spawn points for Daleks.
- Rifle muzzle flash.
- Colour won't stay on 3D text (start screen) and reverts to default white after saving.

The following day my teacher Mark managed to help solve some of the issues, the first being the colliding issue. It turned out that the problem was really simple - the bullet itself had no mesh collider which explained why it passed through all other colliders. I was under the impression that a rigid body acted as a collider which turned out not to be the case.

However, the problems became more complicated when it came to colliding with and destroying the Daleks via the eye piece. The Daleks could be destroyed by shooting them normally, but to destroy the eye piece which was a child of the Dalek object was other matter. It required a script to make this work, which was figured out after an hour of experimenting with code.

By this stage the game was really starting to come together now that the main technical issues had been resolved. The next stage was again visual effects, adding a particle system so that an explosion was created after the removal of the Dalek game object. These particle effects were also provided by Mark who showed me how to apply them to the game (and script). The effect is displayed below, however note that the animations of the Daleks once again moved out of sync which needed fixing.


The explosion effect was not quite right however and needed some tweaking. In order for the effect to look believable it needed to consume the full outline of the Dalek object so that when it was removed from the scene it wouldn't look as if it had just vanished into thin air. Below is the improved explosion;


The only issues remaining now were;

- Restricting camera movement so the player can't look behind.
- Spawn points for Daleks.
- Rifle muzzle flash.
- Colour won't stay on 3D text (start screen) and reverts to default white after saving.

I decided to move onto the next most important part - the respawning. Instead of actually respawning I decided to have a set amount of Dalek's at the start of the game and using animation I would bring them to the scene individually. 

Before I did this however I decided to take the Dalek model back into Maya as I realized they were missing a key feature which was bugging me, displayed below;


...the lights mounted on the top of the heads. The originals I made didn't quite look how they should do because of this so I had to make the addition. While doing this I decided I would add some alternative colours so that the enemies varied and the game would be more interesting. All 3 colour variations displayed below;


With the models finished and imported it was time to do the animating technique I previously mentioned. By placing the Daleks far away to begin with I shall animate them into the scene at the appropriate times as we have not yet learned how to respawn mobs. The game needs to finish by the time the soundtrack does, which is exactly 3 minutes long. This will determine how many Daleks and animations I shall be adding.

Before completing all the animations I added in the UI timer which would be useful for timing the animations correctly. This however was challenging at first to position in the correct place in relation to the screen - as this varied by different screen resolutions. I therefore only had to ensure that it was positioned correctly for the web browser version which meant repeatedly building the game and then going back into Unity to make the alterations.


The only game play issues I had left remaining which were important to fix were; 
1) The problem of the camera spinning 360 degres revealing an empty scene behind the player. 
2) The player was able to fire continually which was unrealistic for the type of weapon and made destroying the Daleks too easy.

For the first issue I had already looked into it previously and not been able to resolve the issue, but it was a too greater part of the game play to leave unresolved. I therefore began to research again determined to find a script that could fix the problem, and to my relief I did manage to find one. It turned out that the original Unity "mouselook" script was faulty which explained why altering the restrictions in the inspector made no difference. It was therefore just the case of replacing the original script with a corrected script. However now that it did work the next step was to figure out which digits would restrict the camera to the radius that I wanted - this was much more of a challenge then it sounds and took at least 15 minutes to keep experimenting with different numbers to finally get to the angle I desired.

The second issue was not such an easy fix - it was a matter of searching for a part of a script that would slow down the rate of fire of a weapon; which would have previously been too difficult for me to do with lack of scripting experience - but now I felt more confident to experiment with it. I found numerous scripts which claimed to slow down rate of fire however many of them had so many errors once I combined them with my own shooting script that I kept looking for more. Eventually I found one that was explained in more depth than the previous which helped me work out how I could successfully combine it to mine - and after playing around with the script sorting errors here and there it actually worked - I was amazed! Now the weapon had a timer between shots and until this reset to 0 the weapon would not fire - this worked perfectly for my rifle sound effect which does a cocking noise after the gunshot.

With the above issues resolved all that remained to complete the game was the start screen, the lose screen and the win screen. I created these using the images I had already included in my game with the exception of the start screen which was an image from my research.


Displayed above is the lose screen which as you can see is red to symbolize defeat - and below is the win screen which as you may expect is green for victory. For all 3 screens I used a combination of a western font and a sci-fi font to further incorporate the mix of the genres, which I thought worked really effectively. The music chosen for these screens are also very fitting - for example a heroic song for the win screen, a sad song for the lose screen and for the start screen the typical cowboy western theme. Credits go to Murray Gold again for the win screen music (I Am The Doctor) and the lose screen (Doomsday).


All that remained in terms of making the game was to alter the countdown timer script to switch to the relevant screen for the right reason which was a simple matter of adding in some code already provided to us. Next it was time for game testing which was carried out by my girlfriend aswell as myself - which totaled approximately 20 full tests - which unfortunately did reveal problems. These shall be revealed in the final evaluation.

No comments:

Post a Comment