Tuesday, November 15, 2016

#asylumjam2016 So can we go on the bus now?

So I tried my hand at the #asylumjam2016 game jam over the weekend, I say tried because I didn’t finish with a playable game.

The theme was escape the room, which made me think of a short story my wife publish a couple of years ago. It tells the story of Gary, stuck in his primary class room with people from the class that have died.  It becomes evident that he too has died. The idea is that the Non playing characters (NPC) help Gary understand the truth of why he is there.
The game “So Can We Go On The Bus Now?” is a point and click Adventure game, doing all the Graphics, music and coding in a weekend proved too much though. I did go to the Pub Saturday night and also slept 8 hours per night, so about 20hours lost there, so if the challenge was to create a game using 48hour, I maybe could of finished. 

Anyway now for the blah blah on why it failed and what I should have done differently.

To create the game I created two scenes, one is the car crash that kills Gary and the other is the Classroom. The crash scene is non intractable and used as a flashback. It is also an unreliable narrator scene, not what actually happened.
In Inkscape I quickly knocked up the layout of the classroom, I decided on a 2.5d approach, this made creating the graphics that bit trickier.



I created an ItemBase class as a ScriptableObject.

public abstract class ItemBase : ScriptableObject
{
    public Sprite[] sprites;
    public AudioClip click;
    public AudioClip music;

    public string Title;
    public string Description;
    public float ZoomSize = 0f;
    public float ZoomY = 0f;
    public SpriteRenderer spriteRender;
    public GameObject go;

    public abstract void Examine();
}

Then inherited it for Inventory item, NPC or non-moveable that way coding will be easier by avoiding nested if statements. 
Each class has code that it only needs to know about.
Then I created .asset files for each of the objects so I could edit them easily in the IDE.

Still to do:
Conversation system
Inventory
Giving items to NPC


I am going to continue this and get it finished. Making it my 6th game but totally different from previous games, I probably wouldn’t have chosen this type of game but the game jam makes you work outside your comfort zone.

I put it up on the GameJolt site anyway,  but I don't expect any votes as it isn't playable.
It was really good fun creating it though :)


Tuesday, October 4, 2016

Wool is the fuel available on GooglePlay

My latest game is a bit retro, it's like the classic old Defender game. 

It uses my system for Parallax scrolling the backgrounds, you get a HUD to see what alien is going for your sheep.



It has been written in Unity 3D,
I've written all the music myself in Ableton Live 9 lite.
For the sound effects I've used SONiVOX's Twist & Wobble.
The animations were made in Spriter by BrashMonkey the backgrounds and explosions were from their art packs.


Here is the video

Thursday, September 29, 2016

Saving 2 sheep with AZ

I was playing my game wool is the fuel and wanted to record a video of the game play. So I downloaded AZ screen recorder.

After a few seconds I had recorded this snippet.

I liked it because it also records the audio all be it from the speakers though. My previous phone had great speakers but after my cat Clicquot decided to bite through the screen, I had to get a new one (phone that is not cat).
 Clicquot catching munchies

Sunday, September 11, 2016

Wool is the fuel mecanim

I've just uploaded a video showing some of the game play and animations in my Wool is the fuel defender style game.

When developing I used single frame animations to test the mecanim to see that all the states worked. For the Landers, I used different colours to represent each of the states. Then when I was sure it all hung together nicely I created the animations.

Lander mecanim

Drag an image onto the Hierarchy then click Window->Animation

Click add property then click the plus on the right



I use Spriter by Brashmonkey to do the animations, I know I can create the animations directly in Unity and it has advantages with regard the colliders, but for simple animations I still use Spriter.
Also I love all of the effects they have already created for us, look at the video to check them out.


Thursday, August 25, 2016

Unity's Event trigger component

So I was adding my buttons to the game using UI event sytem in Unity.
The Fire and Flip where easy but when it came to the Thrust button I hit a snag. The button click is not enough I need it to respond when the button stays pressed.
To do this I needed to add Event Trigger component to the button.
 
Then in the component click add new event type for Pointer Down and Pointer Up. 

Here is the code for the 2 functions:

    public void ThrustDown()
    {
        IsThrust = true;
    }

    public void ThrustUp()
    {
        IsThrust = false;
    }

Then in the FixedUpdate() check if IsThrust then increase the speed, also I’ve added the code to slow down the player over time with the Speed * .99f:
        if (IsThrust)
        {
            Speed += thrustAmount;

            if (Speed > MaxSpeed)
                Speed = MaxSpeed;
        }


        Speed = Speed * .99f;

Sunday, August 21, 2016

Mutant aliens

When an alien takes a sheep up to the top of the screen it shears the sheep and becomes a fast moving alien mutant. 
What I want is for the mutants to go after the player. To do that we subtract the 2 positions vectors, giving us the difference between the 2 points. I wanted to use that to then set the direction of the mutant. I discovered there is a function normalized that does just that, so here is the code from the FixedUpdate() to do that. By placing it in the FixedUpdate it will continually change course towards the player.

if (IsMutant)
{
    var delta = player.transform.position - transform.position;
    direction = delta.normalized;

}

video
Aliens take sheep to top then change into Mutants

Saturday, August 20, 2016

Attack Waves

In defender all of the baddies don’t all arrive at once there are a number of waves per level. So to do that when instatiating the baddies I'll have a delay between them.

In a previous blog on the development of Rhino roll I used Editor scripting to help create the levels. So I’ll do the same here again. 

Here is my code to create an array of objects in the editor script.

    static void ObjectsToArray(string objType)
    {
        var Code = "private Vector2[] " + objType + " = new Vector2[] {";
        var objs = Selection.gameObjects.OrderBy(go => go.transform.position.x);
        bool IsFirst = true;

        foreach (var item in objs)
        {
            if (!IsFirst)
                Code += ", ";
            else
                IsFirst = false;

            Code += string.Format("new Vector2({0:0.000f}, {1:0.000f})", item.transform.position.x, item.transform.position.y);
        }
        Code += "};";

        print(Code);
    }

Here is the code to add the Menu Items to the IDE of Unity and call the function 

    [MenuItem("Adz/Util/SheepToArray")]
    static void SheepToArray()
    {
        ObjectsToArray("Sheep");
    }

    [MenuItem("Adz/Util/LandersToArray")]
    static void LandersToArray()
    {
        ObjectsToArray("Landers");
    }


The idea is to move the landers aboout, duplicate new ones et.c. then select them all and call the LandersToArray function, like below.

Here is the code automatically generated by the function call. Saves so much time when designing levels, in my opinion.

    void Level1Wave1()
    {
        Vector2[] Landers = new Vector2[] { new Vector2(-48.800f, -0.140f), new Vector2(-42.200f, 1.560f), new Vector2(-11.880f, -1.120f), new Vector2(-5.680f, -0.440f), new Vector2(-0.080f, 2.320f), new Vector2(0.020f, -1.850f), new Vector2(3.500f, 1.560f), new Vector2(24.200f, 0.960f) };
        Vector2[] LanderDirections = new Vector2[] { new Vector2(-0.240f, -0.074f), new Vector2(-0.933f, -0.997f), new Vector2(0.489f, -0.842f), new Vector2(0.702f, -0.403f), new Vector2(0.700f, 0.146f), new Vector2(-0.497f, -0.331f), new Vector2(-0.186f, 0.392f), new Vector2(-0.868f, 0.386f) };

        DoLanders(Landers, LanderDirections, .02f);
    }


Then in the fixed update add the code to invoke these functions after a given time.

        if (CurrentWave < Waves.Length)
        {
            Waves[CurrentWave]--;
            if (Waves[CurrentWave] == 0)
            {
                CurrentWave++;
                var wave = string.Format("Level{0}Wave{1}", CurrentLevel, CurrentWave);
                Invoke(wave, 0f);
            }
        }

As before here is a video to demonstrate. It has 2 attack waves from the aliens. I haven't done any fancy animations for the materialisation yet.

video

Friday, August 19, 2016

Wool is the Fuel

A couple of years ago I created my 1st game, it was Wool is the Fuel.  The idea of the game was that Space ships are powered by wool, so the aliens come to earth and shear the sheep. Originally I was going to have cows, as those aliens can’t resist a bit of cow mutilation, however I thought that wasn’t very child friendly, so as sheep shearing isn’t as murdery I’d go with that.

It was written using XNA and took a number of months. I then rewrote it in Unity in 2 weeks but I scrapped the game as it really was quite rubbish.

Now having written a number of games I’m returning to the idea of Wool is the Fuel. I’m going to combine Wool is the fuels with a game I always loved Defenders. The idea in Defender is that you have to protect your colony of humans from a bunch of aliens. The aliens arrive in waves and after you have cleared all the waves you have completed a level. As the level number goes up so does the difficulty.

So instead of humans, you have to protect your sheep. Also no sheep will be harmed in the playing of this game they cannot die, even after falling from a great height.

My Rhino Roll game has the code for the parallax scrolling backgrounds, so I will reuse that but allow the changing of direction. To do this I add a Collier to the Left and right of the Main camera, when it hits a tile it moves it over to the opposite direction.
When moving right the left collider in green moves A tile to right

When moving left the right collider in green moves E tile to left

As with the Rhino Roll game I am going to have multiple layers of background so you can see the parrallax scrolling.
For the backgrounds I'm using the Delta essentials pack from Spriter by BrashMonkey.

video


 Videos of Scrolling in action

Thursday, July 14, 2016

Game Music

My previous game music was recorded on my bass using Sequel 3 and my ZOOM B3 effects. I liked the tracks but it was so time consuming, if you wanted to change something you would need to re-record it.

So I wanted to create some new music for my new games and bought an AKAI APC Keyboard. This came with a bunch of software and samples.

  • Ableton Live 9 Lite: This is music editing software, it is a cut down version, that allows only 8 tracks and some features are missing. Overall it's a fantastic piece of software, with loads of drums, instruments and audio effects.
  • Hybrid 3: This is a synthesizer with tonnes of presets to play about with, I've not tried creating new sounds from scratch, only tweaking the presets.
  • Twist 2; This is a different synth again with many sounds included. When registering the product though it said it was already in use. An email to AKAI Support and they sorted that out. Some of the presets make excellent game sound effects.
  • Toolroom Artists TFP Pack: this pack has over 1.5Gbs of samples and loops.
Here are a few compositions I've created with the above software. In the games the loop but on Soundcloud they play 1 time.

1st is a bit dancy



Next 2 are a bit housey


I've uploaded 17 tracks in total, have a listen and tell me what you think.

Saturday, February 27, 2016

Shuffa Brick game released.

I've just released Shuffa Brick my new physics based Break out game on Google Play.


 Shuffa Brick on Google Play

Shuffa Brick is a new physics based Break-out style game, except you do not use a paddle to hit the ball. You touch the screen slide then release.


Clear all bricks to complete the level.

Shuffa Brick can be played with just the touch of one finger. 
You touch the screen of your phone or tablet, slide back and release. 
This will rebound the ball in the opposite direction. 

See how you rank on Google play leader board.
Unlock all achievements.

One level only included, let me know if you want me to create more.



YouTube trailer for Shuffa Brick


Monday, February 22, 2016

Shuffa Brick juicy style

In the new game I'm writing, Shuffa Brick, I had each level start with all bricks already in place, functional but a bit dull to look at. After watching another great YouTube video on Juicy game design, I decided to add a bunch of the juicy effects described in the video.

 Juice it or lose it

Animate the bricks coming onto the screen

In the video I saw they used an animation curve to provide the location that the brick should be. So given a ratio of time along the x axis, this will give you a ratio along the y axis for how far it is from the destination, the cool thing is that this can be further than the destination as in my example below, so it gives a little bounce effect.

 my brick curve

If we want the total journey time to be 1 second then after 0.25 secs in according to the curve we will have traveled 50% of the way to the final destination (calling curve.Evaluate(timeGap) would return 0.5 for the y axis value).

Fancy particle effect on the ball

Next thing I added was a particle effect on the ball, the idea is that it leaves a flame like trail behind the ball.
To do this I changed the Color over lifetime going from yellowy to orangish color with a alpha fade.


Explosion effect on the brick

Then an explosion effect when a brick gets destroyed. This is another particle effect to do this I set the same color over lifetime as the ball. I add speed and a gravity modifier to give it the effect.


Comparison Non Juicy vs Juicy

video

Saturday, January 30, 2016

Re-using Unity 2D animations by changing the Sprite at run-time.

In my new game Shuffa brick, I have a number of same sized bricks that I want to animate once and re-use the animation for all colours of the bricks.

I created the animation using a green brick, then in the editor I changed the sprite renderer to use a different coloured sprite.

The change works in the editor, but when running the game it reverted back to the green brick.


In code I tried updating the sprite of the renderer in the Update() of the GameObject but that didn't work either. In the debugger I could see it getting changed but again it went back to the Green brick at run-time.

So in effect what happens is that the animator overwrites whatever sprite we set in code with the one in the animation.

Unite 2014 - 2D Best Practices In Unity

I watched a really good video on YouTube, the important part is where he talks of Sprite animation re-skinning. All I needed from the video was just one word LateUpdate (31mins in). The code in the LateUpdate() is ran after the animator has done it's work. So if we change the renderer's sprite at this moment it stays changed.





Brick animations with LateUpdate()