Sourcecodes max-spark-05
December 2nd, 2005
A bit late, but as promised the sources from the previous conferences in korea and amsterdam. The ZIP includes my sleazy attempt of a winamp like music visualisation and lots of undocumented stuff, I have shown during the sessions. You are welcome to play with.
Filed under: actionscript | 6 Comments »
AS3 optimations & suggestions
November 9th, 2005
AS3 rocks, but hey (arg), I still need more performance. First of all some findings.
Read the rest of this entry »
Filed under: actionscript | 22 Comments »
Hashed Slowmotion Camera
November 8th, 2005
I have no idea, if this could break your computer, since I'm using a lot BitmapData instances, while applying this effect. Be carefull.
But if it's running fine, you can do thinks with yourself, you didn't noticed before, hehe. I cannot stop making faces with it.
8ball lab | camera/motion_hash (flash8player & webcam required)
Filed under: actionscript | No Comments »
AS3 Raycaster
November 2nd, 2005
A fast implementation of a raycaster. You can move forward by pressing the mouse button. This version also provides a camera roll and height, ceil and floor tiles. To boost up the code, I'm using a lookup table for sin, cos, tan and massive bitshifting. The code is accordingly unreadable. What I'm really missing is a typed Array with simple bytes to write faster code, just reading RGB values. I have the feeling, that the getPixel method is too slow. This causes the small stage (240x160px).
Update 2010
The files are missing for some reason. However the Raycaster is still here even though it is very old now.
Filed under: actionscript | 23 Comments »
AS3 Sweet lightning particles
October 28th, 2005
Over thousand particles with little scalings on the buffer bitmap can look really sweet.
Read the rest of this entry »
Filed under: actionscript | 43 Comments »
AS3 Performance
October 28th, 2005
This is an old experiment from flashmx times. After converting to AS3, I'am really exciting. While the optimized AS1 version makes up to 12 circles, the new version can handle 200 very easily. Note that these are 19900 distance calculations each frame plus moving, bounding and resolving the detected collisions. No problem to imagine, that you can write a 9ball billard application which high resolution physics.
200 circles coliding : flashplayer8.5 needed
//-default-size 256 256 -default-frame-rate 120
Filed under: actionscript | 3 Comments »
AS3 Wavemap
October 27th, 2005
I've implemented this great tutorial The Water Effect Explained now in AS3. Maybe, its a little small, but it only looks good, when you get at least 50 fps (best 80-90).
I have done this in AS2 before with blendModes and the ConvolutionFilter, trying to emulate the very simple algorithm for performance, but the results are not as the original. So I know, that AS3 is much faster than AS2..., but its too slow in such cases. One solution is to blow the output twice, but you really need a high fps, which is mostly not possible to get in browsers which other things moving around.
Anyway, I have modified the tutorial to compute with Integers (int), which are much faster than floats(Number). The result is rendered in gray to the output. If anyone found possebilities to increase the performance, tell me.
AS3 wavemap (Flash8.5 Player needed) - one step before water simulation (displacement)
Compile this with -default-size 80 80 -default-frame-rate 80
Filed under: actionscript | 7 Comments »
Another Gooify
October 25th, 2005
grant skinner has done this already and I tried it before, but got lost. I wanted a solution where the displacement output is rendered onto the source image. This would be more fluid, cause you could move pixels endless in the bitmap. But after grants post, I tried another solution, which appears to be the same as grants one. here is the source to play with.
Read the rest of this entry »
Filed under: actionscript, links | 4 Comments »
AS3 Perspective Texturemapping
October 19th, 2005
This is the first step of a long journey. The example parses 3ds (3dmax) files and renders the scene pixel by pixel with a 'real' zBuffer for exact z-Sorting and a simple distance shading. There is a lot of space to increase performance. The most problem is drawing the pixels on the screen. The calculation of 236 faces connecting 190 vertices while clipping at the front plane is no performance problem. Commenting out the setPixel row, increases the FPS to 120.
Note: This example requires FlashPlayer 8.5
perspective texturemapping part 1 | based on Mikael Kalms 1997
Filed under: actionscript | 47 Comments »
Pixelstyled 3D Cube
October 15th, 2005
Just an idea, but I like it. This was not possible in Flash7- while strokes couldn't act as a mask. This one works with copyChannels , which should be much faster than a threshold solution. Maybe a 3d carracing game with this optic would be nice.
Read the rest of this entry »
Filed under: actionscript | 2 Comments »
Another Glass Example
October 13th, 2005
Mario (quasimondo) had done it a few weeks ago, but I wanted to make my own glass filter. The common technic is very simple. You can use the native BevelFilter to create gradients for use with the native DisplacementMapFilter. This Assembly seems to refract the light from the enviroment and its fast.
Read the rest of this entry »
Filed under: actionscript | 1 Comment »
flash8 sourcecodes
October 5th, 2005
As promised on the german-flashforum-tour 05 here are the source files [8MB], where I demonstrated some flash8 bitmapmanipulation and effects with. The package provides both sessions: Natural Born Filters and the Flash3d part.
Filed under: actionscript | 17 Comments »
BlendMode Math
September 28th, 2005
If you wonder, what blendmodes are doing exactly, you can read this article about blendmodes in common. I tried to work with them in a accurate way to emulate complexer algorithms like animated water waves. Generically you can save a lot of performance, if you need to calculate every single pixel colorvalue from two bitmaps. In most cases, there is a simple solution using ColorTransform and Blendmodes. One problem is that the flash results are different in some cases, so here are my findings:
// **BLENDMODES // based on: http://www.pegtop.net/delphi/blendmodes/ // modified to fit flash output /* [for each color component] RGB */ // ADD // c' = Math.min( 255, Math.max( 0, c0 + c1 ) ) // SUBTRACT // c' = Math.max( 0, c0 - c1 ) // MULTIPLY // c' = Math.floor( ( c1 * c0 ) / 0xff ) // SCREEN // c' = 255 - Math.floor( ( 255 - c0 ) * ( 255 - c1 ) / 255 ) // LIGHTEN // c' = c0 > c1 ? c0 : c1 // DARKEN // c' = c0 < c1 ? c0 : c1 // DIFFERENCE // c' = c0 > c1 ? c0 - c1 : c1 - c0 // INVERT ( no influence from c1 ) // c' = 255 - c0 // OVERLAY // c' = c0 < 128 ? Math.floor( ( c1 * c0 ) / 127 ) : 255 - Math.ceil( ( 255 - c0 ) * ( 255 - c1 ) / 127 ) // HARDLIGHT // c' = c1 < 128 ? Math.floor( ( c1 * c0 ) / 127 ) : 255 - Math.ceil( ( 255 - c0 ) * ( 255 - c1 ) / 127 )
For example if you like to compute the average colors from 2 different bitmaps, you can follow like this:
import flash.display.*; import flash.geom.*; //-- test here 2 colorvalues var c0: Number = 234; var c1: Number = 255; //-- source bitmaps var b0: BitmapData = new BitmapData( 1, 1, false, c0 ); var b1: BitmapData = new BitmapData( 1, 1, false, c1 ); //-- resulting bitmap var be: BitmapData = new BitmapData( 256, 256, false, 0 ); //-- compute average var half: ColorTransform = new ColorTransform( .5, .5, .5, 1, 0, 0, 0, 0 ); be.draw( b0, new Matrix, half ); be.draw( b1, new Matrix, half, 'add' ); trace( be.getPixel( 0, 0 ) ); trace( Math.floor( ( c0 + c1 ) / 2 ) );
Of course this is a simple one, but you get the idea.
Filed under: actionscript | 4 Comments »
Sphere Texturemapping via DisplacementMapFilter
August 11th, 2005
I thought a long time about it and tried it the second time now. The idea is a freeze a current pixels displacement, as it naturally occur when projecting bitmaps into another enviroment like a sphere coordinate system. I created a gradient table in flash8 where the x and y values are stored as color-components (red/blue). I switch to 3dmax where I build my model (here a sphere) and map the gradient onto the mesh. The next step is to look, where the original positions of the texture was by comparing the source and the projected bitmap and compose a displacement map of it. I think, this is the screwiest workaround, I've ever done in flash.
Filed under: actionscript | 36 Comments »
Bezier clipping against all orthogonal axis
July 17th, 2005
After I trying some studies with my AS1 solution I found a lot of misbehavior, while clipping. So I started to develope a completely new solution in AS2. The code provides to clip against any orthogonal axis and furthermore it's easy to extend in 3D. The hardest issue was to solve a division by zero in a few cases. I've tested it for a long time and it seems to be solid for me. Anyway, if you found any bug, please leave a comment.
Read the rest of this entry »
Filed under: actionscript | 4 Comments »
Tight FPS Solution
July 7th, 2005
PercyPea (well known from flashkit - mario kart thread) sent me an email, where he describes a solution to force the browser plugin to hold the FPS very tight.
I tried it for my tileengine games/supermario. It seems to be true and I really would like you to give me your framerate at this example. It should be about 32/33 and actually firefox makes it fine. PercyPea makes also a thread on flashkit, where you can post your comments.
The idea is to adjust 120 FPS and slow down by running a loop untill the necessary milliseconds are passed. Simple as for example java do.
Filed under: actionscript | 27 Comments »
Flash physics
June 28th, 2005
Stuart Schoneveld sells his physics engine ICE, while Alec Cove releases flade, an opensource as1 physics engine, which looks very promising (via lessrain). After that, watch this little demo of inverse kinematic. Kind of deformedly, but well done physics implementation.
Filed under: actionscript, links | 4 Comments »
FDT – not just another eclipse plugin !
June 27th, 2005
powerflasher has developed an eclipse plugin for actionscript the last six months and it is currently entering the beta phase. I'm working with fdt for three days now and I can say that this is a killer plugin. Never thought, that any eclipse plugin for actionscript could be that intelligent. It saves a lot of time and writes a lot of code for you automatically. Once you've started developing with it, you don't want to miss it anymore ! Congrats to Nico Zimmermann from powerflasher, who is the man behind fdt.
fdt will be a commercial product, different from asdt, which is still in alpha development and incommensurable. watch the fdt demo videos
Filed under: actionscript, announce | 2 Comments »
Impressive 3d isoengine
June 23rd, 2005
Another iso-based 3d engine is coming up from stimunationgames. Seems to be very fast and looks nice. Although there is no z-sorting implemented yet which, I know from uniroyal funcup is very difficult - almost impossible, if more movable sprite are involved. Maybe they find a solution. Good luck for this :o)
Filed under: actionscript | 6 Comments »
Methods on primitives
June 9th, 2005
Theodore Patrick posted a comparison of calling a method on primitives, once by themself and by creating an object before.
In my opinion the second line is faster than the first one, cause the interpreter can find the method faster from the object list. According to Theodore Patrick its about the garbage collection. The flashplayer creates an object, when you are not working with an instanced primitive and delete it after calling the method.
//-- Testing by Theodore Patrick //primitive string a = "Hello World"; //object string a = new String("Hello World"); i=10000; while(i--){ a.split( " " ); } trace( getTimer() );Anyway, what you have to keep in mind is, that you have to instance any primitive by new when you need to call a method heavily. Simple computation like a*b or expressions like a = !b are much slower if you are using objects.
This is found is a similar way by holger kohnen in 2003!
More confusion can be found, when comparing primitive values
//a = true; a = new Boolean( true); trace( a === true); // false //------------------------ //a = 3; a = new Number( 3 ); trace( a === 3 ); // false
Keep this in mind...
Filed under: actionscript | 1 Comment »
as2lib goes 0.9
May 31st, 2005
Simon Wacker announces the version 0.9 of the Actionscript 2.0 package as2lib on his weblog.
I have had several discussions on ICQ with Martin Heidegger, one of the authors who wanted to provide some usefull functions from my as2base. I'm quite proud, that some of my ideas have found a way in their reasoned framework. I will see, if I can throw my as2base in the trashcan :)
Filed under: actionscript, announce | No Comments »
Some bezier stuff found
May 18th, 2005
I found an old backup CD from with some long missed source codes.
I filtered out:
bezier clipping - clips a bezier curve at top edge
bezier normal - computes a normal through a point
bezier collision - computes ball bezier collision based on their normals
They are all FlashMX, so I will convert them to AS2 next time.
Filed under: actionscript | 4 Comments »
Sourcecode flashconference stuttgart 05
May 2nd, 2005
For everyone who joined the flashconference, especially the rigibody session by mario and me, I've uploaded the source code right now. As we said, there is much to do, but its like a short briefing, how rigid body can be simulated for starters. The source code isn't optimized, so you can follow the instructions much better since we are using a vector class.
It was a very nice session and I hope we can repeat this. thanks to sabine, tibor, david, max and elias to come along with me on this conference. We had a great time ! Greetings to patrick thiel and holger eggert, not to forget frank baumgartner, who was accidentally in stuttgart the same time and joined for some beer in the evening (hehe).
related links:
read also marios blog entry
as2 gamepackage
Filed under: actionscript | 2 Comments »
Compute 3D rotations with localToGlobal
May 2nd, 2005
Driving home from the flashconference in stuttgart we had a nice conversation about MovieClip.localToGlobal. I thought it is possible to write a complete 3D camera class with it and it is.
//-- setup var xClip: MovieClip = createEmptyMovieClip( '0', 0 ); var yClip: MovieClip = createEmptyMovieClip( '1', 1 ); //-- apply angles xClip._rotation = xa * 180 / Math.PI; yClip._rotation = ya * 180 / Math.PI; //-- for each point pt = points[p]; pp = { x: pt.y, y: pt.z }; xClip.localToGlobal( pp ); tmpy = pp.x; pp.x = pt.x; yClip.localToGlobal( pp ); tmpx = pp.x; tmpz = pp.y; //-- end
The trick is to rotate 2 MovieClips representing 2 axis in 3d space. But it has not the performance boost at all, even using the native MovieClip function. A simple sin/cos Matrix is a lot of faster, but the idea was nice :o)
localToGlobal3D.zip (Rotating around 2 Axis)
Filed under: actionscript | 3 Comments »

