Archive for August, 2008

31
Aug 08

PixelBlitz Update – addLimit() and removeLimit()

While chatting to Norm on MSN we were both quite surprised at the lack of Game specific libraries / frameworks for AS3. Things that make creating a game as easy as possible for the developer. That is what we really want PixelBlitz to turn into, and I made another small step towards it today.

I've commited r22 to Google Code, which contains two new commands: addLimit() and removeLimit(). They are as easy to use as this:

Actionscript:
  1. //    The Player
  2. player = new PixelSprite(new Bitmap(new plane1BD(0, 0)));
  3.  
  4. //    Limit the player to the region starting from 100,100 down to 450,300
  5. player.addLimit(100, 100, 450, 300);

Essentially all it does is limit the PixelSprite to a set region of the stage (in this case a 350x200 block in the middle). It's far from earth shattering, but PixelBlitz is about helping you make your game quickly, with as clean code as possible, and all these little things build up over time.

It means that when checking the keyboard to see if you can move the player, you no longer also need to check the X/Y position, because that is being handled for you.

I'd post a demo, but I figure you can work out what it looks like already :)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

30
Aug 08

PixelBlitz Engine Update: AutoScroll support with demo

Just a small update to the PixelBlitz Engine today, but a pretty cool one!

I'm creating an intense shoot-em-up game as my water shed test of the PB engine. Each day I get to add a few more features to PB that makes the game closer to reality. Once I have reached that point I know we'll have something truly useful on our hands :)

Today I added in a backdrop behind my ships and thought "damn, that ought to scroll" - but I figured that PB ought to handle the scrolling for me, automatically - just set it and forget it. So that is what I've added to the engine tonight.

It's a piece of piss to use:

Actionscript:
  1. // Continuously scroll this PixelSprite to the left by 4 pixels per frame
  2. pixelsprite.autoScroll(PixelSprite.SCROLL_LEFT, 4);

Which allowed me to create the following demo in around 20 lines of code:

I'm quite pleased with how this is shaping up :) You can autoscroll any PixelSprite, with full transparency preserved (so they can be overlaid on-top of other PixelSprites for true glass-window scrolling effects). The PB engine takes care of making the scroll seamless for you, and you can modify the speed on-the-fly (although I'd recommend not to do it every frame if you've got a lot going on).

The only issue is that scaling an auto scrolling PixelSprite will mess it up, so I'll need to remedy that.

It's now the weekend, but if i get some spare time I plan on continuing my task of fixing the left over issues before cracking on with collision groups and sprite mask tests.

Here is the source + FLA.
You'll need to checkout latest revision (v21) of PixelBlitz from Google Code to compile it though.

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

29
Aug 08

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

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

28
Aug 08

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.

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

27
Aug 08

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!

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

26
Aug 08

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.

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

14
Aug 08

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

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

05
Aug 08

fMAME – It had to happen sooner or later :)

Over on yvern.com they've released the first version of fMAME - a Flash port of MAME, the Multiple Arcade Machine Emulator. It doesn't have any sound support yet, and in the debug Flash player is a little slow, but it's still a damned fine piece of work! Several older games are supported (1943, Hyper Sports, Galaga, etc) but it's great to see this classic emulator ported to AS3.

Click the screenie to play.

Press the 5 key to insert a coin, arrow keys = movement, A = fire button 1, S = fire button 2.

fMAME

fMAME

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

04
Aug 08

Demo FX Lib

Somewhat inspired by my previous vectorball tests, and also from unearthing a load of my old demo source code, I decided to start porting some of the effects to AS3 into a single easy-to-use library, Demo FX Lib. Today I coded a nice image "drop down" effect, and a comprehensive 3D starfield routine. I'm very pleased with the starfield as it's both smooth and versatile, you can literally tweak every value as it's running, for some nice real-time effects.

The object of these effects is that you can literally pull them into your game as needed. None of them mess with the stage, all of them return (and work on) either a single bitmap or sprite, so can slot-in easily to an existing system. I want to add a classic scroll-text system, plasma and some other traditional effects before I release the library.

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

03
Aug 08

Morphing Shiny Balls

I was messing around with a little of my old DarkBASIC code last Friday, and figured it would be fun to port it to AS3. I threw in some extra effects and a new shiny ball graphic and here is the end result of an hours work. Adding scaling and z-depth sorting was pretty easy. You do get quite a bit of "popping" because I only z-depth once per loop, but I can live with that :)

Adding a depth blur or hue shift is next on the list if I feel like it. There are 18 different wave forms in total. The SWF is 640x480 and published at 60fps (really meant for running on the desktop, but there we go)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon