UP DOWN READY

Hi there! You've probably reached this page from the Freeplay website in search of the elusive 'Up Down Ready' which took Best Design in this year's awards.

UPDATE: Hello! If you've arrived here from StumbleUpon, why not go play the game now on Kongregate! With high scores and EVERYTHING.

The versions of the game that were on this page were hosted on Dropbox. Since the recent spike in traffic, Dropbox has cut off access to my public folder. I will hopefully be migrating this stuff across to an actual server, but the version on Kongregate is the official release.

I'm Delia, the Sword Lady half of Sword Lady and the Viking. You can find my teammate over here. We are third year students in the Games Design course at Griffith University, and Up Down Ready (previously known as Horse) is our first semester project from this year, made using Adam Atomic's free Flixel library.

We entered it in the Freeplay Awards for a lark, and were incredibly surprised and excited to make it to the finals and take away an award. We hope you enjoy playing the game as much as we enjoyed making it!

- Delia

Saturday, August 21, 2010

A horse by any other name...

Hello the internet!

I have not been great about updating this. THINGS have been HECTIC.

Yes, Henrik and I went to Freeplay, and as you can gather from the sticky post at the top of the page, we WON a thing. The good fairy Freeplay Awards saw fit to turn our little Horse into a Real Game with the magical (rather hefty) wand of Best Design in a Game trophy.

And now that we've gotten through that rather strained metaphor - what is on the cards for me this semester?

Priority number 1: Get the newly christened Up Down Ready onto its feet (hooves?). I am, as we speak, spitting and polishing and integrating with the Kongregate API. We have also bought a domain and hosting, so UDR will be up there as well, with a separate mySQL highscore database.

The 'official' release will happen in the next week, so expect shameless and constant plugging of the game around then.

Then the Viking and I will be moving on to another little game currently known as Snowball. More on that when we get up to it, since we'll need to scope down and just build something as fast and tight as we can. I'm hoping to continue work on the Unity sound handler thing, too, since this semester we have an actual for reals sound designer.

First, though, we gotta get Up Down Ready ready.

In the meantime, be hoopy and stuff.

- your friendly neighbourhood sword lady

Thursday, June 17, 2010

Horses for courses

The last gasp of Horse. Here it is, in all it's end-of-semester glory:

I'm not exactly sure about how the high score stuff will work online. It was sort of a last-minute why-not addition, so I have no idea how it will work with multiple users accessing it from different computers. It works on a local computer though.


Enjoy!

Some quick documentation for the sound system

This might be kind of dry, because I haven't had a chance to go through and add screenshots etc. But here is the documentation for the Sound System as it stands now.

The Sound System is a general purpose sound handler written in C# for game development projects in the Unity environment. It is designed to allow developers and/or sound designers to centralise control and handling of all sound effects and music.

Soundscapes are defined in XML and loaded from within Unity. The system itself is comprised of a single gameObject with a set of public static functions that can be called from any other script in the same scene. This mitigates the need for Unity AudioSources to be attached to specific gameObjects, allowing them to be instantiated dynamically at runtime using simple function calls.

Setting Up the System

1. Import the SoundSystem unity package into your project

By default, the system and all attached scripts will be placed in the Standard Assets folder.

If your project uses C#, you may choose to move the SoundSystem to a different location according to the specific requirements of the project.

If your project primarily uses JavaScript or Boo, it is recommended that you leave the Sound System in the Standard Assets folder due to potential compile order issues with non-C# scripts accessing the Sound System.

2. If you have not already done so, import the audio files for use in your project.

These will need to be placed in a Resources folder. An empty Resources folder is provided in the unity package. However, according to the Unity documentation, Resources folders can exist anywhere in the project hierarchy as long as they are correctly named.

3. Setup the XML resource file

The XML template is called SoundSystemXML. You can edit this file directly, or create a copy so that you have a template to refer to.

The XML file should be included in the same Resources folder as your Audio files. This ensures that it will be included when you build the scene. If it is not, you may encounter problems with the audio not playing when exporting your project as a standalone or web player build.

There are three kinds of objects that can be defined in the XML file (I can't display the XML correctly on the blog because the tags look like html and the text doesn't show up).

  • SoundEffects, which represent a single sound that is played once or looped (eg. Character noises, environment sounds, looping ambient tracks. Can also be used for music). This is basically a single sound clip.

  • SoundSets, which represent a set of related sounds that can be played randomly once or at set intervals (eg various similar gunshots or explosions, bird calls, lines of character dialogue that can be selected randomly for NPCs). This can have as many clip elements as you like. The numclips property must match the number of clips elements you have included.

  • SoundPairs, which represent sounds that have an 'initialisation' followed by an indefinite loop (eg. A car starting and then the engine idling for a random period of time). This has two clip elements – the first one listed will be the initialisation sound, and the second the looping sound.

For each object, name is the name you call the object by using sound system functions, and clip refers to the import name of the clip in the Unity Inspector. Keeping these things distinct can be useful if you are using effects from various sources and need to keep track of attribution. All of the name properties you assign must be unique, or the system will not be able to load the sounds correctly.

There can be as many SoundEffects, SoundPairs and SoundSets as you like within the XML file, and they can be placed in any order within the SoundScape.

Using the SoundSystem methods

In order to use the SoundSystem methods, you will first need to place the SoundSystem prefab somewhere in your scene.

In the inspector, you will need to change the public variable XMLFilePath on the prefab to reflect the location in the project of your XML file. The default example is Assets/Standard Assets/Resources/SoundSystemXML.

SoundSystem methods are called from any script in the same scene as follows:

SoundSystem.methodName(“soundName”, objToPlayAt);

where soundName is a string and objToPlayAt is a gameObject (in most cases this will be the gameObject attached to the script you are calling the sound system from.

Some methods are overloaded to allow the user to specify volume as well. In later iterations, these will be further extended to provide finer control over how the sounds play.

The functions available in the current build of the SoundSystem are

playOnce(String Name, GameObject Caller)

This plays a one shot sound using Unity's playClipAtPoint() functionality and can be called on any clip loaded into the sound system, even ones contained within a SoundSet or SoundPair.

play(String Name, GameObject Caller)

play(String Name, GameObject Caller, float volume)

These play the sound object with the specified name once and parent it to the Caller object. Can be called for any kind of the three sound objects.

startLooping(String Name, GameObject Caller)

startLooping(String Name, GameObject Caller, float volume)

These start the sound object with the specified name looping and parent it to the Caller object. Can be called for any kind of sound object.

stopLooping(String Name, GameObject Caller)

This will stop the named clip from playing, and turn off looping. Can be used to cut a playing sound short if required. Can be called for any kind of sound object.

playAtInterval(String Name, GameObject Caller, float interval)

playAtInterval(String Name, GameObject Caller, float minInterval, float maxInterval)

playAtInterval(String Name, GameObject Caller, float minInterval, float maxInterval, float volume)

This will start the named SoundSet playing a random clip at the specified interval, or at a random interval between the specified max and min intervals. Can currently only be called for a SoundSet object, a SoundEffect or SoundPair will simply do nothing and log a SoundSystem warning.

I will upload and post a link to the current version of the Unity Package, so if anyone wants to play with it they can. I will also be updating this documentation as I further develop the system - it's still very much in the early stages.

Saturday, May 29, 2010

Also also

Before I go to bed, the current build of Horse. The code has progressed a long way since the last build (hey, don't knock it, it got me a job), but the inclusion of assets has gone backwards. Lots of placeholders here - squares in the background will be randomly spawning stars, stuff like that. Asset handling is still a little messy, hence the large filesize. I'm a-working on it, as per my previous posts. Apologies to Henrik and Kai for not having all their rad art in at the moment.


There's a new mode though!



You guys! It's going to be SO RAD SOON.

Codespam

Okay so this is mostly a note for myself so that I remember when I go to work on it later.

But I SHOULD be able to fix some performance issues with the sound system by using UnityEngine's Object.GetInstanceId(), which returns a guaranteed unique id for every object. I can concat the unique gameObject id with the name of the soundEffect that has been paired with it and use that as the key when I want to lookup that specific soundEffect instance again.

Which in turn means I can eliminate the Transform.FindChild() call I am making in startLooping and stopLooping.

Which, gentle readers, should make it run faster since I am not searching a gameObject hierarchy every time a sound system method is called.

That said, you should still only be calling startLooping or stopLooping once on a state change, not every frame the object is in a state that needs a sound effect.

/spam

News from the northern front, at last! Also: using SWC files with Flixel in Flex Builder 3

Ohai there.

Apologies to anyone reading for the lapse in posting over the last couple of weeks. THINGS have been HAPPENING.

The main thing being that within the space of the last week, I put together a resume and folio, went to an interview and got offered a job as a Flash programmer and game designer at 3 Blokes Studio. I'm to start next Thursday, so everything is a bit of a scramble at the moment.

ANYWAY.

I have been looking into better ways of importing assets in Flixel. It is kind frustrating and there aren't many good ways to do it, because Flixel really is designed to use embedded graphics. Which in the case of Horse will mean a zillion frigging lines of embedding all the sprites. This is not code which I want to have to write. And anything that involves reading files from a folder makes it a pain in the butt to put on the interwubs.

I just spent several hours looking into using an SWC exported from the Flash IDE as mentioned here. The linked post discusses how to do in a regular AS3 Project in Flex Builder, where you can happily access Flash's MovieClip or BitmapData classes with no problems.

Unfortunately it's not quite as simple for the Flixel library. In order to be useful, a graphic must be loaded into a FlxSprite instance so that all of Flixel's clever collision magic can happen. As far as I understand it (and I might be wrong), to do this, you need pass in a class that inherits from Bitmap - which is exactly what gets created when you embed an image directly in an AS3 file, thus:

[Embed(source = "data/bg2.png")] protected var ImgBG2:Class;

The Flash IDE, however, exports JPEGs and PNGs as extensions of the BitmapData Class, which Flixel's FlxSprite can't use as input.

I spent some time grovelling over these threads trying to figure out what to do - it seemed like the only way to use these BitmapData classes was to directly modify the .pixels property of the sprite, which sort of defeats the purpose of handing Flixel a spritesheet and telling it to go do its stuff.

But then I found THIS, which solves everything magically with a few lines. So thanks to Flixel forum user L_O_J for that fix.

Ok, so there is still some faffing around that needs to be done with loading the sprites. But I am content with the amount of embedding and related horrors that this will save me.

SO. Here is how to do it.

1. Open up Flash and import all your graphics into a new .fla file. (I'm going to assume you're clever enough to not need screenshots for this bit).

The next part unfortunately could be a bit of a grind, depending on how many assets there are.

2. Export the graphics for ActionScript. EDIT: Export in frame 1 MUST be ticked, or Flash won't export the files to an .SWC when you publish.



2a. Make sure the ActionScript class names DO NOT include a filename extension, such as .jpg or .png, because that makes ActionScript explode when you try to access the class. There doesn't seem to be a way to get flash to import files without including the extension, so yeah, this bit is not so great if you're doing it in bulk.

I would recommend taking the file extension off the end of the library item name and then selecting all the items and exporting them all in one go, rather than exporting one by one.



There's always this extension for Flash which you could use, but it's only useful if you don't need specific naming conventions.

3. Go to Publish Settings and make sure it is set to export an SWC file when it publishes

4. Publish the file

5. In Flex Builder, go to the properties for whatever project you want to use the assets in. Under ActionScript Build Path, click on Library Path and Add SWC, and point it to the SWC you just created.



6. This bit is crucial for use with Flixel! Add the following code to the FlxG.as file of the Flixel library, as shown here:

This at the top of the file:


// needed for processing bitmapdata

import flash.utils.getQualifiedSuperclassName;


And this in the addBitmap() function:


if(!checkBitmapCache(key))

{

//--------CHANGED CODE FOR PROCESSING BITMAPDATA FILES CONTAINED IN AN SWC

/*replaces/adds to the following line:

_cache[key] = (new Graphic).bitmapData;

code found at http://flixel.org/forums/index.php?topic=628.msg4563#msg4563

thanks to flixel forum user L_O_J*/

var classType:String = getQualifiedSuperclassName(Graphic);

if (classType.indexOf("BitmapData") == -1)

{

_cache[key] = (new Graphic).bitmapData;

}

else

{

_cache[key] = new Graphic(0, 0);

}

//---------------------------------------

if(Reverse) needReverse = true;

}

And there! You should now quite happily be able to access the files by class name as if they were embedded in the .as files, without the hassle of copying filepaths and assigning new class names.

Friday, May 14, 2010

For certain values of progress

I am currently (still) working on refactoring the code for Horse. Because it is a mess.

This is largely due to the fact that we are on such a tight schedule - I never got the time to throw away my original prototype and rebuild the game on a more solid base. In addition to this, we didn't have a full design treatment before we had to start producing working builds, so I couldn't account for what was going to go into the game.

The net result is that there are hacks on top of hacks and weird bits of redundant code, which I am in the process of fixing up.

I'm a bit behind on the sound system. Hoping to get some more stuff into that over the weekend and have a preliminary music handler built this coming week so I can focus on producing the actual music and sound effects for the games.