Posted in Examples on June 27th, 2009 by sHTiF

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.
Tags: Genome2D
August 4th, 2009 at 2:03 am
I’m creating the same type of lighting/shading system in box2D and I was wondering if you can give me some pointers on the shadow casting. I have it kinda working but it seems like the shadows have a few problems. I can send you a picture of the problem if you’d like.
thanks,
Josh
August 8th, 2009 at 6:08 pm
Shadow casting is kind of easy here its all about planar geometry, all you need is the sprites defined by vertices. Box2D structures are really handy here you don’t even need to have separate vertex definitions for physics and shadows and just simply reuse the ones in Box2D, unless you want the shadow casting polygon to be different. So the shadow is just simple vertex projection of the shape vertices from the light.
In the newer version there is also spot light and other shadow types like circle objects those are slightly more complex but still the major thing is the vertex projection.
September 13th, 2009 at 5:53 pm
I have the basic box shadow cast working. Basically it simulates the same effect of a drop shadow. First it creates a duplicate of the box2D shape and offsets it. Then it connects the the box2D shape and shadow shape together. My problem now exists when I don’t use a perfect box. I need to do the front facing edges culling of the shadow. I just have to figure out the math do so.
September 15th, 2009 at 7:53 pm
Josh i am not sure if i understand what you mean, can you give me a screenshot or some example of the scenario you are talking about?
September 21st, 2009 at 2:10 am
Say I have a square. To draw the square’s shadow, I have an array of stored points that represent the square’s corners. I offset these points depending on the origin of the light source. I then connect these points with the draw functions while also including the original points. This creates the shape of the shadow that is filled with the shadow color.
Now say I have a rectangle. The fist two points closest to the light source look odd. They keep the original box2D shape. It looks as if they should be skewed or removed.
February 14th, 2010 at 8:01 am
Josh sorry that i didn’t respond in few months but i am again working on Genome2D and finally got to your post.
Can you post a screenshot of the problem you mentioned, its better for me to visualise that way.