Sunday, December 20, 2009

Holiday Cheer

Holy crap lots to talk about!

Site Redesign


As you can see, the site has undergone a redesign. I'm pretty happy with the new color scheme. If you have any suggestions on how I can improve it, feel free to drop them in the comments.

New Jumper


New Jumper! The title isn't final yet. The fourth game in the Jumper series will be played in your browser with the Flash Player.


Development is progressing smoothly. I'm currently writing myself an editor (also in Flash) for the game, but going a bit beyond the call of duty and making it more of a general-purpose editor. I'd like to make something I can reuse between projects. If what I come up with is polished enough, I might even release it for others to use for their projects.

FlashPunk


New Jumper is being programmed using Chevy Ray's FlashPunk engine. I'm helping him bug-test and offering suggestions as I work. The engine seems to be nearing completion, so hopefully that will see a public release soon and everyone can try it out! Trust me, it's really awesome!

Praise!


It's the time of year for top 10 lists and "best-of" lists and other miscellaneous lists! I've been fortunate this year: MoneySeize and RunMan have both made it onto a list each, with the latter even making it onto two.

Edmund McMillan: MoneySeize 5th best Flash game of 2009

Gamasutra: RunMan 5th best indie game of 2009

Play This Thing!: RunMan 4th best indie of the year

In Retrospect


I'm really blown away by the amount of exposure I've been getting this year! The friendliness of the indie community never ceases to amaze me.

I never expected people to flat-out volunteer their help (and contacts) with marketing and selling one of my games, but while working on MoneySeize I had Edmund McMillan approach me and offer to help me sell a Flash game. I really cannot thank him enough for this, and I've heard tell of him coaching a few other indies through the process as well. Really man, you're the best and I hope Super Meat Boy makes you filthy rich.

Later, I participated in Ludum Dare 15 and that was just a blast. I ended up winning second place with Broken Cave Robot, which was very cool.

And then finally: RunMan! Tom and I had been working on this beast for a loooooong time. I'm actually kind of shocked that we finished it at all. But the enthusiasm and support we've gotten from the indie community has been amazing and I'm super happy to see so many people enjoying it. For the curious, our download counter is sitting just below 35,000. We've also entered it in next year's IGF, so wish us luck!

Well, that's it! Merry Christmas everyone!

Labels: , , , , , , , , , , , , , ,

Friday, June 26, 2009

Embedding XML in AS3

I thought I'd write a bit of a technical post for a change, explaining how to embed XML files in a SWF from FlashDevelop. Coincidentally, I used XML to store the layout of MoneySeize's stages, so the example will specifically be geared toward XML representing platformer stages.

Now then, here's an example of an XML stage file from MoneySeize. It's actually just a snippet of a stage file, not a full one:

< STAGE>
< OBJECTS>
< BLOCK X="2" Y="23" WIDTH="36" HEIGHT="4" />
< SPAWN X="6" Y="22" />
< BLOCK X="12" Y="21" WIDTH="4" HEIGHT="2" />
< TUTORIAL X="18" Y="16" TEXT="..." />
< TUTORIAL X="28" Y="22" TEXT="..." />
< BLOCK X="36" Y="2" WIDTH="2" HEIGHT="16" />
< JUMPTHRU X="32" Y="9" WIDTH="4" />
< BLOCK X="27" Y="9" WIDTH="5" HEIGHT="2" />
< COIN X="28" Y="7" />
< COIN X="30" Y="7" />
< COIN X="32" Y="7" />
< COIN X="34" Y="7" />
< BLOCK X="17" Y="8" WIDTH="5" HEIGHT="2" />
< BLOCK X="2" Y="9" WIDTH="10" HEIGHT="2" />
< CHEST X="19" Y="7" COINS="5" />
< DOOR X="5" Y="8" />
< BLOCK X="37" Y="20" WIDTH="2" HEIGHT="3" />
< BLOCK X="1" Y="5" WIDTH="3" HEIGHT="4" />
< BIRD_GOLD X="2" Y="4" COINS="3" TIME="5" />
</ OBJECTS>
</ STAGE>

The XML is pretty self-explanatory. As you can see, the stage contains an objects tag, which contains a list of every game object on the stage. Objects include blocks, coins, "tutorials", "jumpthrus" (one-way blocks), etc. Each object tag includes its x and y positions (divided by 16, because the game is grid-based) and any other applicable attributes (for example the CHEST tag contains a COINS attribute to indicate the amount of coins in the chest).

Of course, designing levels by typing raw XML into a text file isn't very intuitive, so it's nice to have an editor.

So now that we have the XML, our goal is to embed it in our SWF. Then, at some point as the game is running, we will load and parse it to build the level it represents. Here's the code I used to embed the XML:

public class Levels 
{
[Embed(source='../../../assets/levels/Level1.xml',
mimeType="application/octet-stream")]
public static const Level1:Class;
}

The "application/octet-stream" MIME type allows us to embed any asset as a byte stream. The last step is to load the XML into memory and parse it:

var file:ByteArray = new Levels.Level1;
var str:String = file.readUTFBytes( file.length );
var xml:XML = new XML( str );

Here we load the level as a ByteArray, then convert it to a string. This string is the raw XML of the file in string format, which we can use to create an XML object. Now we use the interface of the XML object to parse the level data:

var o:XML;
for each (o in xml.OBJECTS[0].BLOCK)
{
addChild( new Block( o.@X, o.@Y, o.@WIDTH, o.@HEIGHT ) );
}

For MoneySeize, it is known that each level file only has one OBJECTS tag, so we can simply access xml.OBJECTS[0] to find all the game objects. xml.OBJECT[0].BLOCK is another XML object: it contains every BLOCK tag within the OBJECTS tag. We simply traverse every tag in the object, adding a block object to the level for every BLOCK tag.

Note that the @ symbol is used to access the attributes within a tag.

Labels: ,

Saturday, May 23, 2009

Birds That Fly


I'm a big fan of "time trialing" in platformers. This much is obvious if you look at my previous games: FLaiL's scoring system was based on time, with your total score from all stages determining your progress through the game. Jumper Three had time trial goals for each stage, and the medals you earned by beating them unlocked secret stages.

The structure of my current project is again new: each stage contains 25 coins and a door. Your goal is to grab as many coins as possible and then exit through the door. The coins you've collected are saved, and you can return to the stage later to collect any you missed. Your total coin count unlocks new worlds for you as it surpasses certain thresholds.

Now, this is not a friendly format for traditional platformer time-trialing. Usually, a time trial consists of the player making their way through the stage as quickly and efficiently as possible, and upon completion they receive a bonus if they went fast enough. This is trouble because the door in these stages is sometimes right next to the entrance of the level. Even if it is a bit further away, the door usually isn't all that interesting to reach - the real meat of the stages is in grabbing the coins.

My solution is the golden bird above. I can place the bird anywhere in a stage, and it flies away after a certain amount of time has elapsed. If you jump on it before time is up, it drops precious coins for you to pick up. Not all stages have a golden bird, letting me save time trials for the stages that can really make them interesting.

I loved the idea of incorporating time trials into the environment of the levels so much, I ran with it and ended up including other color birds with different fly-away conditions. For example, a pink bird flies away if you kill any enemies on the stage, making for some interesting situations where the player must go out of their way to preserve the wildlife.

Labels:

Monday, May 18, 2009

Game Maker For Toolset Development


I spent yesterday and part of today developing this editor for myself, to help me design the stages for my Flash platformer project.

The editor allows me to place game objects and resize/move them. I can also edit arbitrary amounts of "attributes" for placed objects (for example, I can place a treasure chest then specify the amount of coins in it, but other objects might have different attributes such as speed or direction that I can tweak).

I used Game Maker to build the editor, and it worked out perfectly. I even have it automatically spitting out XML files (which the game translates into levels) and backup files (which the editor can load to edit the stages) right into the project's assets folder. Now I can really start producing content.

The editor probably won't ever be released publicly, except maybe as an example. It is pretty rough around the edges and allows the user to do things that wouldn't work well in the game, such as setting moving platforms or enemies to travel through solid blocks. As a developer tool, though, it works great.

Overall, I'm really pleased with how easily I could hack together an editor in Game Maker. I'm aiming for the entire development cycle of this project to be shorter than a month, so I don't have much time to muck around building tools for myself. As a bonus, I was able to code the editor in a way that it can potentially be very reusable for me (it is very easy to add or remove objects or change the output format).

Labels:

Tuesday, March 17, 2009

Flash Platformer Engine

It's my birthday in 23 hours! Too bad I've got a mountain of homework to deal with this week. Ah well, that's what weekends are for.

Anywho, I've made an awesome step forward on the game development front: I've worked out a (very) basic platformer engine in Flash! It really doesn't look like anything special right now, but I've programmed the back-end to be very extensible and it will be completely reusable for me for any platformers I want to make in Flash. It feels great to have the foundation built, so now I can construct the worlds I really want to create on top of it.



I've embedded the basic engine above, for the curious (you'll need Flash 9+ to play it). Use the arrow keys to move and the 'S' key to jump or double jump. Keep in mind that the feel of the game (jump height, run speed, gravity, etc) is by no means final for any of my projects, I'm just messing around with it for now. Hopefully the next time you see this engine, it'll be in an actual finished Flash game!

Labels: