Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthoraxel012345
- CommentTimeMay 15th 2008 edited
Hi everybody :)
So first Flint is very nice , a lot of power and possibility , it's magic.
I have start to work with it, and it's very fun to do so.
The framework is young for the moment but the base is here and some stuff too :) . Let's continue !
I suggest just some little change :) for speed enhancement .
Maybe you have read too http://je2050.de/files/misc/as3opt.pdf
I have see this :
1- 2D loops
Iterations Cycle[ms] Simple for[ms]
1024^2 95.4 106.3
2048^2 355.8 738.6
So in many iterations a we keep a lot of time , maybe do test too to check and verify this time.
But it's can be use when we loop on particle in Emitter.
2- Not enhancement of book :
It's can be nice to have access at paletteMap of BitmapData in BitmapRenderer
Like this
len = _postFilters.length;
for( i = 0; i < len; ++i )
{
_bitmap.bitmapData.applyFilter( _bitmap.bitmapData, _bitmap.bitmapData.rect, ORIGIN_POINT, _postFilters[i] );
}
if( _aColorMapping.length > 0 )
_bitmap.bitmapData.paletteMap( _bitmap.bitmapData, _bitmap.bitmapData.rect, ORIGIN_POINT, _aColorMapping[1] , _aColorMapping[2] , _aColorMapping[3] , _aColorMapping[0] );
_bitmap.bitmapData.unlock();
and to use it a simple setter
public function setColorMapping( alpha : Array = null , red : Array = null , green : Array = null , blue : Array = null ) : void
{
_aColorMapping = new Array(4);
_aColorMapping[0] = alpha ? alpha : [] ;
_aColorMapping[1] = red ? red : [];
_aColorMapping[2] = green ? green : [] ;
_aColorMapping[3] = blue ? blue : [];
}
Yes color mapping not an enhancement lol but vey nice effect can be done with it , i think it's a "base" tool for graphic possibility and you.
3- In renderParticles of BitmapRenderer we have a lot of new Point( 0 , 0 ) , i have replace it by a static const ORIGIN_POINT in class .
Each frame update we have 4 or 3 don't remember Point create for nothing, so now more clean.
It's really enhancement and base file i have modify, in flint.
It's very important that Flint be Fast as possible.
Axel -
- CommentAuthorRichard
- CommentTimeMay 19th 2008
Hi axel
1. When looping over the particles in the emitter, our inner loop is over as many items as the number of particles. However, the outer loop is over the actions, which is usually a very small number. So rather than being 1024*1024, it's more like 6*2000 (actions * particles), so I doubt there will be a speed up (although I haven't tried it - have you?).
2. I haven't used color maps before so hadn't thought to include them. I'll check them out and add them very soon - your code looks like a sensible way to do it. Will let you know when it's in SVN.
3. Yes - an obvious optimisation that I missed. Thank you. It's now in SVN (although I used the name ZERO_POINT for the static variable - I think it's clearer). -
- CommentAuthorRichard
- CommentTimeMay 19th 2008
I've implemented the color mapping and checked it in to svn. called the methods setpixelmap and clearPixelMap since the flash docs call it a pixelMap not a colorMap. -
- CommentAuthoraxel012345
- CommentTimeMay 22nd 2008
Hi Richard :)
1. no but i will :) and keep in touch
2. Thanks for add it in speed way :D , but for the name and parameter , i think a framework is another layer between flash and user , if we can simplify and make it more clear , it's good.
The point is that the color mapping , in name in photoshop a color mapping , not a pixel , but yes it touch all pixel so it's not false, but the most clear is colorMapping, because it's what it does.
Another thing, i think setColorMap parameter must start with alpha and keep the ARGB model , the flash function paletteMap not respect this rule , don't do like them .
3. No problem :) , it's fine for me . Moreee powaa lol :)
Another time , thanks for your time :) to read , to enhance and to speak :) -
- CommentAuthoraxel012345
- CommentTimeMay 22nd 2008
A little question more , why have you replace all uint by int ?
Thanks :) -
- CommentAuthorRichard
- CommentTimeMay 23rd 2008 edited
Sorry, I miss wrote above. I called it setPaletteMap and clearPaletteMap, which matches the naming Adobe use. It is for mapping between color palettes, so calling it a color map or a palette map seems to make equally good sense to me. But calling it a palette map also links back to the naming Adobe use, which I do feel makes it clearer. (You are right - if I'd called it a pixel map as I did above that would have been bad.)
I don't know why I called the internal property _colorMap - either this should change to _paletteMap or the methods should change to setColorMap and clearColorMap. I propose the former but would value your opinion.
I placed the alpha last in the parameter list because it allows users to use the method with just three parameters for an RGB map and four for ARGB. This, I think, is also why Adobe do this. It's a difficult (although admittedly minor) choice. Given my reason, do you still think it should be the other way around?
P.S. I changed uint to int because it is very slightly faster on the current flash player. -
- CommentAuthorericr
- CommentTimeMay 23rd 2008
I changed uint to int because it is very slightly faster on the current flash player.
Where did you find that nugget? Is there a write-up somewhere?
I used uint wherever I could specifically because I thought it would be better optimized than or, at the very least, equal to int in performance terms. Weird. -
- CommentAuthorRichard
- CommentTimeMay 24th 2008 edited
Where did you find that nugget?
I ran some tests. -
- CommentAuthorericr
- CommentTimeMay 27th 2008
I ran some tests.
Sweet. -
- CommentAuthorericr
- CommentTimeMay 31st 2008 edited
Came across this in my recent travels:
http://www.gskinner.com/blog/archives/2006/06/types_in_as3_in.html
Wow. If those tests haven't changed due to some spiffy compiler changes made by Adobe in the two years since that article was penned I'm going to say "bye bye" to uints (and even, in many cases, ints)! -
- CommentAuthorRichard
- CommentTimeJun 4th 2008
More like spiffy player changes - more recent versions of the flash player are a lot faster dealing with uints. In my simple tests, int and uint were about the same speed, and Numbers were less than half the speed. When testing in Flint, the change from uint to int produced a small speed increase (a jump from 38 to 40 fps on the gravity wells example with 20,000 particles - it's not much but every little helps).
Talking of which, it's pleasing to note that the first ever version of the gravity wells example (before Flint was released) ran at 8fps with 1,000 particles. The first public version ran 5,000 particles at 30fps. Now it's 20,000 particles at 40fps. (all on the same computer). By my reckoning that's a 100x speed increase overall. Some of it is likely down to improvements in the flash player, but most of it is down to code optimizations. (The Flex profiler was invaluable.) -
- CommentAuthorericr
- CommentTimeJun 5th 2008
Ahh, right. I meant to say spiffy player changes than compiler changes. And the jump from 28 to 40 fps is definitely worth it. That's two more fps worth of processing we can devote to other processing (like game logic or physics)!
And those are some extremely impressive speed increases. I've definitely noticed a fantastic increase in speed since I started toying with Flint back in the pre 1.0 days. Great work!
A year old today but your mention of the value of the Flex profiler led me to a google search page yielding this. Damn that looks impressive. I currently use FlashDevelop and CS3 for my dev environment but that profiler is certainly enticing. -
- CommentAuthoraxel012345
- CommentTimeJun 9th 2008
Hi :)
For me it's more clear for people to have setColorMap for name , we change color with this , so it's logic, i don't care about adobe stuff, must do site for change sound api lol.
And too for the ARGB it's just a way to be more clear and be near the standard. To have the alpha at first is more clear, in this case , because we can change it.
Welcome after to the flash player 10 and powa lol :)
Thanks for your time :)
1 to 13 of 13
