This blog is about creating simple games, and has been set up to show progress of my first games.
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.
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.
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.
Subscribe to:
Posts (Atom)