Latest Posts

  • PixelBlitz Engine Update

    Another day, another update 🙂 I just pushed my latest changes to the PixelBlitz Engine into svn. Each day it becomes something closer to something you could use to write a decent game with!

    Today was mostly boring but important tasks. You can now set the registration point (hot spot) of any PixelSprite object. This works in exactly the same way as setting the registration point of a MovieClip in the Flash IDE, except you do it via one line of code.

    There are 9 pre-defined locations (such as top-left, center and bottom-middle), but you can also set any x/y hotspot value you wish (of any size). The hotspot can be updated in real-time, and the renderer takes account of this immediately. If you scale the object it automatically scales the hot spot as well, thus keeping it perfectly aligned.

    The term “hot spot” comes from the STOS/AMOS world, where it served the exact same purpose.

    PixelSprites will now center themselves upon creation, but you can over-ride this with a single function call. I updated the getDistance() method so it will now report the distance between either the hot spots of two objects, or their x/y values (i.e. top left-hand corners).

    Other new additions include:

    Scale – PixelSprites can now be scaled in exactly the same way as you’d scale a Bitmap / Sprite.

    Alpha – Set (or get) the alpha value of any PixelSprite, in the same way you would on a Bitmap / Sprite.

    Smoothing – if you scale the object you can now control if it’s smoothed (or not) during the process.

    Tint – you can now tint your PixelSprites! You specify the red, green and blue amounts, but you can also set the overal tint intensity (meaning you can do a full red tint at 50%, so instead of your object turning out completely red in colour, it looks like a proper 50% alphad red tint has been applied.

    I also updated the in-line documentation and fixed a bug in the renderer where it would still render an object who’s alpha value was set to zero. Now it doesn’t waste time doing that 🙂

    Check out the latest version from Google Code:

    svn checkout http://pixelblitz.googlecode.com/svn/trunk/ pixelblitz-read-only

  • PixelBlitz Updates

    After Norm added me to the PixelBlitz project team I worked hard on it tonight, ironing out a number of the issues that were bugging and expanding the library further.

    The changes are all in svn (Change Log can be viewed here) including enhancements so PixelSprites now work from Bitmaps, and retain scaling; also added a new super-fast box collision method, a new getDistance method, and various other smaller changes and fixes.

    Next I hope to work on opening up more control over the PixelSprites themselves so you can scale, rotate and skew them at run-time (while retaining collision detection of course), and the all important feature of allowing you to set the registration point where-ever you want it to be.

  • PixelBlitz first hands-on

    Norm Soule has released the first version of PixelBlitz, his 2D AS3 library that’s geared towards helping you create fast 2D “sprite” based games. I’ve had a good play with it today and this is definitely one to keep an eye on. It allows you turn any movieclip into a PixelSprite, which is essentially an extended bitmapData object upon which you can perform pixel accurate hit detection. PixelClips are similar to sprites except you have rudimentary timeline controls which are useful for animations.

    PixelSprites/Clips are then added to a RenderLayer. Items in the Render Layer can be z-depth sorted, have effects applied to them, and be set to enable parallax scrolling. There are 4 effects in the current build, including trails, glowing, fog and a grid effect. To be honest they’re not a massive deal of use as they exist due to the speed hit involved, but you can easily customise them as you see fit.

    RenderLayers (and you can have more than one of them) are added to the 2DRenderer, which does all the donkey work and needs to have its update() method called each frame.

    This is just the first release, so I’d expect some changes to happen internally, driven by design decisions made post-v1. The system is nice and fast (when you don’t mess with the effects at least!) and is a good starting point if you’ve never worked like this before. It does have some serious limitations though, for example the PixelSprites cannot be rotated, scaled or have their alpha set. You also can’t use masks on them, which is a great shame. I believe this is mostly due to PB internally using the bitmapData’s hitTest method, which itself cannot handle scaled or rotated bitmaps.

    It’s lacking in other areas that would make it truly useful right now – for example there’s no way to quickly check for regional collision (i.e. a quad tree system) which means you’re performing pixel level collision on every single object, against every single other possible object and you need to create your own functions to avoid this. As PixelSprites extend the EventDispatcher base class of all things (a truly strange design decision imho!) you don’t have access to methods like hitObject that could speed this up for you.

    I’m not knocking the release – it takes a brave developer to throw a library out to the wolf packs of the internet – but I do feel it certainly needs further work before it becomes truly useful for a full game. I’ve already contacted Norm to offer my help, if you’re reading this and would like to see PB turned into a really killer library, then it would be wise to do the same!

  • FlashDevelop 3.0.0 Beta8 released

    The post title says it all really! If like me your AS3 coding life depends on FlashDevelop, then do yourself a favour and grab the new 3.0.0 Beta 8 release (and leave Mika a donation in the process!).

    New to this release include improved GUI changes, various code completion updates, new templates and even basic PHP highlighting.

  • Hi-Res – SWF performance stats with style

    Ricardo Cabello released a really nifty stats tracker the other day. Just download the Stats.as file from his Google Code site, create the following folder structure: net / hires / utils and place the Stats.as file into that. Once done you can import the package into your own code and make use of it.

    The end result? A beautiful little real-time performance display that looks like this:

    Hi-Res Stats

    The FPS gives you a current and maximum frame rate count (the maximum is derived from the stage frame rate setting). The MS is a micro-second counter. MEM is the total memory (in MB) your SWF is using.

    The cute little graph below that is a historical visualisation of these three things, so you can watch for spikes / peaks during activity. You can click the top/bottom of the stats to increase/decrease the stage framerate.

    Using it is as simple as adding one line of code:

    addChild( new Stats() );

    All I’d say is remember to make sure this happens on the TOP of all of the rest of your display list items.

    Link: Hi-Res Stats Google Code page

More posts to tickle your grey matter ...