Going to FlashGAMM Moscow 2012

Hey, friends!
I’m preparing to the short trip to Moscow with very short blitz session on FlashGAMM.
I’ll speak about few advanced debugging and optimization tools.
I wrote few simple effects using Nape and Genome2D especially for my presentation, it was much more fun creating this effects then preparing the slides)
Blitz sessions section will start at 12:00 (Moscow time) in the “Saturn” hall.

If you will be at Moscow May 16-19 and wish to meet me – feel free to drop me few lines!

I’ll post my slides along with conference report here in the next few weeks, so you will be able to play with effects and see their sources!

Bye!

Posted in look at this! | Tagged , , | Leave a comment

Flash Player roadmap updated – cool features are coming!

Hey again!
Along with releasing Flash Player 11.2 / AIR 11.2 and publishing information about premium futures, Adobe updated their roadmap for the Flash runtimes today and revealed many awesome features coming to us this year!

Just look at this quick copy-paste:

Flash Player “Cyril”
Following the Flash Player 11.2 release, Adobe plans to do another release, code-named “Cyril”, which is targeted for a release in the second quarter of 2012.

Some of the features being planned:

  • Keyboard input support in full-screen mode
  • Improved audio support for working with low-latency audio
  • Ability to progressively stream textures for Stage 3D content
  • LZMA compression support for ByteArray
  • Frame label events
  • Support for compressing BitmapData to JPEG and PNG formats
  • Support for Mac OS X App Store application sandboxing requirements

Awesome, isn’t it?

Flash Player “Dolores”
Adobe is planning an additional Flash Player release in the second half of 2012. Code-named “Dolores”.

Some of the features being planned:

  • ActionScript workers (enables concurrent ActionScript execution on separate threads)
  • Support for advanced profiling
  • Support for more hardware-accelerated video cards (from 2005/2006) in order to expand availability of hardware accelerated content
  • Improved ActionScript performance when targeting Apple iOS
  • Performance index API to inform about performance capabilities of current environment
  • Release outside mouse event API
  • ActionScript 3 APIs to access the fast-memory opcodes (premium feature when used in conjunction with Stage3D APIs)

Even more awesome!
Flash is going to rock this year (again)!

Roadmap link: http://www.adobe.com/devnet/flashplatform/whitepapers/roadmap.html

Posted in look at this! | Tagged | Leave a comment

Brief comparison of three Stage3D 2D frameworks *Update 1*

Hey, friends!

I’d like to show you some fast results of benchmarking briefly three most popular Stage3D frameworks for the 2D rendering:
Starling, ND2D, Genome2D.

I got latest available builds (and sources) of those frameworks and written a simple AIR app with some amount of images moving, rotating, scaling, and changing alpha on every frame.
Images were placed across whole stage within several iterations (adding fixed images amount on every frame until we reach fixed maximum).
All images had the same texture – small 25 by 25 box with a bit of alpha channel.
I tested that app on my PC and on two mobile devices – iPad1 with iOS 5.0.1 and GalaxyTab 10.1 with Android 3.1.

So, this is a results I got:

Starling from GitHub Commit:9aa93a8195c47252253fd4d2b671115e19d16b6f, 24.03.2012:

iPad 1:
1350 images at 30 FPS
RAM: 6.4 MB

GalaxyTab 10.1 (OC 1.4GHz):
1350 images at 30 FPS
RAM: 6.2 MB

PC (i7 4.8 GHz, Radeon 6790):
10000 images at 30 FPS
RAM: 19.7 MB
RAM with 1000 images: 9.1 MB

Starling is a really nice open source framework. It mimics classic DisplayList, have a huge community (thanks to Adobe) and very detailed API reference. Thus it’s really easy to learn and contribute.

ND2D from GitHub Commit:453531f7aee46b00a112c6f0d5d8b46d62075287, 05.03.2012:

This framework has two different “modes” for the effective massive sprites rendering – using Sprite2DCloud or Sprite2DBatch as Sprites container. I tested both.

Sprite2DCloud:

iPad 1:
~1150 images at 30 FPS
RAM: 6.4 MB

GalaxyTab 10.1 (OC 1.4GHz):
~1150 images at 30 FPS
RAM: 6.2 MB

PC (i7 4.8 GHz, Radeon 6790):
16000 images at 30 FPS with drop to 16 FPS while adding images (100 images per frame), you’ll be fine adding all images from the start
RAM: 37 MB
RAM with 1000 images: 9.5 MB

Sprite2DBatch:

iPad 1:
~1150 images at 30 FPS
RAM: 6.6 MB

GalaxyTab 10.1 (OC 1.4GHz):
~1150 images at 30 FPS
RAM: 6.1 MB

PC (i7 4.8 GHz, Radeon 6790):
10800 images at 30 FPS
RAM: 23.2 MB
RAM with 1000 images: 9.1 MB

ND2D is another nice open source framework we have to render 2D using Stage3D. It have big community (smaller than Starling though), pretty raw API reference (with most of all methods and properties without any description) and it comparable in terms of performance to Starling.
It also easy to understand and use because it is similar to the native DisplayList we have in Flash and there are many examples and information on forums about different use scenarios.

Genome2D Nightly 0.9.0.1093:

This is a surprising framework. Just look at the benchmark results below!

iPad 1:
1900 images at 30 FPS
RAM: 6.5 MB

GalaxyTab 10.1 (OC 1.4GHz):
3800 images at 30 FPS
RAM: 10 MB

PC (i7 4.8 GHz, Radeon 6790):
~40000 images at 30 FPS
RAM: 68.7 MB
RAM with 1000 images: 9.1 MB

It’s a really hardcore framework! It have awesome performance, but no API reference, small community, and no examples for the latest nightly builds (at this moment, latest nightly build is far away from the latest stable build).
It’s could be pretty tricky to use it for the beginner.

So, what we have now for creating 2D content using Stage3D:
Starling – the sweetest one. In some tests slower than ND2D though.
ND2D – compromise – could be faster than Starling in some cases but looks not so sweet at least because of weak API reference (so far) =)
Genome2D – for the maximum performance in some cases (like mine) and mostly for the hardcore devs with ninjaneering skills) I hope it will became more friendly in future.

I think all three frameworks are comparable on features – all have the particle systems, blending, and other advanced features. And all three are under active development so new features are come continuously.
Also I should mention iPad and GalaxyTab 10.1 overclocked to 1.4 were head-to-head in Starling and ND2D in this benchmark. I guess it could happen because of the different screen resolutions and probably compensating each other HW and SW differences.
So for now if you wish to port some of your not hardcore (in resources consumption) game to the Stage3D with comfort, feel free to choice Starling. If you wish to have as much performance as possible (and if you’re ready to have a great adventure) – try Genome2D. Choose ND2D in the middle case.

Feel free to grab all Android benchmarks (and AIR 3.2 p6 Runtimes for Android) as bonus here:
http://codestage.ru/files/flood/android/benchmark.zip

If you think I could make a mistake in my tests – please, write me – I’ll be glad to know about and fix it!

*Update 1*

Recently I updated starling-imagebatch Starling extension by Philippe to keep it synced with latest Starling changes and perfomed this benchmark using it!

So, results are:

iPad 1:
2000 images at 30 FPS
RAM: 6.4 MB

GalaxyTab 10.1 (OC 1.4GHz):
2000 images at 30 FPS
RAM: 5.1 MB

PC (i7 4.8 GHz, Radeon 6790):
>16000 images at rapid 60 FPS (can’t set more images because of full buffer capacity)
RAM: 14.9 MB
RAM with 1000 images: 8.4 MB

Memory exploding bug

While I worked with the ImageBatch I found one memory exploding bug occasionally.
It’s very weird and I’m not sure where its roots are growing at this moment.

Please, look at this really often called piece of code:

var k:Number = (premultipliedAlpha ? item.alpha : 1) / 255;

and at this 2 lines of code:

var k:Number = premultipliedAlpha ? item.alpha : 1;
k /= 255;

There is not so much difference, yeah?
But first line explodes RAM with speed about 5 MB per second!
And second code block not explode RAM at all and work just fine!

Posted in dev | Tagged , , , , , , , | 17 Comments

TheMiner and FlashDevelop

This tutorial assumes you’re familiar with both TheMiner (awesome Flash profiler) and FlashDevelop (best and free Action Script / haXe code writing IDE) and wish to use them in conjunction with each other.

There are two common ways using TheMiner in the FlashDevelop:

- Using TheMiner as SWC, like any other external library.
- Adding TheMiner’s swf to the FlashDevelop profilers list.

Why always not to use only one way? Because both have their pros and cons.
So, let’s try out both ways step-by-step. Please, start the FlashDevelop and create or open the as3 project to proceed further.

TheMiner as external SWC

1. First of all, purchase TheMiner or download a free version for the non-commercial usage.

2. Unpack given archive, go into the “SWCs” folder and select desired SWC with translation you prefer, as example, select the TheMiner_en.swc

If you’re familiar with SWC using in FlashDevelop, skip next two paragraphs of this tutorial and go right to the par. 5.

3. Copy-paste selected swc in the “lib” folder of your project (or in any other location in your project or even PC you prefer to store external libraries).

4. Add pasted SWC to the project’s library using “Add To Library” context menu item.

5. To run TheMiner, you should add its panel to the DisplayList first. Choose the wise place in your project where to add it (it could be a place where you’re set up the stage) and write there a few lines of code.

// first, we should import TheMiner class, so add this line to the imports:
import com.sociodox.theminer.TheMiner;

//after you're free to add TheMiner's panel
//please note if you're using 1.3.10 or earlier,
//you should pass "true" to the constructor
stage.addChild(new TheMiner());

Whole sample working code could be like this:

package
{
	import com.sociodox.theminer.TheMiner;
	import flash.display.Sprite;
	import flash.events.Event;

	/**
	 * ...
	 * @author focus
	 */
	public class Main extends Sprite
	{

		public function Main():void
		{
			if (stage) init();
			else this.addEventListener(Event.ADDED_TO_STAGE, init);
		}

		private function init(e:Event = null):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE, init);
			//please note if you're using 1.3.10 or earlier,
			//you should pass "true" to the constructor
			this.addChild(new TheMiner());
		}
	}
}

Hey, that’s all about using TheMiner as SWC! As you can see, it’s pretty simple and easy to set up TheMiner right in your SWF using the SWC approach.
Compile your project, run it in the debug Flash Player (by default in FlashDevelop) and you’ll see TheMiner in action!

So, in what cases should we prefer TheMiner as SWC over TheMiner as FlashDevelop profiler?
- if we wish to be able to run TheMiner anywhere our SWF is run under debug Flash Player or debug AIR, including the mobile devices
- if we wish to have an additional control on when to show TheMiner
- if we wish to be able to interact with TheMiner for more flexible and efficient profiling

TheMiner as FlashDevelop profiler

1. First of all, purchase TheMiner or download a free version for the non-commercial usage.

2. Unpack given archive, go into the “SWFs” folder and select desired SWF with translation you prefer, as example, select the TheMiner_en.swf

3. Place that SWF anywhere on your PC, and remember the path for it. For example, path will be “D:\Programming\Flash\Tools\TheMiner.swf”.

4. Open the “Tools->Program Settings” menu item in the FlashDevelop.

5. Go to the AS3Context plugin settings and look there for the Custom Profilers item.

6. Press the “…” button at the right from the Custom Profilers item and paste path to the TheMiner swf in the opened window as new line and press OK.

(sorry for Russian texts)

7. Close the Settings window and press on the “SWF Profiler” button on the toolbar (or to the “View” menu subitem with the same name).

8. Press and hold the “Active Profiler” button at the opened “Profiler” window left side and select “TheMiner” item in the dropped menu.

9. Press the “Auto-start Profiler” button if it’s red now to make it green and to enable TheMiner auto starting with compiled SWF.

That’s all – now you could compile your project and see TheMiner running!

This way of TheMiner using in the FlashDevelop may seem not so fast to set up as using TheMiner SWC, but you should make all this steps only once! Next time you’ll need to add TheMiner in your project all you need is just to ensure Auto-start profiler is enabled and compile your project!

So, in what cases should we prefer TheMiner as FlashDevelop profiler over TheMiner as SWC?
- if we don’t need TheMiner to be included in our SWF / app after publishing / leaving FlashDevelop
- if we wish to have very easy set up after first time without adding anything to the project code and keep the project clean from additional SWCs

PS: Today new TheMiner version is out with lot of bugfixes and some really nice additions.

Posted in dev, tutorial | Tagged , , , , , | 2 Comments

Packed SWF. How to unpack?

Hey, friends!
In this post I’d like to explain you what is a packed SWF, how it looks and show you some methods of dynamic and static unpacking.

So, what is packed SWF?

If you never saw it, please, feel free to download this classic example of packed SWF:
http://codestage.ru/files/flood/security/packed.swf
You can see single SWF showing a text. But you can’t reach a code showing it with a classic approach – through the decompilers.
I should mention you’ll not reach any resources (Bitmaps, Sounds, Fonts, etc) via decompilers if they will be there too, because target SWF is placed inside of SWF you have and usually it is encrypted.
Usually all you can get with decompilers from a such SWF is a decryptor/unpacker code (usually hardly obfuscated), and, probably, target encrypted SWF (if your decompiler is able to show you the DefineBinaryData tag)
This kind of packing could be achieved with simple Flex [Embed] tag.

Dynamic unpacking (dumping)

Dynamic means unpacking while target SWF is run in Flash Player (FP).
As FP can’t play packed SWF as is, it should be unpacked and decrypted into the memory before loading (as example, with Loader.loadBytes()).
More important, it will be in the memory all the time while it’s running to allow FP properly display end execute it.

That’s our chance to get it!
There are two common ways to do it.

1) Dynamic unpacking with tools
Using third-party or even own tools to automatically search SWF in FP process memory. It’s the fastest and easiest method. Doesn’t provide you a feeling you’re a true cracker ;)
There are several tools for it available both free and paid.
One of most advanced is a SWF Revealer, free tool for the ASV licence owners. It could bypass domain checks (which will prevent SWF to unpack and decrypt) in some cases and force SWF to load and decrypt target SWF.
Also you could found some free tools for dumping after googling for it a bit.

2) Dynamic unpacking with hands
Search for it “by hands”, looking for the CWS (compressed SWF) or FWS (uncompressed SWF) header signature which are the start of any SWF file. If you never tried it, you definitely should try! It could be useful to improve your skills with hex a bit and to provide you a feeling yourself a true cracker)
For search you could use any Hex editor supporting RAM editing\viewing.
If you’ll try to search for packed SWF in the sample file I linked before, you should start from searching the FWS signature (uncompressed SWF) – just search for the ‘FWS’ string in the Flash Player’s (or Flash Player plugin\browser with SWF running in it) process because FP decompresses SWF before executing if it was compressed.
If you’ll search in a browser, be careful and close all other tabs with SWFs to decrease amount of the false positives.

Usually, you’ll find not only one signature entry, because FP contains other internal SWFs as well, like SWF showing hint how to exit from the fullscreen mode.
So if you’re not sure, I recommend you to check all found entries.
Well, what to do with found signature you’ll ask? How to validate it, how to know, where is the end of the SWF?
Please, look at this screenshot:

This is a signature for the one of the SWFs found in the FP memory (accidentally it’s a signature of the target packed SWF =) ) by looking for FWS string.
So, what next? Next you should check the length of the found SWF. Length is placed at the 4 bytes starting from 4 byte:

How did I knew that? It’s simple, I just read the “SWF File Format Specification” http://www.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf_file_format_spec_v10.pdf (“The SWF header” section)
Since it’s a hexadecimal number written in memory, you should know its bytes are written from right to left. So resulting number is:
00 00 04 DB in hexadecimal and 1243 in decimal.
Let’s measure this 1243 bytes starting from the FWS signature.
Because signature starts at 053DD020, SWF file end should be at 053DD4FB (053DD020 + 4DB):

Please, note that address where FWS is placed in memory is not the same on different OS and hardware.

Now we see our SWF in memory really ends at 053DD4FB and we can select all bytes from 053DD020 up to 053DD4FB and copy-paste them into the new SWF file.
After making this with all suitable FWS entries you’ll, you’ll have target unpacked SWF file in one of the saved SWFs!
Now you should be able to decompile it as usual and look into its sources or resources.

Some protections are trying to resist SWF dumping by generating many fake FWS headers, trashing a memory with them a bit. So you should double check if header has valid length and how it looks at all. Experienced in reversing people (like me :p) could say if header fake or not just looking on it and on several tens of bytes after the header.

Sometimes, packed SWF will not be decrypted and loaded into the memory because of different cases. As example, packer’s loader could check current domain or some kind of the license file before unpacking SWF. In this case you’ll need to patch that checks (as example, with bytecode disassemblers like Yogda or RABCDasm) or provide needed files (probably with crypto keys for decrypting) to make SWF run and unpack in memory.

Static unpacking

Static means we don’t need the SWF to be executed in FP to unpack.
Well, this kind of unpacking usually comes to help when you have no chance with unpacking your SWF dynamically (who knows why you can’t run SWF?)
Static unpacking could be very difficult because of many possible safety precautions of the packer developer. There are many ways of making static unpacking painful and very long.

So, how to start with static unpacking? First of all, you should have access to the two things inside the SWF to make this unpacking possible:
1 – DefineBinaryData tag(s).
2 – Decompiled AS or abc bytecode of packer loader.
And optionally, to the
3 – SymbolClass tag
Use available tools to achieve it (ASV, Adobe SWF Investigator, SWiX, etc).

How to find DefineBinaryData tag in the SWF?
Well, some tools, like ASV will point you to that tag with ease and allow you to save it as binary file.
Also it could be found by hands, with different tag-reading tools, like mentioned before Adobe SWF Investigator.
To get data from DefineBinaryData tag with Adobe SWF Investigator from the sample file I linked above, just open the file, go to the Tag Viewer tab, select DefineBinaryData tag and press Dump To File button.

Sometimes there could be numerous fake DefineBinaryData tags inside, just to make your life harder. To find the desired tag, you should look inside the packer’s loader code and track down where is the embedded SWF is created to be decrypted and loaded.
Usually it looks like this:

var someVar:ByteArray = new SomeClass();

Where SomeClass is type of Class extending the ByteArrayAsset class.

Let’s look at the sample SWF loader code and look for something like this.
Gotcha! here it is:

private var content:Class;
//...
var _local3:ByteArray = new this.content();

So, we should look for the class with name ending on “_content” and extending the ByteArrayAsset class.
We have one match here:

public class MainTimeline_focus_loader_content extends ByteArrayAsset

To get which DefineBinaryData tag is linked with this class, we should look into the SymbolClass tag and search there for a record with found class name “MainTimeline_focus_loader_content”.
And we got it (in Adobe SWF Investigator):

<Symbol idref='1' className='MainTimeline_focus_loader_content' />

Remember idref value. This is a desired DefineBinaryData tag id!
Now go and search the DefineBinaryData tag with id = 1 – that tag will be needed one, so we can just dump it in a file and continue unpacking.
Why I asked you to remember the idref value instead of class name? That’s because in case loader AS will be obfuscated, it could be really hard to work with class name.

Now your success depends on your free time, packer’s loader difficulty and your luck)
If you’ll be a lucky one, that data dumped from the DefineBinaryData tag will be the pure, not encrypted SWF, and unpacking will be finished.
But in most cases data is encrypted and you should reverse engineer the packer’s loader code and make own decryptor.

In our case the loader’s code is extremely easy and not obfuscated, so we can easily found the decryption function:

private function decryptFile(_arg1:ByteArray):void
{
    _arg1.position = 0;
    var _local2:int = -1;
    var _local3:uint = _arg1.length;
    var _local4:uint = uint("55");
    while (_local2++ < _local3)
    {
        _arg1[_local2] = (_arg1[_local2] ^ _local4);
    };
}

All we need to decrypt file from the DefineBinaryData tag is just xor each byte of it by 55.
That’s all. Now you could write decryptor, decrypt SWF and decompile it to see the desired source code. And pray this decrypted swf will be your target swf, not the another one with packed swf inside haha! Sometimes packers uses the Russian Matreshka doll approach to hide target swf and other techniques to make static unpacking harder. Anyway, dynamic unpacking will beat all of them.
Remember – in Flash world, nothing only variables names can be hided from the true professional with high motivation level.

Any questions, ideas, comments? Feel free to leave it below!

Posted in dev, look at this! | Tagged , , | 3 Comments

Nape and Starling together? It’s possible!

# post updated (see UPDATED #3)

Hey, friends!

Somebody of you already tried fastest 2D flash physics engine Nape with a GPU 2D rendering framework Starling together and noticed that Body.graphic property is class of flash.display.DisplayObject and it can’t be assigned to the starling.display.DisplayObject instance.

So, some of you just used Box2D, some of you controlled Starling DisplayObjects manually, maybe some did what I did, but keep it away from public, but I like Body.graphic property – it’s really useful and I wish all as3 developers can easily use fastest 2d physics engine with 2D GPU rendering engine.

Today I’m glad to present you modified Nape FP 10+ swcs (release and debug) of the Milestone 7.2 “r3″ (maybe not fully) compatible with the Starling.

I just replaced Body.graphic flash.display.DisplayObject class by the Dynamic class (* in as3) and removed Body.graphic.rotation radians to degrees conversion to make it compatible with Starling in my case.
Now I can use Nape as usual, with usual DisplayObjects, it’s really cool!
Yes, there are possible some more compatibility issues, but this changes was enough in my case and Nape worked with the Starling DisplayObjects fine.

Feel free to download and use this swcs with Starling Framework!
debug swc
release swc

I like a challenge with caxe and flib compiling on Windows in the MinGW I faced while recompiling swc, it was fun!
To get the working swcs on Windows, you should:
1. Compile caxe from sources (only once).
2. Compile flib from sources (only once).
3. Use caxe preprocessor on .cx sources to get haxe (.hx) sources (every swc compile).
4. Compile haxe sources into the swcs (every swc compile).

Nape sources updates too often, thus, I’ll not keep this swcs sync with them, moreover, maybe we will see the Starling support officially in some of next Nape updates!

UPDATED:
By the way, manual Starling DisplayObjects control is really simple. You could do it this way:

// somewhere in your code
var someBody:Body = new Body(BodyType.DYNAMIC, new Vec2());
someBody.userData = someStarlingSprite;

// in some loop, as example, in the loop where you call Space.step()
var len:uint = _napeSpace.bodies.length;
var i:uint;
var body:Body
var sprite:Sprite;

for (i = 0; i < len; i++ )
{
	body = _napeSpace.bodies.at(i);
	sprite = (body.userData as Sprite);
	sprite.x = body.position.x;
	sprite.y = body.position.y;
	// limiting angle to +-360 and converting
	// degrees to the radians (Starling prefer radians for rotation)
	sprite.rotation = (body.rotation*180/Math.PI)%360;
}

That’s it!
This approach a could be slower when positioning and rotating your Body.graphic right inside of Body instances, because you should iterate through all bodies and call a bunch of getters\methods each frame.
But it allows you to use the latest native Nape swc with any third-party rendering framework, as Starling, and it’s great!

UPDATED #2
Nape was updated and in it’s new version we can use Starling DisplayObjects like this:

//...
body.graphic = starling_display_object;
body.graphicUpdate = _updateGraphic;
//...
private function _updateGraphic(b:Body)
{
    b.graphic.x = b.position.x;
    b.graphic.y = b.position.y;
    b.graphic.rotation = b.rotation; //keep radians since that's what starling uses.
}

Lee Brimelow recently created a new tutorial “Starling Physics Using Nape” where he demonstrates this approach on the sample project. Thanks, Lee!

Thanks to the Nape author, Luca Deltodesco!

UPDATED #3
Due to found bug in Flash Player Runtime (http://jpauclair.net/2012/02/25/epic-memory-track-down/), it’s strongly recommended to rewrite _updateGraphic this way:

//...
body.graphic = starling_display_object;
body.graphicUpdate = _updateGraphic;
//...
private function _updateGraphic(b:Body)
{
    var gr:DisplayObject = b.graphic;
    gr.x = b.position.x;
    gr.y = b.position.y;
    gr.rotation = b.rotation; //keep radians since that's what starling uses.
}

It will keep you safe from that bug and don’t let your memory to be exploded.

Posted in dev, look at this! | Tagged , , , , | 5 Comments

Meet the XFLTool 0.0.4 alpha

Hey, readers!
I’m glad to present you a new XFLTool version.

You can find in this version:
- rewritten from scratch Issues and hints module with numerous updates (and bugs, I guess)
- Bitmaps compression analysis is read-only now and doesn’t need jsfl association with Flash Pro
- Native Installers for Windows and Mac OS
- custom updates GUI
- options page (there will be a lot of stuff there in a future)
- changed log fields appearance and improved massive logs rendering performance
and even more.

Please, check the Changelog page to see the complete changes log for this update.
You can grab a new version on the XFLTool page only, 0.0.3 alpha will not update to the 0.0.4 alpha automatically!

I’m thinking now about placing XFLTool in the hg (Mercurial) repo on the Google Code and keeping work on it as on own open source project, but I should polish my most ugly places in the code before)

As always, I’ll be glad to see your opinion, suggestions, bug reports, etc., feel free to write me!

Posted in XFLTool | Tagged , , , | Leave a comment

Flash 2D Physics engines fast comparison: Nape (haXe) vs Box2D (Alchemy)

Nape: 6.1 r49 Release for FP 10+ (built with haXe)
Box2D (Alchemy, WCK): last build from GitHub (pulled 09.11.11, built with Alchemy)
Flash Player: 11.0.1.152 Release 32 Bit Standalone (Projector) – Desktop
AIR: 3.0 – Mobile

I’ve tested these engines both on Desktop (Win 7, Core i7 Q740, 1.73 GHz per core, 16 GB DDR3-1333 MHz) and Mobile (Android 3.1, Samsung Galaxy Tab 10.1, overclocked to 1.4 GHz per core).
I should tell, Nape was blazingly faster both on Desktop and mobile for me.

Example measurements with 1000 boxes on Desktop (30 FPS max):
Nape: 17-19 FPS at start, ~30 FPS after boxes fall.
Box2D: 2-3 FPS at start, 4-6 FPS after fall.

Please, feel free to run those swfs yourself:
Nape | WCK

Example measurements with 100 boxes on Mobile (GPU renderMode, 30 FPS max):
Nape: 30 FPS.
Box2D: ~14 FPS.

Please, feel free to compile and test AIR apps yourself if you wish:
FlashDevelop project (Switch Document class between MainNape.as and MainWCK.as and read *readme.txt carefully).

I’ll post some measurements done on iOS (iPad) later.

UPDATE
iPad results are similar to the Android.

Posted in dev | Tagged , , , , , , | 8 Comments

BETA ActionScript 3.0 Reference review

Hi! This is a current list of the properties, methods, constants, etc. from the beta reference requiring Flash Player 11 or AIR 3.0:

Packages (and everything inside):
flash.display3D
flash.display3D.textures

Classes:
AudioDecoder
AudioPlaybackMode (AIR 3.0 only)
CameraPosition (AIR 3.0 only)
CameraRollBrowseOptions (AIR 3.0 only)
EncryptedLocalStore (on mobile since AIR 3.0)
ExtensionContext (on mobile since AIR 3.0)
GameInput
GameInputControl
GameInputControlType
GameInputDevice
GameInputEvent
GameInputFinger
GameInputHand
H264Level
H264Profile
H264VideoStreamSettings
JSON
NativeWindowRenderMode (AIR 3.0 only)
SoftKeyboardType (AIR 3.0 only)
Stage3D
StageText
StageVideo (all devices support added to AIR since AIR 3.0)
StageVideoAvailabilityEvent (added to AIR since AIR 3.0)
TextInteractionMode
TouchEventIntent (AIR 3.0 only)
VideoCodec
VideoEvent (added to AIR since AIR 3.0)
VideoStreamSettings
VisibilityEvent
X500DistinguishedName
X509Certificate

Methods:
Sound.loadCompressedDataFromByteArray()
Sound.loadPCMFromByteArray()
System.pauseForGCIfCollectionImminent()
DisplayObjectContainer.removeChildren()
Capabilities.hasMultiChannelAudio()
ByteArray.toJSON()
Date.toJSON()
Dictionary.toJSON()
XML.toJSON()
Matrix.copyColumnFrom()
Matrix.copyColumnTo()
Matrix.copyFrom()
Matrix.copyRowFrom()
Matrix.copyRowTo()
Matrix.setTo()
Matrix3D.copyColumnFrom()
Matrix3D.copyColumnTo()
Matrix3D.copyFrom()
Matrix3D.copyRawDataFrom()
Matrix3D.copyRawDataTo()
Matrix3D.copyRowFrom()
Matrix3D.copyRowTo()
Point.copyFrom()
Point.setTo()
Rectangle.copyFrom()
Rectangle.setTo()
SecureSocket.addBinaryChainBuildingCertificate()
Vector3D.copyFrom()
Vector3D.setTo()

Package functions:
flash.crypto.generateRandomBytes()

Properties, constants:
Camera.position (AIR 3.0 only)
Event.TEXT_INTERACTION_MODE_CHANGE
MovieClip.isPlaying
NativeWindow.renderMode (AIR 3.0 only)
NativeWindowInitOptions.renderMode (AIR 3.0 only)
NetStream.mediaTypeData (added to AIR since AIR 3.0)
NetStream.videoStreamSettings
SecureSocket.serverCertificate
SoundCodec.PCMA
SoundCodec.PCMU
SoundMixer.audioPlaybackMode (AIR 3.0 only)
SoundMixer.useSpeakerphoneForVoice (AIR 3.0 only)
Stage.stage3Ds
TextField.textInteractionMode
TextField.textInteractionModeChange

And some requiring Flash Player 12 =) I think it’s just a typo:
Graphics.cubicCurveTo()
GraphicsPath.cubicCurveTo()

And Proxy class became top-level (was in the flash.utils package)

Posted in dev, look at this! | Tagged , | 1 Comment

Tips for using Flash efficiently on DevCon

It was some time ago, but looks like I forgot to mention this event here.
So, Adobe asked me to get my “Efficient Adobe Flash Professional using” post to make the Developer Connection article based on it (thanks to Thibault Imbert!). I agreed of course) After some iterations of work on the DevCon article with great people from Adobe, it was released on 29 August 2011!
You could check it out here: http://www.adobe.com/devnet/flash/articles/efficiency-tips.html

Also, I was informed by Edward Sullivan (Product Manager from Adobe) today I won the Adobe Cookbook competition! This news are really exiting for me, thank you, Adobe, once again!)

Posted in article, look at this! | Tagged , , , | Leave a comment