AN6002

Experimenting with developing a character and environment in Unity

 

First let me start with a little background fact.

Although I have been studying animation for the last couple of years, I have decided to take it to a different direction. Speaking with my teachers this year, for my final project, I proposed that instead of creating a final animation project I would like to create an environment in Unity and have a "character" to be interactive within it. I mentioned that although the proposed final project was not an animation, there would be animation within this project nonetheless. I was very pleased to hear that my project was accepted and I'm looking forward to making it into a reality.

Until my very first day of college this year, I had a different project in mind. I wanted to create an animation using one of my old characters and even prepared some things that I would be using for it such as a great part of the environment I meant to use. 

 Something I was working before I changed my mind. A little space adventure.

Something I was working before I changed my mind. A little space adventure.

Even though I was sure of what I was doing I decided to scrap that project because I felt like I was deviating from the path I wanted to go for. I love animation but I want to use it in the context of games at this time in my life, possibly exploring other forms of the medium later.

So with that little bit of history out of the way, I'm here to start reflecting on my actual experimental project and how I progress as well as how I will achieve it. 

 

PROJECT SCIENCE

 

I intend to use this project for something I will be doing after college and I don't want to use the actual name of it, therefore the temporary name will be Project Science.

 

Project Overview

Project Science will provide an interactive character set in a 3D environment within Unity in which the audience, aka the player, will be able to move around and interact with other things within the same environment while trying to avoid enemies. For this project I will be modeling a mechanical “spider” like character as the main character, a test environment that can be described as a virtual setting where the main character will be placed and several little floating robots to chase the main character with the intent of draining its energy until it is defeated.

For the purpose of this proposal and this exercise I will be naming the character “Ranger”.

Ranger will be responding to commands inputted by the user via the keyboard or controller. Predefined animations will be played in response to each individual input such as walking, taking damage, attacking and dying.

The whole experience is targeted to last roughly about 3 to 5 minutes. This is a very loose projection at the moment and it could change in the future. I don’t intend to make the experience shorter but perhaps longer.

 

Experimental work overview

 

The objective of my experiment is to create an environment in Unity and create, import, animate and code a character to be interacted with entering commands via a controller or a keyboard.

I will be researching different sources of information and tutorials to learn and improve my skills in order to achieve my objective. Books and online videos will be my main focus of research.

 

During my break I have been experimenting with texturing. A LOT. If you look at my last year project one thing you will notice immediately is the lack of textures or a very basic use of it. Since then I have met people and spoke with them and learnt from them, I am in a position now where, although I do not consider myself a professional texture artist, I am very comfortable with texturing and that is great. One less thing to worry about this year.

For this year I reserved something else, something much harder and that I have no experience in. Unity.

I experimented with Unreal Engine last year and although I had a good time with it I didn't quite feel like progressing with it as I think Unity is more than enough for the projects I have in mind. The downside is that Unity does not have the blueprint setup that makes Unreal quick to advance. I want to learn something that I can have more control of in the future. Also Unreal looks too realistic and I want something more stylized.

So since I set my mind in this project I started looking into ways to efficiently learn Unity. I looked at some sources for tutorials online by simply searching on Google and Youtube.

I found some interesting options, specially on YouTube, but they all lacked something, they were all too casual and none of them had a "qualified tutor" approach that I find essential when trying to learn something advanced like this.

I had cancelled my membership for Digital Tutors, now known as Pluralsight and I knew that there was no escape at looking at what they offered on the subject. So it was just a matter of figuring out what was my preferred method of payment and in no time at all I was back paying a fortune for some good tutorials, I know it is worth the investment but it is painful just the same. Being a student without an income for the last 2 years put you in some very delicate situations financially. 

 Pluralsight and some of the tutorials I've been looking into in order to learn Unity

Pluralsight and some of the tutorials I've been looking into in order to learn Unity

Pros:

  • Qualified tutors
  • Industry standardized courses (for the most of it)
  • Access to 24/7 support

 

Cons:

  • Cost
  • Cost
  • Cost

 

Yes it is pricey but hey, they say that investments always pay themselves in the future right?

I also make use of google to answer me some questions when I'm confused about things such as terminology or even processes that the tutor might have skipped due to the level of the course. Another source of information I have are friends, I know a couple of people who know a thing or two about the subjects I'm about to explore.

Since the objective of this project is to experiment with a character to be interacted with in Unity, I started by looking at a specific course, an Introduction to Unity 5. The course takes me through the process of setting up an environment and creating a character to run around and interact with other things while running away from an enemy, quite similar to what I have in mind for my project.

Training 002.png

One of the greatest things when working with a game engine is that you start to see progress immediately as you set up your project, since the engine works with real-time rendering. I felt a little bit more inspired looking at what I could achieve in such a small period of time. Obviously the course provides you with the exercise files and when working on my own project I will have to model them myself, adding some production time, but it still awed me.

 

 

_______________________________________________________

 

A brief history of game engines.

 

While experimenting it is also important that I look into some historical context as part of my research. Video game engines, although being around since the middle 80's, were mainly focused for a specific type of a game and for the most times it would be better for a company to develop their own.

Back in the early days game engines were scattered and would work towards specific elements of a game such as sound or rendering. RenderWare introduced a solution in order to help game developers create a more personalized tool to better suit their needs. The engine allowed the client to combine components into one engine and deliver an integrated "bunch" of engines into one. 

It was only by 1993 with the introduction of DOOM Engine that game engines started to shape into a more standard preset.

I have found a really interesting website with an extensive account of the revolution of game engines before and after DOOM Engine, definitely worth taking a look at: http://www.kinephanos.ca/2014/game-engines-and-game-history/

Another interesting article about the history of game engines can be read here at: https://www.researchgate.net/publication/259496289_History_and_comparative_study_of_modern_game_engines 

Video game engines have gone a long way since their early usage to today. It is possible today to be able to create a video game on your own using the available engines such as Unreal or Unity since they are so well developed to make your work much easier compared to what it would be required. Today you're most likely not required to even know how to code depending on how simple is your objective. 

 

EGX London

 

Early last year (2017) I decided to go to an game expo in London called EGX (https://www.egx.net/rezzed). I heard about it from a friend of mine and I decided to go without actually knowing much about it.

There I found myself surrounded by not only gamers but also game developers and many other professionals of the game industry. 

One of the attractions is called "The Developer Sessions" which provide in-depth details about some aspects of the industry. I took part on two that I found extremely important for my research, one being about developing ideas for games and the other about tax relief for game developers. The second being my favorite by far, it was extremely informative and essential to understand how to successfully file for tax relief and properly control the expenses of the production process. 

Throughout the three days it took part I have met several game developers, I interview a few and although I didn't know precisely what questions to ask I managed to get a lot of important information out of them that were very helpful for me to understand the processes I'm going, hopefully, to have to go through while creating my own projects. I managed to get better information about staff, costs, engines, development time, publishing, publishers and technical aspects from the creators themselves. 

I took a good close look at different games created in different engines and that was essential for my understanding of engines. Until then I only heard of engines and only had a brief experience with Unreal. I had a wrong preconception that Unreal was the greatest engine of them all and there was no point in learning anything else since Unreal would be the only engine I would like to work period. I was proven so wrong by the games I saw that weekend. There were some great games created with a variety of engines and I got to experience all of them. That was when I decided to try and learn Unity. Somehow I feel like it fits better my intentions.

In the end, I was not prepared for the amount of experience I got from that exhibition and on top of that I managed to make great contacts, one of which I managed to briefly work with and although it was for a very short period of time I have learned so much, it completely changed the scope of my skills. I am a much greater artist today because of that. 

_______________________________________________________

 

Back to my experiment

Since I started my tutorials I have been making good progress. I started by following a tutorial on Pluralsight that takes us through setting up an environment to importing a character and setting the controls for it to be interacted with.

I started by learning how to import meshes into unity and most importantly how to use different types of colliders in order to stop a character from walking straight through them as it would be otherwise an intangible object. 

 Importing meshes into unity and creating colliders.

Importing meshes into unity and creating colliders.

There are several different forms to creating the object collider and each has its usage. Object collider increases the polycount of a scene therefore it must be used with consideration. The picture above shows one of the objects I imported into the scene, the collider as seen in green, had to be made individually for that object and imported with it. Other options for colliders are box colliders and mesh collider which are created automatically, the later using the object mesh as a reference for the collider.

 Example of colliders

Example of colliders

Above we can see two different type of colliders. The middle one would be the most commonly used while the one on the right, although the most effective, can make a scene too heavy due to the amount of polygons it contains.

The tutorial continues through setting the scene explaining the process of also adding particle effects for dust and wind, which gives the scene a more realistic feeling as well as create a more visually complex scene without actually making it too complex. The dust effect combines well with the environment in this exercise since it is a desert of some sort. 

I have decided to work with a simple collider to save the poly count and because the object I will be creating is unconventionally shaped and due to my inexperience, I think this is the best way to start with my experimentation. I know that most games would not use the complex collider because of the high poly count (this would increase the amount of polygons that would need to be processed during a game).

 The collider for the character is represented by the circular lines going around the body. Sadly this kind of collider causes the legs to go through objects since it does not cover the extension of the legs themselves.

The collider for the character is represented by the circular lines going around the body. Sadly this kind of collider causes the legs to go through objects since it does not cover the extension of the legs themselves.

Continuing with my tutorial I have managed to put a small scene together.

 

In this scene I make use of the objects provided by the tutorial to put together a scene in which the character, the little robot, should run about collecting energy and avoiding enemies. I also had the chance to experiment with particles for this stage in the form of dust, visible through the video above.

At that point in the tutorial I have learned to import a character and its animation into unity and prepare it to run around in an environment, it required a little coding but it all seemed simple enough to wrap my head around it. I also, like I said above, experience a little of how to use particles in the scene. I found that Unity makes particle very easy to be used and I will be considering it for my final project.

I also learned from that tutorial about how to set the camera but I wasn't happy that the camera was fixed in a position, I want to learn how to do a more dynamic camera, so I ended this tutorial and looked into another more advanced one from the same website. This new tutorial went a little deeper in the same process or creating an environment for a character to interact with but with the opportunity to do more. The tutorial name is Unity C# Scripting Fundamentals.

As I progressed through the tutorials it started to become more and more evident to me that I would not be able to continue without adding some lines of coding, which I'm certainly not proficient with. To be more precise, I realized that a lot of coding would have to be involved and that made me rethink my decision for a final project and this means that I now also need to experiment with coding for this module.

The new tutorial was quite easy to follow and honestly I started to feel more confident about what I have been learning in Unity. The files that come with the exercise were incomplete and one of the props, the chest, had no animation to it and I could not continue unless I had the animation, so I ended up animating the chest myself and importing it into the scene, and it worked perfectly. At this point my Unity skills were good enough to allow me to do that. This meant that the experimentation that I have been doing is actually working for me. The only part I started to feel troubled by was the actual coding of the scene.

 

 

 

 

The chest being animated above and imported into unity on the side.

 

 

 

 Learning the Animator tool in Unity to link the animated chest with the action of opening the chest

Learning the Animator tool in Unity to link the animated chest with the action of opening the chest

 

Coding gets really complicated really quickly. As soon as I finished this tutorial I focused on trying to learn coding a little bit more before continuing with another as I have confidence that I am learning well the other aspects of Unity.

 Coding character and actions into Unity

Coding character and actions into Unity

I found a good coding tutorial at pluralsight as well, Introducing C# in Unity. I have followed it completely and still found that I was struggling with coding quite a lot. I have found something  about my final year project that gives me a real feeling of failure. I am not adapting to coding and without it I cannot complete my project.

 Some of the tutorials I have been following from Pluralsight

Some of the tutorials I have been following from Pluralsight

After following the tutorials from Pluralsight I decided to look into other sources of information regarding it. I went to a bookstore in central London, Foyles, as it is the biggest I know and there I found a large amount of books regarding C#. I ended up buying one that seemed to make things easier. I bought it on amazon as it ended up being free due to my kindle subscription.

book 01.png

This book helped me understand coding better. I started understanding some terminology that helped me with progressing to learn the language. It approach coding by sections giving clear directions on how and where to type the lines necessary for programming.

 I have made a quick reference guide for terminology

I have made a quick reference guide for terminology

After a brief reading of this book I started feeling a little more confident to progress with other tutorials regarding the subject. I found a couple of really good channels on YouTube, one called Brackeys and the other called Games plus James. Click on the names to be directed to their correspondent channels on YouTube.

 

Brackeys

https://www.youtube.com/channel/UCYbK_tjZ2OrIZFBvU6CCMiA

This channel is excellent and it has a range of great videos regarding Unity and other tools for game development. The presenter, Asbjørn, is very acknowledged in the subject but he is extremely fast on his deliveries, making it too hard for a beginner like me. I have seen a couple of his videos and definitely will be looking a more of his stuff in the future.

 

Games plus James

https://www.youtube.com/channel/UCyBsvsU7uiurMiBZIYXvnyg

Games plus James is the beginner's tutorial that I needed all along. The form in which James deliver his videos is excellent and in synchrony with my ability to learn from it. I immediately gravitated towards his channel and found a great tutorial to follow linked below. 

https://www.youtube.com/watch?v=h2d9Wc3Hhi0&list=PLiyfvmtjWC_V_H-VMGGAZi7n5E0gyhc37

gpj.png

The tutorial above is for beginners and start by teaching to set up a character and code it as well as the camera. I found this tutorial to be much better than the tutorials found at Pluralsight and it is available for free on YouTube. 

Unity Scene.png

I quickly set up a similar scene in Unity, similar to the one suggested and followed the exercise precisely as it is presented. Sadly the tutorial is not finished but on the good side it is enough to do what I wanted to do with my character. 

The camera set up in this tutorial is precisely as I wanted and more. It gives you the freedom to rotate the camera in all axis while walking the character around. 

 Coding the camera

Coding the camera

I have then restricted the camera to only rotate sideways as I want it to be fixed on the X axis, in other words, I don't want it to be able to rotate up or down. There is a lot more about cameras that I don't know just yet like how to prevent it going through walls if the character is too close to it. Camera colliders are much more complex and not yet covered by this tutorial. That won't be an issue for my final project though.

I have also left lots of notes to myself throughout the script as it can be seen in green. Those notes help me remember what is doing what and work as a quick reference. At any point more notes can be added though a "comment" (any line that starts with // are considered comments and are not executed by the program).

 An example of a comment from my script

An example of a comment from my script

 Tutorial: Importing the character into the scene

Tutorial: Importing the character into the scene

I continued to follow the exercise, in fact, I watched the whole tutorial first than returned and followed it from the first episode again while repeating it in my own computer. At some point the exercise teaches you how to import a character and link it with the script as well as importing its animations and have it all working in the scene. At that point I slowed down a little for I wanted to use my actual character, for my final presentation, as the character to be imported and coded into the scene. I need to talk to my teacher regarding that.

 

 

_________________________________________________________

I recently spoke to my teacher and got the authorization to use my own FMP character for this experimental exercise. This is great. I find that it would have been a pointless exercise if I had to model something else for the purpose of this experiment once I already have the character I need to experiment with. 

For my FMP I have created a four legged robot which I rigged and animated in Maya in preparation for my final project. 

Model.png

The character above will be walking around an environment I will be designing for the exercise. After creating the character I created its movement animation in maya in order to bring it into Unity and link the animation to the input commands. Pressing W on the keyboard makes it walk forward for example. I have plans to possibly use a PS4 controller for the final presentation experience if possible.

 

The animation 

To animate this character I had to think a little bit differently, normally when you want to animate something moving forward you literally animate it moving forward in space, moving towards a goal. For Unity is a little bit different, the script defines movement time and speed so, for example, if I want a character to move forward after pressing a key on the keyboard, I have to code the movement direction and the speed.

Walking script.png

The lines of code above determine character's movement, move speed value is entered in unity and not the script, that way it makes it much easier to make adjustments to its speed without having to edit the script every time. 

With that in mind, I created the animation for the character in maya. Since the script is what define the character's direction and speed I had to animate it in the same place, the character is moving but still, if that makes any sense (of course it does, you're smart). That makes things a bit tricky, since you don't have a feedback from other objects in the scene to determine the speed in which the character is moving in relation to it's animation. In other words, the character could be moving too slow in relation to it's animation or vice versa.

I had to animate it on a guess. Hopefully it would be good and if it wasn't I would have to make adjustments. So initially I created a few animations to start with.

Animation Test.gif

As soon as I uploaded the character and linked the script, the character could move statically back, forward and sideways, the only thing missing was the animation, I then realized that I would have create also a sideways movement animation as well as a camera rotation animation, when the mouse is used to rotate the camera sideways the character would just "slide" inanimate waiting for an input from the keyboard. 

Cam rotate.png

For this last input I had to create something different, some way to detect only when the mouse would move while no keyboard input would be entered. This part I had to figure out on my own. I used the tutorial as reference since it tells me how to detect a value from a keyboard input but not the mouse. After a while I figured out a way to use the same code of line to also detect the mouse and it worked like a charm.

The line on the image attached shows the command lines for keyboard input and the last one the mouse movement input, camRotate is a value created whenever the mouse is used to define the direction of the movement and define a direction in which the camera will rotate in Unity. I'm using that same value to execute one of the animations, move specifically, the one responsible for camera movement while the character is idle.

Now I had to link everything together in order to have the character feedback for each of the possible inputs. Moving forward, backwards, right, left, idle and rotating. This was a very difficult task as for example if the character is moving right and forward at the same time, only the moving forward animation is played, if the character is moving sideways and camera is rotating, only sideways animation is played, if the character is moving backwards and sideways, only backwards can play and so forth. When you have multiple inputs you have to specifically tell what inputs have priority, including the inputs that hasn't been entered. If I'm moving sideways for example, I have to tell unity that if forward or backwards inputs are not detected at the same time as side input, play "move sideways" animation. It is complicated but I managed well. The result is as follow.

As shown by the graph above, I had to create a reaction to every input entered and not entered on the keyboard and mouse in order to have everything responding correctly, each one of the lines are predetermined actions that will guide unity into playing the correct animation. 

And with this I conclude my experimental work.

 

Conclusion

The objective of this experimental work was to experiment with the development of an environment in Unity while uploading and animating a character for the purpose of experimentation in relation to my FMP. 

In the end, working slow, I managed to produce some very satisfying results from my experimental work. Even though at times I felt like I was struggling with pushing myself with the experimentations, I still maintained the same level of quality I expected from the beginning, I didn’t change the project to ease my experiments. I continued my research and finished what I intended the way I intended.

I certainly learned some fresh new skills and I will continue to work to improve on them. This experimental work has proved to me that even though the path I’ve chosen is very difficult and truly outside of my comfort zone, it can be achievable if you push yourself to work through your own personal limitations. There are many other ways to tackle my issues that I haven’t even had the opportunity to explore yet and I aim to continue with experimenting, learning and stepping outside my comfort zone.

Below is a link to my presentation that was presented on the 11th of December 2017. The feedback I received during the presentation was positive and it was agreed that I experimented effectively and actually progressed well with my use of Unity Games Engine. I agree with this feedback and feel that this whole experimental module was helpful to push me to achieve the targets that we set out at the beginning of the module.

https://drive.google.com/file/d/1ThTk6tIvsaPVSKkpXVYhuarRMSju-WPw/view?usp=sharing

 

____________________________________

 

Below is transcription of my sessions with my teacher where we had a 1 to 1 meetings to discuss my progressions with my experiment.

 

Rationale:
Experimenting with developing a character and environment in Unity. 


Session 1 discussion - 25.9.17

  • Fernando has signed up with Digital Tutors in order to develop skills in Unity. We discussed his rationale of developing his skills in Unity in order to develop an environment and character and possible some interactivity. We also discussed the historical and contextual element of the module - Fernando needs to research and evaluate the history of games development and compare it to current games design.

 

  • Aims & Objectives set this week 
  • Research some history of game development.
  • Discuss and evaluate this within journal.
  • Work on some tutorials to develop skills in Unity.


Session 2 discussion - 2.10.17 - ABSENT


Session 3 discussion - 9.10.17

  • Fernando has been working on tutorials to develop his skills with Unity and has developed and modelled a character - he now aims to create an environment to take into Unity to experiment with. Fernando needs to create a journal to discuss and evaluate progress.
  • Fernando has completed target 3, but still needs to work on targets 1 & 2.
  • Aims & Objectives set this week (targets in red are carried over from previous week)
  • Research some history of game development.
  • Discuss and evaluate this within journal.
  • Rig character.
  • Use own environment and character to take into Unity.
  • Experiment with coding in order to create character interaction (3 weeks).

 

Session 4 discussion - 30.10.17

  • Fernando has been continuing to work on tutorials to develop his skills with Unity and has started to learn coding in C#, but this has taken him a few steps backwards as this is a very steep learning curve, but one that Fernando feels is necessary to develop his knowledge.
  • Fernando has completed targets 2, 3, 4 & 5 over the half term, but still needs to work on target 1.
  • https://www.fernandoalvares.com/fablog/ 
  • Aims & Objectives set this week (targets in red are carried over from previous week)
  • Research some history of game development.
  • Continue to discuss and evaluate this within journal.
  • Continue to develop coding skills.

 

Session 5 discussion - 6.11.17

  • Fernando has been watching tutorials to develop his skills with Unity this week, but has not actually tried any of these techniques yet and has not evaluated what he has gained from watching these tutorials and what techniques he thinks he will work on through these tutorials. 
  • Fernando has still not reflected on the historical context of games and where his experiments sit within that.
  • Fernando has completed target 3, but still needs to work on targets 1 & 2.
  • Aims & Objectives set this week (targets in red are carried over from previous week)
  • Research some history of game development.
  • Discuss and evaluate the tutorials (watched and completed) within journal.
  • Continue to develop Unity and coding skills.

 

Absent from session 7 discussion - 20.11.17

 

Session 8 discussion - 27.11.17

  • Fernando has researched some history of games engined and reflected on this in his journal. Currently working on journal entries about the tutorials and experiments. 
  • Fernando feels that he is ready to use the skills learnt during the experimental phase to use with his own character. 
  • Aims & Objectives set this week (targets in red are carried over from previous week)
  • Work on some tests with own character.
  • Plan for the final presentation.