Wednesday, 30 December 2015

New Blog

     Recently I've been interested in Artificial Intelligence and therefore I started a new blog, which can be found here.

Thursday, 23 April 2015

Gameplay! :D

    Since all my animations are finished I have done quite a lot of work today on a gameplay. I have implemented basic general logic for the game so now adding more levels won't be a problem.

   So what's the gameplay like?

    Well, the player is chased by 'little green guys' but only when he turns away from them and don't look at them-be careful if they get too close to you when you don't watch them it may be game over if this is the last level :P There is also a chest somewhere in the room(rotate it around to find it before little guys get you!) :D

For now that's it. Since I still have some time before submission I will now finish main menu screen, instructions screen, game over screen, win screen and credits screen, after that I will make sure all documentations is done and will do a gameplay video and then if there's still some time I will build some more levels.. ^.^

In this iteration I have also added a treasure chest I have made myself along with animations in Blender during one of the workshops for Game Development Society.


Enemies-starting on gameplay.. :)

     So I have started working on enemies for my game so that I could have at least some basic gameplay done. I wanted to reuse the script from last year I used for weeping angels but having more experience now I ended up completely rewriting it and getting rid of stuff I didn't need as well as adding other things and some changes. The script seems to work at the moment so now it will just be the case of creating animations for enemies. This way I will have to biped characters with humanoid animations. I have also changed enemies material colour to red to make them a bit different from the player.

Wednesday, 22 April 2015

Character animations in Unity using Mecanim (continued)

     Since last time I have finished creating the transitions between animations, now I moved on to applying movement script to the main character. This appeared to be more tricky than I though it would be. The problem I had because of the object set up I couldn't figure out why even when the position is changed the animation would snap back after looping. Eventually after experimenting with animation's options, blend trees, animations states and sub-states and after trying to ask around if anyone encountered similar problem, I have managed to get it working by enabling looping the pose instead of the whole animation. I may have to do the same thing for other animations such as crouch walking, running(if I will decide to have it in my game). Now i will work on the rest of movement mechanics and then adding more elements to the game.

Working with new UI System in Unity to create a main menu

     If it comes to creating buttons and functionality with the new Unity 4.6 UI System it is not as complicated as one can think it is. The only tricky thing at the beginning may be linking everything together as well as playing around with layout to get it exactly as you want it. I have downloaded sci-fi interface textures so to be able to start working on main menu screen. So far there is only one button-Play, which I will be working on later to simply make it look better. But most important thing is that I got it exactly where I wanted it to be and it is working, when the button is clicked it launches intro animation scene. Later I will add more buttons such as Instructions and Credits and maybe some more if needed. I have created simple UI Manager object that will handle all scene changes which means I'm always going to be using the same code- nothing here is hard coded. This is thanks to how new UI system works in Unity each button can have the same functionality attached but it will still link to different scenes.

     Main menu also contains simple glow animations made within Unity by using Mecanim.

     Below you can see the current state of my main menu-it will be updated soon- the black area will probably be used to display some images from gameplay/animation scenes.


Fade Out and Intro Animations- Done!

     As the last element for my cinematographic animation I have been working on scene fade out effect and then switching to the main game scene. According to the Unity tutorial for Fade Scene Out/In is seemed very easy to do, but unfortunately this method is outdated in Unity 4.6, which meant I had to figure this out with the new GUI system. Although there are now two methods that enable alpha and/or color fade function, none of those seemed to work.. I ended up using the solution where I created a new color and then just assigned the alpha of it and then assign it back to the canvas image component. I have also disabled some objects to prevent them from being rendered after the scene was fade out.

     Now I will move on to working on basic game mechanics so that I can have some gameplay in place for tomorrow's demo session. That will include working on movement script first and then maybe adding some objects player can interact with and/or enemies.



Tuesday, 21 April 2015

Level design and animations: Part 4..

     I have fixed camera movement for the cinematographic animation by deleting some key frames and therefore having more smooth camera movement. I have also corrected shake animation so now it should look much more natural. 

     Then I have moved on to playing around with particles and particle animations. I found those quite tricky to get the effects I wanted through animations, but I have managed to create a smoke that builds up as the city 'will be' collapsing.


     More cars and trees has also been added to the level design. Now moving on to more work on animations-this time collapsing city. Let the fun of 48 hours of work for this project begin! :)

Sunday, 19 April 2015

Environment rotation finally fixed! :D

     Going through a lot of websites that were not helpful at all with trying to solve my problem, took me a lot of time. Today after browsing of one questions on StackOverflow I decided to open Unity documentation links that were mentioned there. The same ones I read a lot of times.. What I didn't realise was that a function transform.Rotate() takes x,y,z parameters in order: z,x,y...Noticing that little change I have decided to try this again (even though that was the first function I've tried using but it didn't work). This time I've used the parameters in suggested order...It seems that everything works correctly now and I am really happy finally having this done, as this is one of the most important features I will need in my game.

Level design and animations: Part 3..

Today I have finished level design for cinematic intro animations for my projects. Therefore now I am adding details like cars, trees, banners etc to bring the grey city to life. After that I will move on to creating collapsing animations for the building I may also work a little bit on smoke particle emitter in order to make collapsing animations a bit more 'real'. As well as this I will have to smooth out the shaking camera animations.

Tuesday, 14 April 2015

Level design and initial camera animations: Part 2..

     I am slowly progressing on the level design for short introductory animation scene- so far I have created couple building from assets I got and a short camera intro and shake animations. Now I will move on to create "sinking" buildings animation and then the animations for the cube walls as well as turning the light on and off animation. This will be everything I wanted to have for the intro scene. I will also have to disable players movement in this scene as I want it to be a bit cinematographic. Then it will just be the case of adding GUI at the very beginning so that there is a bit of story before the game begins.


Intro animation and a bit of level design-Part 1..

     Today I have started creating Intro scene that will consist of a short introduction animation with a bit of GUI to tell the story and show the city is collapsing, locking the player in a small area at the same time. All this in order to create a little background story to my project. After this is finished I will work on game mechanics and after that implementing GUI for menu, instructions and credits screen.
For this purpose I used assets I've been given some time ago :)


Thursday, 9 April 2015

Humanoid animations in Unity! :)

     So we were given a model with some basic set up for animations. Today I have been working on implementing those into my project. Setting up an animator with all the transitions is quite easy to do in Unity. So setting up the transitions itself didn't take up much time. Figuring out all needed connections between animator and the script that would enable playing those animations on specific button presses was more tricky to set up. I set couple triggers so that button presses will trigger appropriate animations and connected them in hopefully reasonable way.

     I have also set random number generation(using .NET library instead of Unity random number generation as I found it not accurate enough) so that whenever player stops walking stand animation or stand idle animation is chosen randomly. I did that in order to use as many provided animations for the character as possible and also because I wanted to make it a bit more various.

Here is the screenshot of my animator window in Unity:


Sunday, 5 April 2015

Environment rotation issues...

Before the first demo session I have started working on environment rotation mechanics. I started with easiest solution which would be to rotate the parent of all child wall objects with transform.Rotate() function. Unfortunately it didn't seem to work properly. Then I tried couple other solutions including changing object rotation through transform.rotation by creating a quaternion to change it to. This included using Euler angles to set the values of the quaternion. I have also tried out RotateAround() method and it also didn't seem to be accurate enough.. I am yet to find a working solution to that problem and since animations are most important in this project I will focus on those for now and get back to this problem later.

Saturday, 21 March 2015

Animations in Unity and new project idea..

     Recently we have learned about creating animations in Unity. Next project will have to include animations, so far I have only just started thinking about an idea for that project, as we got only one week for that and for creating something in Unity to show off our base idea at the demo session.

     My idea is inspired by Inception. To make use of animations I wanted to have a short cut scene at the beginning that would show collapsing city and would trap the player in the sci-fi styled box/cube. The main idea is to give player the ability to control the environment on his advantage, therefore I will first focus on enabling environment rotation by pressing specific keys (after I implement character movement animations).

Current scene set up:


Friday, 13 March 2015

An introduction to animations in Unity

    So far we looked at different animation techniques in Unity that included generic and legacy animation systems. As well as this Unity has its own built-in system for creating animations, unfortunately it is very limited to simple transformations like rotation or position change.


Monday, 16 February 2015

Main character

    I have finally changed the main character model in my game and to do that I have used a bit of a trick so that I won't have to worry about game mechanics changing a lot and adding all the same components to the next object. So now main character is a butterfly as this was the best 3d model I could find for free with all animations.

Coroutines experiments

     I have tried to find the idea for what I could use a coroutine in my game. I have decided to use it in a simple script that rotates collectable items. So at first when I have written a coroutine it didn't work. I added yield wait for fixed update method as it is a rigidbody and I have read it may need to be used in coroutines for rigidbodies. It still didn't work properly, but I have added FixedUpdate method to be called after start method and inside it starting the coroutine as well. Now the script finally works and rotates the rigidbody after waiting for 13 seconds.

Sunday, 15 February 2015

Editor Scripts or Context Menu?

     I have tried the second way to implement resetting variables for the script. Using property drawers it is definitely easier and faster way of  implementing this particular functionality but the only drawback is that it is using context menu so you have to click on a specific value to reset the appropriate values. having a button that is enabled through writing an Editor script is much easier to find to know that this script actually has default values assigned for the developer to use. This way, though is faster and therefore may be efficient when working in small teams or individually when time is crucial.

Character and script edition

     I have added a test model of a butterfly to the test scene and I may use it as a main character as I haven't found anything better in asset store that would be free. I have also cleaned up my code a little and changed the names of all private variables to contain m_ before private variable name so that it would be very easy to distinguish public variables from private ones.

Unity Editor Scripts

     Based on the one of the recent lectures I have decided to implement a Unity Editor Script to reset the variables for the scripts in the Inspector. I wanted to start with making all my variables private and using Serialized Fields to make them show up in Inspector but at the first try I have noticed there was a major problem with it.. Whenever those were changed it reset the variables to its initial state. So before I changed all of the fields I decided to write an Editor Script to enable resetting values to the defaults I want. When doing that I also used finding object in hierarchy function that I think was mention in one of the very first lectures. I had problems with setting variables to privates again as it needed getters and setters that would not be static(otherwise serialization doesn't work in Unity-issue which I have encountered). I resolved all these problems and now I have reset button for main character movement script that rests all values to what I want to be default. Then I moved on to making those fields finally Serialized Fields so that they can be displayed in Inspector despite being private.

     Before I attempted creating Editor Script for this functionality I have done some research and I have discovered there is an easier way of resetting values in Unity 4.5 or higher by using property drawers, which I will try to do for another script.

     At this point I have also use GameObjec.Find() method and therefore implemented some of the material covered in the second lecture in this series.

Saturday, 14 February 2015

Unity Engine

     The last lecture in this series was about Unity engine and other game engines in general. Because there are many changes coming up in next Unity versions it would be very useful to start adapting those changes to current projects before the Unity will change diametrically. UI system is already different in Unity 4.6, even though it still supports older UI versions. It may worth starting to think about using the new UI system and learning it as soon as possible as in Unity 5 there will be no way of using the old system. There are more changes coming up such as Scene layers which may be very useful for managing all scenes in the project.

Thursday, 12 February 2015

More on Shaders

     After attending couple workshops on creating shaders at  university I have decided to implement one in my current project. I decided to build on the last shader from the workshop we were given and then trying to experiment a little with it as well. I have also use the material created during one of the other Game Development Society workshops with ISS artist and combining it with a shader has given really nice effect to update the visual feels of the collectable ufo's as now they look more like an actual UFO! :)

In order to achieve the effect I wanted I played around with mathematical expressions to get the appropriate level of emission in a shader.

Saturday, 7 February 2015

Pooling Lists

     Object Pooling is a very useful feature to implement in games. It enables reusing objects instead of throwing them away. I did start writing a simple pooling script some time ago when it was first mentioned during one of the lectures, but I can't see where I could actually use it in my current project as i'm not creating objects during runtime yet. As well as this I have a specific amount of objects player can interact with and therefore those do not need to be thrown away during the game, this way collectable ufo's create the effect of flying away and since they are kept in the scene they become a part of scenery.

Saturday, 31 January 2015

Unity Custom Editor lecture

     Custom Unity Editor Scripts look very useful to learn. And therefore are a very powerful tool for developers who want to adjust the default Inspector. Those help in various situations depending on what is needed, I have decided to implement SerializeField attribute so that I can keep most of my variables private but in order to do that I may need Unity Editor script that will allow resetting variables to make it easy afterwards to recover default values I want for specific variables.

Friday, 30 January 2015

Project feedback and implementation

     Generally I got really good feedback for this project, and over the next couple weeks I will hopefully find the time to implement it. I still have no idea how to balance my game properly but I may just play around with values and see what is working best. I already had a bit of search through Unity asset store to replace the cube as a  main character for my game- the problem with that is I haven't found anything particularly good that would fir my game theme and therefore I may just use some kind of animal model etc.  I will also make sure to change variable names so that private and public variables will be easily recognizable.

Friday, 23 January 2015

Rendering and Shaders

     Writing shaders is very broad and interesting topic. At this point I start to understand how shaders actually work and hopefully in short future I will be able to write one on my own without looking at others work or experimenting with already made shaders. There are a lot of different types of shaders each of which is unique for the purpose they are used for. I will definitely at least try to implement a shader into my current project.

Friday, 16 January 2015

First lecture second term

     First lecture in the second term was about Structs and Classes. Nowadays structs are used for block of data that hold only public variables. It may be useful for creating items that have to be accessible through the whole program. As well as this we learned more about the differences between lists and arrays.