So I’m here to update everyone on the status of the “LoD Game Framework”. I’ve been adding all kinds of interesting objects into the library since the last time I posted and I’m happy to say a big release is coming soon. This release doesn’t particularly mean the whole library will be functional, but a section that I bet a lot of people want will be up and running.
Before we get to that nice little surprise, let me discuss some of the interesting things I’ve been adding.
For starters, I contacted Jim Armstrong aka Singularity, author of the AS3 parametric curve library at Algorithmist.net. I wanted to abstract the algorithms from his library for use in my parametric curves and requested permission from him. The interface for the version I’ll be releasing is going to be heavily trimmed down. I’m removing a lot of the stuff that deals with ‘drawing’ curves to DisplayObjects and just keeping anything dealing with the math of curve. Instead another set of objects will assist drawing the curves along with other geometry I’m including.
And there’s another one! Geometry, right this very moment (I’ve been up all night… vamp!) I am coding up a set of objects called IGeometricShapes. These shapes are for mathematically representing complex geometry, and allowing you to extend and create your own special geometry. There are two basic types of IGeometricShapes at this time: convex smooth edged shapes, and polygons. Convex smooth edged shapes include stuff like circles and ellipses, where polygons represent stuff like triangles, quadrilaterals, pentagons, hexagons, etc.
I’ve also started work on a more robust Tweening library then that garbage one I posted here months back. Now that might not make most of you happy, and at this moment it is very much in its infancy. But what I’m going to be doing in turn is setting up an interpretor class that will allow you to inject your own tweening engine into the entire framework. What this means is that you can easily wrap the LoDTweener around lets say TweenLite or the likes, and any part of the framework dependent on the LoDTweener will utilize your favourite tweening engine instead. No need to change code inside the framework to coerce it into using a different engine… further more I plan to let you swap this stuff out on the fly. This means you can code your entire project around the LoDTweener and then just simply update the interpretor class with what engine to use (no this is not implemented yet, that’s for the future). Some might ask WHY I don’t just include TweenLite, or why I just don’t use any Tween Engine at all. Well I need tweens for different parts of the framework, so that’s that, I can’t go with out. But not all Tween engines out there are free, for instance my favourite one ‘TweenLite’ has a very restrictive license on it that doesn’t fit into my open MIT license I’m sharing this under. So instead I’m giving any of you the choice to use whatever you want with ease.
I’ve also got a large portion of the tiling system set up. This is what lets you create 2D cameras and scroll scenes. The tiles allow you to layer your scenes and create panning effects like parallax scroll. There isn’t a lot I have to say about it at this time as I’m not sure exactly how much I’m going to be putting into it. I have this issue where I want to balance it between being light weight for those who don’t need everything, and having great options for those who do want everything. Please, let me know what kind of layering, camera, and scrolling techniques you want included!
Lastly in this literary update, the most exciting part (for me…). My Physics Engine is nearing completion, I hope with in the next 2 weeks to have it out on the table with some demos for everyone to check out. Now again I’m taking an interpretor style design with the physics engine. That’s right, I’m not going to force you to use only one style of collision detection, or one style of collision resolution. I’m not going to hand you a restricted list of geometry or leave you out of the loop of the whole process. Instead there is several small sectors of it that you the user get to control.
1) IPhysicalAttrib – meaning “Interface of a Physcial Attributed Object”. This interface exists soulily for you designing your own physical bodies into the PhysicsEngine. There are a couple ways to implement it. You can directly just pass a PhysicalAttribute object into the engine and update via this object, or you could implement the IPhysicalAttrib and expose the inerface of the PhysicalAttribute through it (similar to implementing IEventDispatcher), or you could implement the interface your own special way creating you own effects inside the engine. This allows you to directly add any class you want to the PhysicsEngine just by implementing the interface.
2) IPhysicsCollection – this interface describes collections of objects for manipulating the physics of. This allows you to create independent groups of objects that interact internally only, or you can combine groups to create global conditions. The collections range in functionality to allow you to describe all kinds of scenarios and keep processing power down. For instance, say you have a level filled with static rigid bodies that don’t react to forces or anything, yet the player can collide with them. There is a style of IPhysicsCollection to describe this situation easily. This way the physics engine completely ignores these static objects interacting with each other but still allows the player to collide with them.
3) CollisionMesh – the collision mesh is a property of IPhysicalAttrib, it’s one of the most important object interface uncovers for any physical body. Through the CollisionMesh you describe the collidable area of any object. There will be a couple different types of CollisionMeshes that come default and you have the ability to define your own. The planned ones as of right now include:
- Simple CollisionMesh – used for describing a basic OBB
- GeometricCollisionMesh – adapts the earlier described IGeometricShapes to describe a convex hull
- BitmapCollisionMesh – describes a DisplayObject as a BitmapData object for pixel perfect collision (with a performance hit though)
Of course again there is the ability to make your own types of meshes.
4) CollisionDetectorAlgorithm – a CollisionMesh allows you to attach any algorithm to it for detecting collisions. There are a couple of algorithms included directly, and of course an interface for you to add your own. You can easily swap out algorithms with a line or two of code, and you can even allow different objects to use different algorithms at the same time!
5) CollisionResolverAlgorithm – when a collision occurs it is passed along to the engine to be resolved. Any given IPhysicsCollection can have a unique resolver algorithm set to it (or just use the global default set in the engine Singleton), this allows you to pick and choose how objects react when colliding. For instance you can use a simple resolver algorithm that just doesn’t let objects intersect, or you can use more complex once that simulate friction and elasticity, or you can even more precise and include angular velocity and other fun stuff.
6) CollisionEvents – when collisions occur two events propogate. One informing the entire project that a collision occured and another for when it is resolved. You can hault the collision once it’s occured for any reason and stop it from being resolved. Lastly the event is dispatched from 2 places. You can listen to the PhysicsEngine itself to capture all collisions that occur, or each object that is part of the collision also dispatches the event themself. This also means that if the object implementing the IPhysicalAttrib interface is also a DisplayObject, the event will bubble through the DisplayList.
So be ready guys, I’ll be updating again in the near future with a fully functional physics engine for everyone to tinker with. Instead of trying to go for a fun realistic engine, I went for something that is useful. You can still create the really interesting accurate physics, but you can also just create simple physics that are more useful in most videogames. You don’t always need angular velocity, or elasticity, so instead the choice is there, but not necessary.
You can still download the library in its current pre-alpha state in the link bar.