Flappy Alex: In Miracle World

February 26th, 2014

I recently entered into Flappy Jam; the Flappy Bird game jam. Click here to play it! With the very simple requirements being  just to “make a hard, almost unplayable game, using assets inspired (not ripped) from classics”,  I figured it would be fun to spend a few evenings bringing to life an Alex Kidd themed flappy bird game :D

I recreated all the graphics myself using GIMP, and made full use of the great new 2D sprite tools in Unity 4.3.

Unity Development | No Comments | Trackback

Super Clone Box – Part 2

September 25th, 2013

If you missed the last post, here it is.

So, 2 weeks in, and I am absolutely loving this project! Something about seeing those little green bastards monsters strutting their stuff in all their pixelly goodness just fills me with joy :)

So, since the last update, I’ve written my own SpriteManager solution! It works in conjunction with an external sprite packing program appropriately called SpriteSheetPacker. SpriteSheetPacker just takes all the individual sprites and fits them nicely onto one texture atlas, and spits out a data text file describing the UV pixel coordinates of each frame by name. I’m then parsing this data file in my SpriteManager component as an offline pre-processing step in the editor so it has the information required to render each frame (the normalised uv coordinates based on the width and height of the texture). From here I’m able to setup any animation using those frames, and through some custom Inspector class magic, preview the animations in the Editor. It currently handles sprite mirroring, rotation and vertex colour tinting for each frame, and although the workflow could do with some tidying up and simplifying, I’m very happy with it so far and it’s enough to handle most if not all of the sprites in the game.

The second big thing that I’ve worked on since the last update, was the player controls. I was originally using Unity’s built-in rigidbody physics components, and by locking the rotation on all axis and the z-depth positioning, I was able to achieve a decent-ish 2D player control system. But, there were a number of annoying little “glitches” which I couldn’t seem to fix without losing some other crucial functionality. For instance, if my player jumped straight upwards and collided back down onto a platform, it would move a tiny amount to the side, even though everything was flat and level (perpendicular box colliders…). The problem was most noticeable when you’d jump the player repeatedly on the spot, and it would gradually move to the left (you can see it happening in the first build). I played around with the physics loop frequency and the physic material friction settings to try and prevent it, but nothing stopped it. I imagine it’s to do with some sort of rounding/approximation error when re-positioning the intersecting colliders. Unity is a 3D physics engine after all, so it probably wasn’t built to cater for the acute, twitch controls of a 2D platformer like Super Crate Box. I daresay that Unity 4.3′s promised 2D specific physics engine will help solve this problem in the future! But this is now, 4.3 isn’t out yet, so I’ve gone a different route.

For the players physics, in order to get the super fast response and feel of the original game controls, I opted to implement my own basic physics engine. I’m simulating a gravity force, checking for intersections between the player and the platforms colliders every frame, and then handling the resulting collision between them. It seems mad, I know, but it’s working! I have complete control over the players movements now, and until it starts running like a total pig, I’m gonna keep it like that :)

For the weapon name effects when you collect a new crate, I found this great text animation plugin, which did the job fantastically ;)

One more thing, a little tip for creating great high quality pixel art; create your pixel images originally at pixel scale, and then upscale them to the size you need them in your game with the quality interpolation settings set to none. This stops your image processing program from anti-aliasing all of your nice pixel crisp edges when increasing the scale! Genius. ;)

Click here for the latest WebPlayer build.

Comments and feedback are welcome!

Uncategorized | No Comments | Trackback

Super Clone Box – Part 1

September 14th, 2013

Ok, so I’m a Unity game developer, but I don’t actually have any independently developed finished Unity games to brag about to anyone and show that I CAN actually make games (“I swear I can!”). That needs to change. I’ve gotten my TextFx plugin to a stable polished state, which I’ll continue to maintain and release small updates to, but I need a new main project and that needs to be a game this time! But… making a game takes ages, especially if you keep changing your mind about what it should be like and getting distracted by other game ideas to prototype… which is what I’ve basically done over the last year or so. SO I thought of a way to hopefully speed up the development time of this game; I’ll make a game that already exists!

Deciding which game to make was easy; it’s one of my favourite games, I play it all the time, I know it inside out, it’s Super Crate Box (If you haven’t played it yet, go get it now! It’s free!  http://www.supercratebox.com/).

Lets recap my motives and intentions with this project. Primarily I’m making a Super Crate Box clone in Unity to serve as a portfolio piece and to learn more about the creation of 2D arcade games. Beyond the primary intention, I have a few ideas of where I may take things; thinking of putting it up on the AssetStore as an example project, I want to make it work on mobiles, and I might add some addition unique features to the original game to see what happens and maybe appeal to some other SCB fan-boys out there.

What I’m not going to be doing is releasing a paid Super Crate Box clone game. To start with I want to try and make as accurate a copy of the original as possible, using the original assets where possible. But if I do decide to release the game either as an AssetStore example project or as a free online SCB game mod, I will first replace all the assets with my own versions.

While I’m developing the game I’ll try to write regular blog post updates, documenting the progress and any technical challenges that have been overcome, and I’ll include webplayer build updates for people to play aswell. Hopefully it’ll be of interest to Unity developers, game developers in general and also fans of the original SCB

So I’ve spent a few evenings getting the project started, and I’m already loving it! So far I’ve just got one level, with a player, one enemy type and 5 weapons, but it’s playable and you can try and beat your highscore. Seeing as this first post is already quite long, and so far I haven’t had to tackle any real technical challenges, I’ll leave the technical breakdowns until next time! For now though, here’s a screenshot of the level in the editor window, with gizmos marking out the areas where a new crate can be spawned.

Click here for the webplayer build.

Obviously, there’s lots still to do and to tweak, so go easy with it!

Unity Development | No Comments | Trackback

TextFx Released In The AssetStore

June 3rd, 2013

TextFx – Unity Plugin - Asset Store LinkWeb Player Demo

TextFx is a text animation plugin for the Unity Game Engine, which I started working on in January 2013. Meant as a quick “one month project”, and in the end taking about 5 months, consisting of evenings and bits of weekends. But it’s finally finished! :D

I was inspired to make TextFx after working on this website late last year, and getting completely carried away making interactive headers for the site (notice above!). I then started to wonder how I’d go about making some cool text animations/effects within Unity, since I’d not done anything this fancy with Unity texts before. I’d already assumed that there was no in-built support for this in Unity, but I figured there’d be a few well embedded solutions in the Asset Store. What?! None? (None like this at least…). “Well, I guess I’ll make one then…”

I wanted to make a system that would allow you to create pretty much any text animation you could think of. It had to support in-editor offline playback, and provide instant feedback on how your effect will play and appear in the scene. It had to be quick, easy and intuitive to use. I wanted users to be able to experiment and explore different ideas as soon as they thought of them.

It’s become far more than I first envisaged back in January; the scope just kept naturally expanding as I went along! “Well, it can’t have that feature and NOT have these 3 features as well…”. But what I’ve finished with 5 months later is a product that I feel can genuinely bring something new and fresh to any Unity project, and I dream of the day when I’ll hopefully see this plugin being used in some awesome Unity games of the future!

Unity Development | No Comments | Trackback

Add copy/paste functionality to all object Transforms in Unity

December 1st, 2012

I’m going to focus my first Unity developer tutorial on something that I personally would’ve loved to know about a year ago when I started using Unity! I’m not sure how big a deal this is for other Unity devs, but the number of times I’d be playing my game in the Unity Editor, seeing how things played out, then playing around with objects in the scene while it was still running, moving everything into its perfect position, then realising that it was all going to snap back to how it was before when I stop playing that instance! Wouldn’t it be great if you could just copy the positions of the game objects in the scene and then paste them back after stopping the game…?

This tutorial will go over how to write a Unity editor extension for the Transform component, which will add “Copy/Paste” buttons to the Inspector for every GameObject in your project.

We’ll start by adding our own reverse engineered version of Unity’s built-in UnityEditor.TransformInspector class into our projects “Editor” folder. This script was based on a script posted on the Unity wiki here, and I’ve added two (currently useless) buttons, “Copy” and “Paste”.

Note: It is important that this script gets added to a folder named “Editor” in your project hierarchy, otherwise it won’t have any effect! If you haven’t got an “Editor” folder, then create one.

using UnityEngine;
using System.Collections;
using UnityEditor;
public class TransformCopy : Editor
	public override void OnInspectorGUI ()
		Transform t = (Transform)target;
		// Replicate the standard transform inspector gui
		EditorGUI.indentLevel = 0;
		Vector3 position = EditorGUILayout.Vector3Field("Position", t.localPosition);
		Vector3 eulerAngles = EditorGUILayout.Vector3Field("Rotation", t.localEulerAngles);
		Vector3 scale = EditorGUILayout.Vector3Field("Scale", t.localScale);
		if(GUILayout.Button("Copy Transform"))
			Debug.Log("Copy Transform");
		if(GUILayout.Button("Paste Transform"))
			Debug.Log("Paste Transform");
		if (GUI.changed)
			Undo.RegisterUndo(t, "Transform Change");
			t.localPosition = TidyVector3(position);
			t.localEulerAngles = TidyVector3(eulerAngles);
			t.localScale = TidyVector3(scale);

You should now notice that all of the Transform components in your project have an additional two buttons added to the bottom. How handy!

Now lets make those buttons do something useful.
Add this static string variable to your TransformCopy class:

public static string TRANSFORM_COPY_PREFIX = "eqguqero124";

Add this within your “Copy Transform” button if statement (line 23 in script above):

PlayerPrefs.SetFloat(TRANSFORM_COPY_PREFIX + "_pos_x", t.localPosition.x);
PlayerPrefs.SetFloat(TRANSFORM_COPY_PREFIX + "_pos_y", t.localPosition.y);
PlayerPrefs.SetFloat(TRANSFORM_COPY_PREFIX + "_pos_z", t.localPosition.z);
PlayerPrefs.SetFloat(TRANSFORM_COPY_PREFIX + "_rot_x", t.localRotation.x);
PlayerPrefs.SetFloat(TRANSFORM_COPY_PREFIX + "_rot_y", t.localRotation.y);
PlayerPrefs.SetFloat(TRANSFORM_COPY_PREFIX + "_rot_z", t.localRotation.z);
PlayerPrefs.SetFloat(TRANSFORM_COPY_PREFIX + "_rot_w", t.localRotation.w);
PlayerPrefs.SetFloat(TRANSFORM_COPY_PREFIX + "_scale_x", t.localScale.x);
PlayerPrefs.SetFloat(TRANSFORM_COPY_PREFIX + "_scale_y", t.localScale.y);
PlayerPrefs.SetFloat(TRANSFORM_COPY_PREFIX + "_scale_z", t.localScale.z);

Add this within your “Paste Transform” button if statement (line 28 in the script above):

Undo.RegisterUndo(t, "Transform Paste");
// General object transform data found
t.localPosition = new Vector3(PlayerPrefs.GetFloat(TRANSFORM_COPY_PREFIX + "_pos_x"), PlayerPrefs.GetFloat(TRANSFORM_COPY_PREFIX + "_pos_y"), PlayerPrefs.GetFloat(TRANSFORM_COPY_PREFIX + "_pos_z"));
t.localRotation = new Quaternion(PlayerPrefs.GetFloat(TRANSFORM_COPY_PREFIX + "_rot_x"), PlayerPrefs.GetFloat(TRANSFORM_COPY_PREFIX + "_rot_y"), PlayerPrefs.GetFloat(TRANSFORM_COPY_PREFIX + "_rot_z"), PlayerPrefs.GetFloat(TRANSFORM_COPY_PREFIX + "_rot_w"));
t.localScale = new Vector3(PlayerPrefs.GetFloat(TRANSFORM_COPY_PREFIX + "_scale_x"), PlayerPrefs.GetFloat(TRANSFORM_COPY_PREFIX + "_scale_y"), PlayerPrefs.GetFloat(TRANSFORM_COPY_PREFIX + "_scale_z"));

You should now be able to copy and paste any objects Transform data, and paste it onto other objects. This works by saving the state of the Transform into the PlayerPrefs, which is stored locally on your PC.

In order to ensure that the transform data doesn’t get saved over any existing game data with the same key name, we’re prefixing the data keys with the unique random string TRANSFORM_COPY_PREFIX.

Unity Development | No Comments | Trackback

New Blog Started!

September 5th, 2012

Hi everyone, I’m Tom Figg, author of this here new blog.

I’m a computer games developer and general application programmer. Check out my previous works under the Portfolio section of this site.

Here I’ll be blogging about various development how-to’s and also my personal projects and independent releases.

I’ll be mainly aiming my content at fellow programmers and games development enthusiasts.

I’m currently quite an avid Unity game engine fan, using it for my day job and in my personal projects, so expect there to be an emphasis on Unity development to start with!

General | No Comments | Trackback

Recent Posts

  • 11 days ago

    RT @BilboTalk: Wrote this about the whole Sainsbury's vs John Lewis debate. http://t.co/PA21phcfDh

  • 19 days ago

    Get 50% off TextFx on the @UnityAssetStore right now! Sale ends in 4 hours! http://t.co/qLRXIY65dt

  • 19 days ago

    RT @UnityAssetStore: Turn your boring texts into buckets of fun! Get today's #AssetStore 24 Hour Deal: 50% off TextFX: http://t.co/ufUd3FeR…

  • 38 days ago

    Second time seeing @littlecomets this month; tonight was ruddy fantastic! http://t.co/HHNWocleI8

  • 73 days ago

    Just pre-ordered the new @littlecomets album, and can not WAIT to see them in London on Oct 20th! Pre-order here http://t.co/INTHFSkvg4

  • 94 days ago

    It's really great to see TextFx in action in a released game; Dimentia 3D uses it throughout :) http://t.co/ml8yH3aYlI #unity3d #assetstore

  • 103 days ago

    Probably should've gone to specsavers... DK2; I'm gonna have fun with this! #OculusRift #DK2 http://t.co/SCPzWB2d01