Sunday, 17 November 2013

My First Unity3D Project

Killer Core

Those of you that have followed my old XNA blogs will know that I have had the idea for Killer Core rolling around for an age, have had it in pretty much every release of XNA and of each of the engines I have created with XNA. With the announcement that Unity3D will be a valid development platform for the new XBox One I thought I might as well start work on porting what I have to Unity3D.
I am using the freeware version of Unity3D rather than the Pro, firstly, I am a hobbyist and so have a budget of zero for my projects, but once we can develop for the new XB1 those of us that have registered with the ID@XBox program will get Unity3D Pro for XB1 for free :D So, when that becomes available, I will upgrade my projects to that. Also, in the mean time I can deploy my games in the internet and you guys can tell me just how much it sucks :P
So, I thought I would show you where I am with the project after about a week of development with Unity3D. I don’t get a lot of personal development time, it’s done in my lunch and when I have a free evening or two. This always leaves me thinking “What could I do if I was able to dedicate 7 hours a day to this stuff…” If I win the lotto I’ll find out I guess.

Where was I last week with it?

Last week I had got to the stage where I could create simple scripts and get models on the screen, so I started off by getting the models I had already created in the XNA version(s) and get them into Unity3D. I also have some simple physics and started to play with the basic particle systems, and it looked like this:-
As you can see, my modelling skills are as bad as ever, but, I am trying to focus more on the game mechanic. You will also notice the glitch that occurs when I shoot my first shot, and that the particle systems are destroyed along with the parent object. Both of those things are now resolved and Ill show you what I did to remedy them after I show you what it currently looks at.

Where am I with it now?

As I say, I have resolved the initial creation issue for the shells, I did this in my Shellshooter C# script. I added a void Awake() function, and in there I simply create an instance of the shell, and destroy it there and then.
void Awake()
    Rigidbody t =  (Rigidbody)Instantiate(Block, new Vector3(10000, 10000, 10000), Quaternion.identity);
As you can see I place it a great distance from the scene too just in case my destroy call is not called in a timely manor, not that I can see why it wouldn’t but cant hurt can it :)
So, how about the particle issue, well I had a global static method in my Globals script that I wrote to handle the destruction of objects, so when the object is killed I call Globals.ObjectDeath(gameObject, HideOnDeath); The hide on death parameter is used so if set, the object is hidden first so it’s particle emitter can carry on and the object is then destroyed after the HideOnDeath value in seconds :)
public static void ObjectDeath(GameObject gameObject, float hideTime = 0)

    if (hideTime != 0)
        gameObject.renderer.enabled = false;

        if (gameObject.rigidbody != null)
            gameObject.rigidbody.isKinematic = true;

        if (gameObject.collider != null)
            gameObject.collider.enabled = false;           
    Destroy(gameObject, hideTime);
As you can see, if the hideTime is not 0, i disable the objects renderer, then it’s physics components so they don’t hinder the scene either, the intrinsic Destroy call then handles the destruction of the object after a given time.
So, not the greatest clip in the world, but it’s progress, and I think I have managed to do quite a bit in the short time I have been working in it. Unity3D really has surprised me by how much I have enjoyed using it so far.

What next?

Lots of stuff lol, get a blast effect in there, I would like to get my old XNA flames working in there, so will have to read up on how to create my own shaders next. I am going to try and make a blog post each month if I can. Really need to sort out my terrain/platfom mesh’s they really suck. I can use Blender, I just don’t have the patients for creating decent UV maps, maybe I should :S
Hoping that by the time we can develop the game will almost ready to go into test/release, fingers crossed eh…
Ohh did I mention that the XBox One launch date is the same date as my birthday, how cool is that lol, it will be a new born, but alas, I will be a creaky old 42 :(

Tuesday, 12 November 2013

Unity 4.3 Released!

So, what’s all the fuss about? Well, as you know, if you follow this blog, I am new to Unity, but from what I have gleaned over the past few weeks or so, Unity lacked a fair bit in the area of 2D. They have also has an inbuilt animation tool called Mecanim now, so lots of new stuff in this release making it even more exciting to see what is going to be created for the XBox One platform using this tool :D
The full run down on this new version can be found here.
I am currently downloading it now, looking forward to investigating all the new bits, as well as still learning all the old bits :P

Thursday, 7 November 2013

Unity for ID@Xbox Developers!

I have heard about Unity3D for a long time now, and while I was writing samples and learning all I could about games and graphics programming in XNA I never really gave it a second thought. I think this was because it looked like a simple drag and drop interface for creating simple games, granted across many platforms, but at a price, which as a bedroom coder/hobbyist is not an attractive thing to be.
But, with the announcement that the Unity Pro version would be FREE to ID@Xbox developers, I had to check it out. I first heard about this via the awesome Facebook group I am a member of, Xbox Indie Devs, where one of the guys on there reported that Unity had posted an article on their blog about it, which then also took me to the Xbox news for the same thing, so I had to go and get me a copy to try it out, and I have to say, I am quite impressed with what I was able to do in just a few short hours.
This is the culmination of a couple of lunch hours and an evening with Unity and the Unity online beginners help.
My First Look at Unity
In this scene are three animated mesh’s (you must recognise Dude!) as well as three point lights a number of cubes, and a cavern mesh, I have some physics in there too for the box’s and the dudes.
I am really impressed with Unity, and how easy it was to create something so quickly, even if you are not part of the ID@Xbox program, then I would suggest you check it out anyway. I am just hoping I am going to be able to write my own shaders for it, as well as do Post Processing and all the other great stuff I have learnt from XNA. I dare say I will, I just have lots to learn, again…
So, with that I am hoping to start posting my adventures in the world of Unity, and hope it helps others as they come to use it.