Hey my lovely TIGgers! Some of you have heard of my Flash game library, FlashPunk. Well,
Version 0.85 is out now, and I've
uploaded it to my site!
www.flashpunk.net Download the Library Online Documentation IRC Channel
What is this?Flixel?Sound familiar? Many of you have heard of or use Adam Atomic's lovely
Flixel library, which is designed to do the very same thing. FlashPunk was the result of my deciding to create my own library because I was not comfortable with the structure of Flixel and wanted things to work my own way. After doing tons of research, and a few months of coding, I finished it, and decided that I'd pass it around so that others could use it as well.
What's the difference?Someone
brought up FlashPunk on the Flixel forums awhile back, so I took the time to explain some of the key differences between the two libraries so if people are wondering which is "better", they can
instead decide which to use according to the merits of each:
+ FlxSprite's physics use FlxG.elapsed to move the sprites every frame based on the time passed since the last. FlashPunk does not use this system (although you could implement it yourself if you wanted), instead it uses a fixed-framerate that you choose at the beginning of the game, and it calls extra updates to make up for lost frames, but reduces rendering to a minimum while doing so.
+ FlashPunk does not use layers like FlxLayer for depth-handling, instead, it actually has active z-sorting for all the objects. All Entities have a depth variable that you can set at any time, and they will be drawing in the order from lowest-depth -> highest-depth. This is made possible because FP actually manages its Entities using linked-lists instead of arrays, so objects can rapidly shift their position in the list because they only keep track of the entity before and after them. Also, because linked-lists loop marginally faster in AS3 than arrays/vectors, an increase is achieved in the update/rendering rate (but not by much, really).
+ FlashPunk currently supports rectangle or pixel-perfect (via a mask) collision detection, which is very-very fast. A bit of knowledge is required on knowing how to use FP's collision functions efficiently, though, whereas Flixel allows you to ovveride hitWall/etc. and specify actions upon collision. In FP, entities can check for intersection against a specific other entity, or they can do a batch-check against a collision type. Each entity can specify its own collision search type, and when you call the collide function, you can specify which search type to check intersections against, and the first intersecting entity of that type will be returned. Since you then have a reference to that entity, you can specify on-collision actions or functions for the calling or intersecting entity yourself.
+ FlxSprites, by default, have a single bitmap they are assigned with several images, and you can create animations using arrays to cycle through those images in a particular order. FlashPunk works significantly different in this department. Because of the nature of my programming, I am used to assigning sprites with origin-values, or "hotspots", this basically represents the (0, 0) origin of the sprite, so if a 16x16 sprite has an origin at 8x8, whatever position you place that sprite at, the 16x16 sprite will be centered on that position. Sprites are managed through a SpriteMap class, and each of your game Entities can have as many SpriteMaps as you want (each with their own origin, image-count, etc.). So each animation would be a separate SpriteMap, and a player might have a Jump, Walk, and Idle sprite that it can switch between. Because you can also set "origins" on these sprites, when you draw a sprite rotated, for example, you can specify whether you want to draw that sprite rotated around its center, or rotated around its origin. So basically you are able to natively set a "pivot" point from which you can rotate or scale the sprite.
+ FlashPunk does not have all the cool built-in physics stuff that FlxSprites have right now.
I plan on adding "modules" to the library, such as a Platformer module, or a Physics module, that will each have special helper classes for dealing with objects with specific needs/behaviour, but I plan on doing that after getting some feedback on the initial framework and making improvements first. But until I get these built, a good bit of the physics/movement work that FlxSprites in Flixel have already done for you will have to be coded yourself if you're using FlashPunk.
+ While FlashPunk has a simple beginner tutorial, which assumes as low as no previous AS3 experience, it does not have the huge community that Flixel has to offer currently, and may never have such. I have put an
Online Documentation which shows all classes, properties, and functions with descriptions of each, and hope to build a helpful search/FAQ that can answer most basic questions regarding the library. But this is a hard thing, and for the first while people might be required to contact me directly or on the forums for help until a bit of a community builds and a few more talented developers show up.
Show me!If you haven't heard of it, my current game project which is near completion,
Fight! Mechanical Shooting Device, has been coded entirely using the FlashPunk library. Here is a
of the game in action, showing off high object count and smooth framerate:
Also, some of you know fellow TIG member and game dev
Matt Thorson; Matt is actually developing the next game in his
Jumper series using FlashPunk, and the project is
coming along awesomely!
Keep in Mind:FlashPunk was both an ambitious project for me, and a crazy learning experience. At the moment, there may be still several small bugs that have snuck past mine and the other tester's notice and will need to be fixed. Other than that, it was originally designed to be a private library for my use, but I'm releasing it publicly merely on demand from folks who want to play around with it. I've recieved good feedback on it so far, especially from coders like me who have their roots in tools like Game Maker, and would love to get as much feedback as possible either here or on the
FlashPunk forums. Regardless, please go easy on me, I'm no pro coder.
But I'll do my best to build this into a cool, useful tool if folks are into using it, and any help is totally appreciated.
No credit is required or any of that crap if you want to use FlashPunk. It's released under the
MIT License, so you can distribute it all you want as long as the licence TXT and all the files are intact. There are no required splash screens or anything annoying.
Cheers!