Lillypad: The Start
NOTE (07/21/13): I have made several updates, all of which can be found here: Lillypad. I’ve also added the link to the next update at the bottom of each entry.
This is a project I’ve had on the back burner for quite a while now. Mostly because I know it’s going to be quite a journey. Not “a long term project” or ” a lot of work”, but “a journey”. So, what is Lilly Pad? It’s a game development API for Actionscript 3. Well, it will be anyway. I know this is going to be an adventure to say the least. This is why I put it off for so long, and why I’m writing about it. I’ve set aside a category for this here, and this blog will be my scrum of sorts.
So the big question (or two questions): Why am I doing this? and why not use one of the existing libraries, such as Flixel or FlashPunk? I’ve tried both of these APIs, and they are very good libraries. It’s obvious that a lot of work went into them, and continues to go into them. But they do have some serious short comings that makes them unusable for what I need. Don’t get me wrong, there are many things these APIs got right. However, like I said, there are a couple of major holes in these two, and a number of little things I think could be done better. Don’t get me wrong though. I’m not out to “do it better”. My vision for Lillypad is not to be THE game design API, but to be another option.
Why I started this project:
As I mentioned there were a few things that other APIs were lacking. Below are the three major reasons I finally decided to build my own;
Both Flixel and FlashPunk have a similar way of handling spritesheets. They require an image with frames that are all the same size, arranged in a nice grid (or one long row for Flixel). You then give it the image and the width and height of the frames. The image is then chopped up into even frames that are indexed 0-n. While this is a feature I intend to include, this doesn’t work with Texturepacker. Texturepacker creates sprite sheets that are efficiently packed into as small an image as possible. There is also an option to force the image into powers of 2. Also, the frames aren’t numbered, they’re named! so instead of using an array like this [4, 5, 6, 7] to create a walk animation, I can use this: [“left1”, “left2”, “left3”, “left4”].
There are a couple of other features that I’ve already added to sprite animations while I was working on them: One is a “restore original” flag. When an animation is stopped, this flag determines whether the animation stops on the current frame, or goes back to the first frame. Also, the ‘stop()’ function has an optional parameter for the name of the animation you wish to stop. Otherwise it just stops what ever animation is playing. This helps with race conditions caused by button mashers.
For any sort of tiled maps or game elements, I use Tiled (it’s a great level editor and free, go get it). Tiled has a lot of great features that takes a lot of work out of building games. I will be adding in support for maps created with Tiled.
I have a project that I’ve had to put on hold. For the most part, it’s a 2D casual game that could be built entirely in Flixel except for one part. There’s one part of the game that needs to be done in 3D. I had intended to use Away3D for this, but Flixel doesn’t provide an easy way to drop this into a game (if it’s even possible at all). So right here at the beginning, I’m anticipating the need to play nice with other APIs.
So this is the start. I intend to post updates (almost) every day – life providing. At the beginning I imagine the posts are going to be a bit boring as I’m working more on the framework and foundation of this API. Also, early features are gonna be buggy or incomplete. A perfect example is with spritesheets. For my first experiments working with Texturepacker, I used the XML export, but later decided to use JSON. There’s a slight but very significant difference between how Texturepacker exports XML and JSON. It was a very small, and therefore hard to find, difference that broke things all over the place, so I had to remove support for a feature until I get this fixed. Like I said: it’s going to be an adventure. I’m looking forward to it.