Tuesday, 14 May 2013

Runes: Songs of the Gods - Version 0.1

Version 0.1 – Prototyping the design and modelling

The first stage was to create some of the assets I was going to require in my game. The most important assets were going to be the Runes and the game board. I was happy for the runes to be normal cubes since I got quite impatient with Blender at first, but I change that later on in the development process. The gameboard was also of simple design.

I did the cubes in Blender rather than Unity as I wanted to practise UV mapping some more. I made UVmaps and edited some textures in Photoshop to get the look seen below. I also added a skybox which still needs to be tweaked as of the latest build.

This version was simple really. During this version I developed the following areas of the game:

Runes and gameboard had collision added to them and runes had physics added to them to create a cool falling effect once the level starts.

  • Runes and gameboard had their textures added to them
  • I implemented a simple Spawn system for my runes to randomly spawn a type of rune.
  • I added a “wobble” effect to all my runes. I was really happy with this as it was exactly what I had in my design and didn’t have to compromise on it.
  • Once a rune was clicked, it was frozen in place and couldn’t be reselected for X seconds.

The rune spawner is pretty simple really. It doesn’t just change a runes type to a different one. I tried to do that at first but couldn’t get it to work right. What actually happens is it destroys the current rune and then randomly spawns a new one in the exactly same Transform as the previous rune. It does this using InvokeRepeating and spawns new runes every x seconds.

Code-wise I have a sample below but it’s pretty much just a simple select statement.  I call this function every 2 seconds (InvokeRepeating("GetNewRune", 2, 5F);).

void GetNewRune(){
        // Ok all this function does now is destroy and create different rune types
        // On the spot where a different rune was
        // It spawns randomly :)
        if (Freeze == false){   
            int rnd;
            rnd = Random.Range(1, 8);
            //Debug.Log("Random Gnenerated number is: " + rnd);
            switch (rnd){
                case 1:
                    RuneType = 1;
                    Instantiate(Rune1, transform.position, transform.rotation);
                case 8:
                    RuneType = 8;
                    Instantiate(Rune8, transform.position, transform.rotation);
                    Debug.Log("No Case Reached");

The first signs that I didn’t know what I was doing is apparent in my InvokeRepeating call. I specify every 5 seconds but this is irrelevant as only the 2 seconds will be called every time. Meh it works and screwing with it will only cause other things to break so I’m accepting that as a quirk … for now.

My wobble effect is pretty awesome I think and I took it pretty much straight from the Unity tutorials. Just tweeked it a bit:

transform.Translate(0,Random.Range(-2 * Time.deltaTime, 2 * Time.deltaTime),0);

I run the above in the scripts Update() function every time a rune is marked as clicked. It runs for as long as the rune is frozen. It is worth mentioning that the wobble effect did cause my first bug. The runes would sometimes clip into the gameboard and fly off into the air only to land again. Other times they would fall over. I fix this later in the development.

So to summarise I managed to get the following elements working in the first version:
  • Assets textured and loaded into the scene
  • Collision and physics sorted out
  • Code to allow for player interaction/selection
  • Runes randomly spawning implemented
  • Wobble effect and rune freeze implemented
V0.1 - They wobble when clicked ... not much else

No comments:

Post a Comment