I like to invite you to take a look at my work in progress
. It's an entity/component framework (for Slick).
I know I will get asked this question "What about Artemis?
". Artemis is a more abstract framework, not really for 2D, Slick, and quite difficult to master. Artemis is really an experimental framework. Artemis and Apollo are not directly related (except those familiar with Greek mythology know that they are siblings), although my experience and insight with Artemis surely has proven useful in constructing Apollo.
But enough of that, let's talk about Apollo, what's the big deal?
Spatials and priority fill
One of the big problems in 2D game development, IMO, is the "painters algorithm" or "priority fill" issue.
I make a lot of top-down games, and I usually have entities like a tank, tower structures, etc. A typical problematic tank entity would comprise of a hull and a turret. There are two issues:
1. How do you ensure that the whole tank gets rendered after the terrain.
2. How do you ensure that all the turrets get rendered after all the hulls? (So a barrel of one tank won't strangely disappear beneath the hull of another tank).
Apollo solves this quite efficiently by using "Spatials" and priority buckets.
Each entity can be given a spatial for rendering, and each Spatial must specify which Layer it belongs to. The rendering part of the framework then uses this and makes sure spatials are rendered on correct layers.
Nodes are supported, and are important to understand. For that tank entity you really have two spatials, the hull spatial and the turret spatial. You can make a TankHullNode which has a child spatial called TankTurretSpatial. TankHullNode gets rendered on Layer.UNITS_HULLS while the TankTurretSpatial gets rendered on Layer.UNITS_TURRETS.
Now, it's also quite easy to create a HealthBarSpatial which can be attached to the TankNode, or perhaps you can arrange this differently. You see where this is going, you really have a scenegraph here, so it's without limits how you can structure you spatials and attach to an entity.
Apollo comes with a variety of managers for tagging, grouping, player, teams, etc. You can even make your own custom managers and add it into the world, and get it from anywhere using the world instance.
Components are the main ingredient in entities. They contain the state and logic. You can make a "family" of same type components, like "Health" and "RegenerativeHealth", but other components do not know which one they're using.
There's a small example included in the code, but it doesn't really show how well this framework scales. I'm developing this framework alongside my work on Towerfield, so I will add things as I see they are missing, or refactor heavily. So far I'm amazed by the power of Spatials and Nodes, and the Layering. I will probably open up the code for this.
It's a very lightweight framework so there's not much need of learning.
I will probably be adding some sort of messaging and there's still missing lots of functionality in EntityManager, like getting all components of certain type, etc.
I only provide SVN access now: http://gamadu.com/svn/apollo/trunk/src/com/apollo/
Note: It's a work in progress, by no means is it recommended that you use this in your own game YET. It's simply not ready. For now I'd like to get feedback, quell questions, suggestions, for now.