CoolIris widget using Agile3D

|

Hey, got bored today and created something, yep i keep surprising even myself. I am sure most of you are aware what CoolIris is, for those that don’t its a browser addon for image browsing, how eloquent :) Anyway i didn’t come up with the idea to recreate CoolIris just like that, i was actually working on a project where they wanted to have an image browsing similar as its done in CoolIris just little bit more complex, so using Flash 10 3D capabilities i created it. Didn’t use Agile3D in that project since its still not ready for production, but now some time later i was wondering about the performacne difference about Agile3D and direct Flash implementation in this exact scenario. Surprise Agile3D is way faster. :)

Thats all for now, its 6am and i need to get some sleep after all. Any comments/questions are welcome.

View demo: DEMO

Introducing Genome2D

|

Genome2D screen

Hi there again, these last 2 months were really dragging, too much work. Anyway its time to present one of my other projects that I found time to work on. Its a 2D engine for Flash game developers, atleast it should be once its finished.

The idea behind this project is kind of complicated, as some of you know i am semi-active in freeware game scene, and rapid Flash activist. Trying to bring more free developers to Flash scene, but i wasn’t too successful so far. The problem is that most people and programmers as well have this old image about Flash in their minds, you all know the concept, the terrible slow vector games, few click ad-games, and so on…

Since most budding developers are not hard-core programmers and use all kind of game developing tools instead of programming, so even if i was successful in showing them current abilities of Flash i still had no luck to actually persuade them to use such a complicated language as AS3. The few that were able to step up from various dev tools went to work in C# or Delphi instead.

Thats it, thats why i decided to meet the requirements somewhere in the middle, so the game developer doesn’t need to create any of the hard stuff himself but use Genome2D instead. It will do all the hard stuff so developer can focus on the game logic. Most of the engine so far is designed for top down action games, but it can be used pretty much during development of any 2D game.

It also implements a modified Box2D physics engine, which is an open source physics engine that can be found at http://www.box2d.org it really is a great engine so even if you are not interested in Genome2D but you just want to try out some physics give it a try. I said modified Box2D engine, even though there is an ActionScript version of the Box2D library it still has this C++ “sickness” of the original. That means it doesn’t really use ActionScript event model to its potential so i reprogrammed parts of the engine so it takes advantage of various events. I also added functionality as virtual Z height and position so that objects of different Z height/position doesn’t collide with each other, implemented concave triangulation, etc. Thats not really important here, anyway. ;)

Back to the main point, and that is demo of Genome2D in action. Keep in mind that this is really first, probably pre-alpha, version. Enjoy.

View demo: DEMO

The graphics used in the demo was created by me just so it looks better than simple shapes running around. :)
I am also aware of various optimizations that can be done, new features are on their way as well.

PS: For those that are more interested in 3D especially in Agile3D don’t worry I am still working on it.

Cover Flow Widget class

|

Hi, yesterday i bet that i can code cover flow effect in flash under 60 minutes, so i created this class just for fun. Its in Flash 10 and I decided to post the full source codes here for download, so anyone can enjoy it and use as they see fit just leave the authors info. It’s fully commented if there are some questions just ask or if you want some additional features and have problems I can look into it. I also made it fully customizable with public properties such as enable mirror, additional borders, various offsets and rotations etc…

One note, it uses TweenLite for tweening so download this great tweening class if you want to use this widget. It can be found at http://blog.greensock.com/tweenliteas3/ I had my own tween classes before but i decided after trying out various opensource ones out there to use TweenLite, first i don’t need to pack my tween classes to each one of my source codes, and second I can really appretiate great work if I see it. Check it out.

screenshot

Sourcodes: Cover Flow sourcecodes
Example: Cover Flow

Example can be navigated using arrows. The photos used are actually mine, they are from my trip to Geneva autosalon this March. Enjoy.

BTW i won the bet, this class was created from scratch in 50 minutes. ;)

Creating scene interactivity DEMO

|

Sorry for the delay, there were some major changes in my life and i didn’t have time to blog. The “bad” news is that i am no longer working for the company i worked for in last 3 years. We had some opinion differences about the company future, where i wanted to focus on application/framework/core development but it just wasn’t in the cards, however i am still staying as external collaborator. The “good” news is that i will have a lot more time for experimenting with flash. This was after all the major reason to leave the nine to five job, and focus on pushing the boundaries. If anyone has any interesting ideas, or wants a collaboration on some project drop me a line. :)

But back to the topic even though i really didn’t have time to work on Agile3D i am posting a demo on scene interactivity i created in january. Its simple, to interact with the textures just hold SHIFT.

View Demo: DEMO

First texture is a simple painter with a few tool options to experiment with, second texture is very simple video player just becouse this is probably the most used application within 3D in flash. The final texture loads external SWF, in this scenario its our old Flash 9 3D engine demo. The external swf uses stage position of the mouse for the rotation offsets, if someone really wanted to implement external swf as interactive texture its not a good idea to use stage property but rather use some kind of canvas. It doesn’t matter here, since the demo is just for fun :) Enjoy and keep tuned for the next demo, since this was never intended to be the final one.

Are there any examples of scene interactivity that you want to see?

Creating scene interactivity Part2

|

So where we finished last time? Oh I know now we know the coordinates of mouse click and pointer to a FaceShape instance. Why FaceShape, its simple if we only had Shape instances there would be no pointer back to a triangle data which rendered into that particular Shape. Thats why i made a simple class FaceShape which extends Shape class and contains pointer to a RenderFace instance. I’ll rather not go back into other solutions mentioned in previous part but suffice to say that if you use sprite method you will probably create something like FaceSprite or if you go the math method you will access the RenderFace structures directly anyway. But lets concentrate only on FaceShape solution. If you have any general questions about how to implement this with other method used up to this point just ask ;)

Now we have projection space coordinates which is simple mouse coordinates on the screen and projected vertices of the RenderFace, with both of these its a simple math using triangle equation to get the coeficients for position of the mouse coordinates within that triangle. Using these coeficients in the same equation using projected UV coordinates we can get exact UV coordinates where user clicked within the texture. There can be additional math involved if you use stuff like multitexturing or UVs outside 0/1 range or additional texture dependent mapping stuff you implemented, but basically thats it. Tadaa, simple enough now that we have the UV coordinates of the user mouse interactivity we want to propagate it to the interactive texture.

Here we are at the crossroad again, we have 2 options to go.

1. standard method used since Flash8, uses hidden InteractiveObject instance that overlapping the scene where user interacts.

2. using more sophisticated event model of AS3 to propagate events without direct user interaction

I am sure you all are aware of the 1st method, anyone that used some kind of texture interactivity in old Flash8 engines probably encountered it in one way or another. The principle is quite easy we have an InteractiveObject(it was MovieClip in Flash8) instance on the scene at all times interactivity is in progress but its not visible. Moving mouse over the interactive texture just provides information about positioning of the “invisible” InteractiveObject, and since its on the stage it will catch the mouse events directly all we need to do is position it correctly so the mouse over the object is always at the correct point. And we are pretty much done everything else will work automatically.

Downside to this method is that we need to have the InteractiveObject in the scene. It can’t be invisible as in visible=false since such objects don’t catch mouse events so we need to just fade it away using alpha=0 but as you already know there is a glitch, for example non-embedded texts can’t have alpha values. Other issue is if you are catching mouse move events which move in the opposing direction as the offset goes your movement will be jagged. I am not making myself clear here probably but its hard to explain, this problem is due to the double movement going on, first you need to position the IO instance into correct place so you move it but at the same time it catches the mouse move event. This is not major problem since this is visible only in few applications, like a texture painter for example.

Now onto the 2nd solution, one can say this is more complicated one but at the core its basically the same thing. In this scenario we don’t have the IO instance on the stage we just have it in memory but we don’t add it to the display tree (hence it wasn’t possible before AS3). Instead of offseting the IO instance within stage as in previous scenario we will propagate the event directly to the IO instance. So what goes on, we capture a mouse event, change its coordinates to the correct coordinates based on the UV coordinates we clicked, and then propagate it to the InteractiveObject instance. This can be a chain of methods, just for illustration in Agile3D since FaceShape refers to RenderFace instance which refers to material instance which refers to its texture instances where texture refers to its InteractiveObject element.

But there are downsides again, for example this will not work with native functionality within flash such as dynamic text selection. Basically any stuff that can’t be invoked only with mouse events but needs to actually happen will not work.

So there is not a ONE correct solution, it all depends what are you trying to achieve. Agile3D currently supports both methods, which let me tell you is a mess right now due to all the testing and tracing i did, you can picture it.

I hope i was making sense, sometimes its hard to explain something without going into unnecessary detail or math. That way it would be 20 pages long probably. If by any chance something isn’t explained enough or its confusing just ask as always ;)

Next i will post an Agile3D demo example of scene/texture interactivity.