Skip to content

StarlingPunk

 

What it is:

StarlingPunk is a framework built on top the Starling library designed to add structure and organization to your 2D games. It’s perfect for rapidly prototyping ideas and promotes code reuse between projects.

As you may have been able to tell from the name, StarlingPunk is heavily inspired by the popular FlashPunk framework, although its not a direct port.

Why StarlingPunk:

  • Easily encapsulate code into worlds and entities
  • Manages collections of entities based on assigned types
  • Fast and easy collision detection system
  • All the power of starling’s performance, sprite sheets, particles, mobile development

Why build this on top of Starling:

  • Best of both worlds allowing us to mix and match regular Starling code with FlashPunk like organization.
  • Fast Stage3D hardware accelerated graphics
  • Provides a familiar structure for Actionscript developers
  • Harness the power of the display-list; worlds and entities extend the Starling Sprite class meaning display objects can be nested within them
  • Pre-existing Starling code can easily be incorporated into the framework
  • Starling already does a ton of things right, sprite-sheet animation, events, dynamic resolutions
  • Tons of tools and extensions will already work, like sprite-manager and particles

Grab the framework on github now!


Check out the example Project:

Click the image to play the example game, the example was ported from this flixel tutorial


Planned future releases:

  • Integration with the box2D physics library
  • Helper class for the Ogmo level editor
  • Helper functions for sound effects
  • Component based behavior system sorta like Unity3D

Resources:

Categories: Actionscript, Stage3D, Starling, StarlingPunk.

Comment Feed

32 Responses

  1. Hi there. Not sure you’ve heard of Axel before… but is it fair to say the only real difference is that this library can use Starling side-by-side to do other rendering tasks while at the same time benefiting from FlashPunk’esque classes?

  2. Well done! Flashpunk is a great game engine and a similar one powered by Starling is even better :)

  3. this is awesome, thanks

  4. Nice! I’m looking forward to starlingpunk integration with the box2D physics library!!!

  5. I think box2d is not the most modern (dirty code organisation and class name herite from c++ version of the lib ) and optimize physics engine you should take into next release… look at nape physics engine, it has better performance, and manage some very cool features as liquid, physic shape from bitmap …

    Congratulation to this greate project !

  6. Have you built tile maps?. Great job!!

    freddyJune 29, 2012 @ 12:05 pm
  7. Haven’t included tile map support yet but it’s definitely on the list

  8. Great new …
    Impatient to see tile map support too

  9. Hey. Great work, but there seems to be something definitely wrong with hit tests and the hit boundary. Although I can get it to change the width and the height, I cannot get it to change the rect’s origin, no matter what I try.

  10. can you be more specific on what the problem is… what methods are you having trouble with? Can you give me some steps to reproduce the bug, or send me your source code?

  11. Sure. Adding this to added( ), although it changes the hitBox drawing, it doesn’t change the hit bounds.

    var rec:Rectangle = this.getRect(this.x,this.y);
    rec.offset(this.height * .25, this.width * .5);
    rec.width = this.width – this.width/2;
    rec.height = this.height – this.height/2;
    this.hitBounds = rec;

    this.showHitBox(rec.x, rec.y);

  12. Also, shouldn’t there be a collide method without an x and a y? What exactly is that virtual x and y used for? What I’m assuming is that setting the hitbounds changes the hitbounds, but it doesn’t appear to do that. Also the fact that collide requires an x and y value leads me to believe there is something I’m not getting….As my entities have movieclip animation, some that requires ample transparent pixels, this is really problematic. Any help is greatly appreciated.

  13. Thanks for finding this, after looking into it there is indeed some funkiness with adjusting the offsets for a hitbox. The showHitBox method seems to be completely unreliable and I ended up taking it out. I’ll add it back once I figure out a more sane way of dealing with it. The most obvious problem was that the hitbox’s width and height was being ignored when colliding with any kind of Mask… so any tileset collision. I’ve fixed that and added some methods and properties from FlashPunk such as originX and originY that should make this sorta thing easier. Just pushed the new version to git hub so after downloading it this bit of code should do the trick:

    setHitWidth(width * .25);
    setHitHeight(height * .5);
    centerOrigin();

    Get the new version here: https://github.com/asaia/StarlingPunk

    Let me know if that works. Also you can think of the x and y properties of the collide method as “if the entity was at this x and this y would a collision happen” so collide(this.x + 30, this.y) would test any collisions that happened 30 pixels to the right of the entity.

  14. Nah, doesn’t work, sorry cant be more specific. This should work with movieclips no problems, right?

    What you told me to try assumes image is centered.

    Unfortunately, without show hotbox and it working, I’m gonna have to go with a pixel perfect method from forums.

  15. But I did find a very “low-rent” solution that fits my needs, although doesn’t speak highly of my elegance as a programmer. I’ll post here in a few days. I need to test more; if I forget, feel free to email me.

    Now, second issue, object pools. Apparently if I done call the remove method, I end up with excessive draw calls, if I do, then it removes the entity and disposes it, which defeats the purpose of an object pool. I’m thinking there needs to be a way to remove it without disposing.

    I have to say, though, this is good work on your part. I got bigger issues with Adobe and Android Touch lags and Kindle and Lost Context…nothing to do with your great addition though.

    James A. BrannanOctober 8, 2012 @ 8:29 pm
  16. That’s a good point I’ll look into the dispose flag. Although I’m thinking that if you recycle the entity back into the object pool flash will have a reference to it and therefore it will not be garbage collected even if the dispose flag is set.

  17. Thanks for implementing SPCamera in version 1.3! Looking forward to using it. Cheers.

    MurdochOctober 23, 2012 @ 4:21 pm
  18. Hi, although you have said it is not a port, can you tell me how close the api is to that of “FlashPunk”.

    Are there any features from “FlashPunk” that have not been included in “StarlingPunk”?

    The reason I ask is out of interest in porting older FlashPunk games, it would be great to use custom compiler options to toggle “Starling/Flash Punk”.

    Thanks

  19. The biggest difference from flashpunk is obviously the use of the Starling Framework. FlashPunk uses bitmap blitting to render everything and Starling uses stage3D. So some things like the camera class had to be completely rewritten. Additionally there are some “missing” features that I have yet to be implement in StarlingPunk for example FlashPunk’s console debug system. There’s also some things that will never get ported because they have become redundant… Starling already has an awesome tweening engine built in.

    So you’ll find the API very familiar but I doubt you’ll be able to export from FlashPunk to StarlingPunk without a good amount of work… although if you get it working that would be very cool :)

  20. Hey Andy. I’m kinda interested in using this framework. I like FlashPunk and I want to target iOS.

    I wish the FlashPunk forums weren’t down. :(

    Anyway, I was looking at the Entity class and noticed it doesn’t have a graphic variable. Instead, you just add display.image as a child. I was wondering, can you similarly add a DisplayObject to it?

    I want to use the flash.graphics library to procedurally draw stuff. If so, will the rest of the engine still work with it (collision)?

    Sorry if none of this sounds right. It’s been some time since I’ve used Flash and FlashPunk.

  21. @Rahil Glad you’re interested in the framework…. You are correct one of the big changes I made was removing the graphics class from FlashPunk. Instead the entire entity is a Starling Sprite displayObject. So yes, any starling display object can be added to an entity.

    Starling works a bit differently then the traditional flash display list and it really depends on what your trying to do in terms of procedural drawing. For simply things you can draw to a bitmap object then convert that to a Starling Image and add it to the entity. If you need to draw in real-time (updated every frame) you might want to look into the starling Grahics extension. https://github.com/unwrong/Starling-Extension-Graphics

    In either case collision detection will work normally so no need to worry about that.

  22. Whoa interesting, thanks! Are you still working on the engine?

    The reason I ask is because I want to prototype and hopefully develop a lot of iOS games. I want to avoid Objective-c (Cocos2d), mainly because my games involve a lot of simple procedural drawing (draw a line between touch points) and I enjoy the simplicity of Flash’s drawing primitives. I also loved using FlashPunk; I made my first game with it. I will likely try this engine and Citrus, as it has the option to easily add physics and is current, although I’m a little afraid of the component-based structure.

    For now I’m hacking away at Unity which is currently displaying super blurry 2d sprites on my iPad.

    poop.

  23. I’m not entirely sure if this is the best place to let anyone know about this but, I found this framework yesterday while researching Starling.

    I’ve been looking for a way to easily get animations from Spine into FlashPunk, with little success. When I stumbled upon this while googling I immediately gave this a go, very pleased with the way you implemented things.

    Due to the (awesome) change in how graphics for Entities are handled, I really easily implemented an extension of the SPEntity class that can load a Spine Animation as the Entity’s graphical display.

    It can be found here:

    https://github.com/volticgames/StarlingPunk-Spine-Runtime-Implementation

    It’s probably too specialised to be included in the actual engine but I thought I would let people from around here know.

    If you have no idea what Spine is: http://esotericsoftware.com/

    Cheers.

  24. This is completely awesome great work. This is exactly why I decided to build off of starling so we can leverage and easily integrate all the awesome frameworks and tools that work with it.



Some HTML is OK

or, reply to this post via trackback.

Continuing the Discussion

  1. [...] StarlingPunk – A framework built on top the Starling library designed to add structure and organization to your 2D games. http://www.andysaia.com/radicalpropositions/starlingpunk/ [...]

  2. [...] on http://www.andysaia.com Share this:TwitterFacebookLike this:LikeBe the first to like [...]

  3. [...] Specifically, the StarlingPunk framework developed by our own Andy Saia for hardware-accelerated 2D [...]

  4. [...] with Ryan Wiemeyer and Michael Block. Andy Saia gave us an exciting run-down on his awesome-looking StarlingPunk framework, and Phil Tibitoski told us all about the new developer feedback service [...]

  5. [...] StarlingPunk – Radical Propositions. [...]

  6. […] StarlingPunk – 将 Starling 和 FlashPunk 整合的游戏框架 […]

  7. […] StarlingPunk – A framework built on top the Starling library designed to add structure and organization to your 2D games. http://www.andysaia.com/radicalpropositions/starlingpunk/ […]