Unity teaching
Structure :
- Introduction
- Game design
- Design
- The character
- Scripts
- Difficulties
- Demo
The purpose of this class was to build our first platformer by our own. We had been really free on the content and game design and it was such a pleaser as I never used Unity before.
-
The game design
The first platform
I started by the game design, experimenting different tools. I began with a simple platform with walls that hide the success area.
nd This simple game at first enable me to create and try my first code, to have at least a character that moves.
The light effect
Then, I decided my game would be at first focused on the light. The purpose was to use animated platforms that show and hide the light for the player in order to make him fall in gaps.
I therefore created corridors like this one :
Color code and in between platform
To link both corridors, I decided to put a platform. Actually, I decided that a single one was too boring. I then made it move every 12 seconds ! The purpose is that the player either see it come and suspect something, either fall and have to figure out how and why. He actually has a visual help : the moving platforms are red.
Follow the particles ?
At the end of those corridors, I wanted the player to do something not intuitive : go back and jump in a hole ! To force this, I make him go to the end of the corridor to pick a collectible. The logic reaction is then to jump, I therefore added platforms, and more particularly a red one with particle effect. Test showed me player do understand they have to reach it. However, it would have been too easy to go directly there. That is why I added reachable platforms before :
However, it was not fun enough, so I made the character bounce on them ! He cannot reach back the corridor and he has to stay in the lower area still.
A missing collectible
Actually, the player who now reach the red platform miss a collectible. He is supposed to know it as he has a counter. This platform is an elevator, if he reaches the buttom without the collectible, a message tells you to kill yourself. I founded that quite funny. Then, you have a checkpoint in the corridor so you don’t have to start from scratch. I also had to write a whole script to make the elevator platform come back to its original place.
Back in black
Actually, to find the last collectible, most players do the same way, and then jump in the platform I first created. But I wrote a script so as long the bleu platform is not triggered, you cannot walk on green ones. It is why the player as to go backward. Actually, he has 2 big clues to do that : first the text when he reaches the checkpoint (most of the player understand there is something going on when I tested it). Moreover, the music in this area is “Back in black” !
Finally
At the end, you can achieve the game, find the rocket and win : you have then a great winner dance !
-
Design
I decided to make it in space. I founded a nice skybox and the corridors seemed to be coming from some other place. Moreover, I had done on blender a rocket and my character was like an alien. It was also a good thing to create this darkness effect in the corridors.
Light difficulties
I had difficulty in finding a coherent but effective light. Indeed, I wanted something natural. I started by doing, with the skybox, a ‘sun’ light a bit yellow. The sun of the skybox image was actually really where the light was. However, even with more light on one size, I needed light from above, so I added a little red one.
It has been very difficult to find a good balance in those, but the worst was to implement my first idea, which was the moving platforms and shadows. I actually ended up finding how to do it, but I am still not sure the effect is exactly what I wanted at first.
-
The character
As told on my last page about Blender, I decided to use Mixamo to animate my character. I did not have a lot of choice when it came to one in the space. The one I took was actually the only one with an helmet so it could breathe ! Here it is.
I then only had to choose the animation on the list and it worked find.
The most difficult part was finally to implement it on Unity. I decided the blend tree solution was better than a list of booleans. Still, I had lot of bugs at first and it took me time to find them in both the tree and the code to have a final result. Here you can find what it looks like :
I finally have to note that it seemed to me that sometimes, there were bugs only after building, I never understood why.
-
The script
We made a few scripts in the class, but I wrote most of them by my own to achieve specific purposes for the game design.
Here you can find the script : https://github.com/AdrienTriquet/Unity1-script-
Code improvements
I also worked on our given codes to improve them. Indeed, two main things appears problematic to me. The first was the camera, it was blocked in one direction and it was frustrating for the player. This version enables a really free camera with high speed for the mouse.
The second was the jumping. Indeed, I wanted the player to be able to jump even a few frames after he left the platform. I learned this is what great and professional platformers do to better the player experience. Here you can find the differences made :
-
Difficulties
Difficulty of the game
I think the main issue I had was to dose how hard must be the game.
For the jumps, I started by finding the real limit for the jump range for each jump a player had to do. I was doing them one after another. But the first time I made it test, even after resolving camera and all issues, the experience was really not good as it was by far too hard. Even next versions were too hard actually. I think, even the last and final version is not easy but at least you can do it !
I have to note that the entire game can bo done without running if you want something harder ! Besides, after one minute I made a text appears to help a player that would not know how to run.
Code issues
As told before, I had to write entire script from scratch. For instance the following one is quite simple. Still, it demands to really understand the way scripts are connected and call one another. It was both fun and interesting actually, even if it did not work on the first time ! In any case, I do think that my habit of object oriented code was a huge help here, otherwise it can really be misunderstanding.
Missing prefab
After a while without touching this project, I wanted to finalize it. I then had this issue :
Actually, my character disappeared for some reason and even the component on it did. I never understood what happened but I did reconfigure everything for it, even the animations !
Build issues
I also faced some issues when it comes to build. The major one was that on a mac I could not do a ‘.exe’ file. I finish by translate my project on another PC to do it !
Moreover, I faced this issue :
It happened to be an issue with a skybox and component that disappeared. To build, I then add to re import all the skybox.
Demo of the game :
Finally, everything works ! You can find bellow a demo of the game.