Mar 9 2010

BulkLoader – managing multiple loadings in AS3

One of the most common tasks in game development is the assets loading process. You have two options: 1) ship your game as a single 45Mb SWF file filled with sweet and compressed-to-the-bones images/sounds or 2) load all those assets separately and on demand.

Sometimes the first option is your best shot, but for casual online games the second one is more suitable. Multiple loadings in AS3 can be a pain, because there are several file types to load (wave, JPG, mp3, GIF, swf, etc) and there is no single way to load them all.

So far my best approach to solve this problem is called BulkLoader, a library for managing multiple loadings with AS3. It is licensed under the MIT License and has amazing features:

  • Connection pooling.
  • Unified interface for different loading types.
  • Unified progress notification.
  • Events for individual items and as groups.
  • Priority
  • Stop and resuming individually as well as in bulk.
  • Cache management.
  • Statistics about loading (latency, speed, average speed).
  • Various kinds on progress indication: ratio (items loaded / items to load), bytes , and weighted percentage.
  • Configurable number of retries.
  • Configurable logging.
  • Various assest types (XML, NetStreams, Swfs, Images, Sound, Text Files)

Design goals:

  • Minimal imports.
  • Few method to learn.
  • Consistent interface, regardless of content type.

BulkLoader gracefully handles progress notification in these use cases:

  • Few connections to open: bytes total can be used instantly.
  • Many connections opened: progress by ratio
  • Many connections opened for data of widely varying sizes: progress by weight.

One of the things I like the most is that this project was created by a Brazilian fellow named Arthur Debert :) . Thanks for this great tool!


Feb 8 2010

QuickBox2D: AS3 physics engine

The first time I saw a really convincing physics engine working on a PC game was during a Half Life 2 session. All that Havok physics created an unique game experience. Luckily the use of physics inside games has grown and now we have a wide range of tool to use, even in Flash games.

QuickBox2D is one of them. It is a mini-library created to work with Box2DFlashAS3, which is an AS3 port of the famous Box2D C++ physics engine. The main purpose of this library is to significantly simplify instantiation of rigid bodies and provide a simple way to bind them with custom graphics.

You can start with QuickBox2D by reading this great kick off tutorial. It explains the engine itself and demonstrate how to use some of it's features.


Jan 30 2010

AS3 game engines

I like to write my code from scratch, but it does not  mean I want to reinvent the wheel every single day. This is one of the reasons why I like to use engines to code games.

Sometimes the project has it´s own specific features and it requires a completly customized code, but most of the time it´s all about the same things: test input, check collisions, update a bunch of elements and finally render them all. Looking for a tool to do those tasks for me, I found two free and open source game engines: PushButton and Flixel.

PushButton is a very modular game engine licensed under the MIT license. It has core functionality as resource manager, logger, debug monitoring, serialization, time management, globally named objects, etc. It also has a set of components that make the engine even better:

  • Physics based on Box2D;
  • Gameplay components: health, teams, state machines;
  • Sprite-based and SWF-based 2D rendering;
  • Tilemap system;
  • Pathfinding library;
  • Basic networking. Pass events to/from your servers, do XMLRPC/JSON Web API requests, etc;
  • Awesome UI capabilities via Flash - localizable, stylable/themable, internationalizable.

Flixel is collection of AS3 files that helps organize, automate, and optimize Flash games. It is also licensed under the MIT license and has a great set of features:

  • Really fast renderer (5000+ sprites on modern PCs);
  • Tilemaps;
  • Particle systems;
  • Global sound system with volume hotkeys, looping, panning, etc;
  • Parallax scrolling (free/multi-directional);
  • Built-in 2D box-based game physics (not Box2D);
  • Fast text rendering;
  • Retro style zoomed rendering options (2x pixels, 3x pixels, etc);
  • Works great with non-pixel art too, with support for rotation, scaling;
  • Composite multiple sprites using blending modes to create sweet lighting effects;
  • Does not require the Flash IDE, works best with free tools like FlashDevelop;
  • Organizational classes like game states;
  • Simple buttons;
  • Utilities for looping music and playing sound FX;
  • Simple special effects like screen flashes and fades;
  • Save game data between sessions using a local shared object.

Reading about them gave me the idea of writing my own game engine someday. Maybe some raining day I give it a try :)

• Really fast renderer (5000+ sprites on modern PCs)
• Tilemaps
• Particle systems
• Global sound system with volume hotkeys, looping, panning, etc
• Parallax scrolling (free/multi-directional)
• Built-in 2D box-based game physics (not Box2D…yet, anyways)
• Fast text rendering
• Retro style zoomed rendering options (2x pixels, 3x pixels, etc)
• Works great with non-pixel art too, with support for rotation, scaling
• Composite multiple sprites using blending modes to create sweet lighting effects
• Does not require the Flash IDE, works best with free tools like FlashDevelop
• Organizational classes like game states
• Simple buttons
• Utilities for looping music and playing sound FX
• Simple special effects like screen flashes and fades
• Save game data between sessions using a local shared object

Oct 16 2009

Flash instead of Powerpoint?

Probably I've spent several hours editing and arranging pictures to create a nice Powerpoint presentation. Even though the Microsoft product is a great tool, I do not like the final result. It seems unfashionable, too poor and/or simple.

This is one of the reasons why I like image sliders developed using Flash. I look at them and imagine how wonderful life would be if I could easily use it and some lines of text in a .txt file to create a presentation. Nice graphics, beautiful font rendering, smooth effects (including blur and glow) and maybe some physics, why not?

Trying to make my dream come true, I found two amazing image/content sliders in Flash: MegaZine 3 and CU3ER. The first one is an open source pageflip/flashbook engine, written completely in AS3.

The other one is a content slider with 3D transition effects, such as spinning.

cu3er

Certainly those two projects have lots of cool features and they can perfectly fit into a wide range of uses. If I have the change to save some time for my personal projects, such as my own Flash slide presentation, I will use MegaZine 3 and CU3ER for sure.


Jul 10 2009

SWFConsole: enhance the power of your Flash games

TerminalSometime ago I was working on a Flash game and I had to output some information to the console. That's a very easy task when you use trace() and the Flash IDE, but things get a little harder when you need to output text inside the browser.

Looking for a tool that could help me output text, I found SWFConsole.  It is a free developer tool for Flash AS3 projects that gives you output in all environments, not just the IDE. You can type commands in order  to manipulate Movieclips in the stage,  such as myMovieclip.alpha = 0.3.

SWFConsole also has a built in resource monitor that shows FPS and memory usage, pretty useful for game developers. I miss some features as listeners to handle custom commands and a method to "enable/disable" the console instead of  showing or hiding  it, but it does not make  the tool less useful.

If you are a Flash game developer, SWFConsole can make your life easier!


May 31 2009

FlashDevelop: a powerfull and free AS3 development tool

If you work with Flash like I do you probably have said a bunch of bad words while you were coding AS3 using the native Flash IDE AS editor. I like Adobe, I really do, Flash can do amazing things and the IDE is getting more and more powerfull, however as a AS3 project manager, the Flash IDE sucks.

I could have saved tons of working hours if Flash IDE had some sort of smart code completion, or if it had a better project manager panel (a simple one that hides the SVN directories, for instance). The logical choise for me would be change to another IDE or methodology, such as Flex Buider, but sometimes I'm binded to the Flash IDE because I can't use a different approach.

Tired of wasting my time coding like that, I've decided to search for a better AS3 development tools. Thanks to the open source community, I've found FlashDevelop, a  free and open source ActionScript 2/3 and web development environment.  It seemlessly integrates with Adobe Flash IDE, Adobe Flex SDK, Mtasc, Haxe and Swfmill.

Some of the features:

  • AS2 Project management with seamless Swfmill and Mtasc integration (using a portable standalone command line tool).
  • Advanced ActionScript 2 and ActionScript 3 completion & code exploration with automatic classpath detection (even without project).
  • Smart contextual Actionscript code generators.
  • SWF and SWC classes and symbols exploration.
  • Test movie in Adobe Flash IDE and with clickable error results (Flash CS3).
  • MTASC compilation/code checking with clickable error results.
  • Types Explorer.
  • Automatically cleans ASO files of modified AS2 classes.
  • Files explorer (can create Flash 8 Trust Files for you).
  • Automatic JavaDoc creation from methods.
  • Smart Actionscript help websearch on F1.
  • Jump to class/member declaration on F4.
  • XML, HTML/PHP, JS, CSS code highlighting.
  • Multibyte character encoding.
  • Program menu customization with XML files.
  • as2api GUI for documentation generation.
  • Snippets, lines bookmarks, code folding and zoom.

FlashDevelop has enhanced my production cycle and I think it can do the same for you. Download it now and enjoy!