At any rate, I have made a satisfying amount of progress just within the past few weeks. Bullet Physics is now integrated into the engine, and I have made significant improvements to the entity/component system. Right now I basically have a class called EntityFactory that allows you to register new IEntitySpawner derived interface classes, each of which override a single method, SpawnEntity. This will allow me to organize prefabs, since essentially object is a giant bucket of random components. So far, things have been working quite nicely. I have deviated from the Artemis style by allowing my entities to have lists of components, as opposed to a single component of each type. This helps tremendously when your entity is an articulate figure.
Before I say more, check out my first demo video! I'm not sure why the framerate is choppy, it's a smooth 60fps with vsync on my machine.
And if you looking closely, you'll notice that the tank flips over and does some ninja-like action with the turret barrel to pop himself back up. Booya! I plan to render the treads without simulating them, which requires some sort of gear-like rotation constraint between each wheel on a track. Unfortunately, Bullet has no such constraint. Therefore, I will need to write one myself eventually (unless one of you guys have one!). For the moment, I'm using a more involved method of two distance constraints per wheel pair along the track (just the immediate neighbors). They are set 90 degrees apart to avoid the wheels from accidentally switching directions and locking up the treads. It works quite nicely, but it's probably more computation than is necessary. Right now there are 16 distance constraints just to keep the tank wheels in lockstep. I'll need to buff up on my rigid body dynamics before I attempt a better method. If anyone has any suggestions I'd love to hear them.
The tank is basically a bucket of components, that are linked together as they require. For instance, there is basically one transform shared between each rigid body/renderable pair, and each physics constraint require at most two rigid body components. Right now I have three entity systems that are working behind the scenes, one for submitting renderables, one for simulating physics, and one for tank handling. Each system receives an event whenever an entity is created or a component is added. In turn, they keep a local registry of all the entities that they care about (i.e. they have a component that the system is flagged to watch for). The physics system watches out for constraints and rigid bodies. The rendering system watches out for Models (currently the only renderable type). Lastly, the player system watches out for the PlayerController component.
This last component is interesting because it helps turn a pile of intertwined components into a tank. The player controller contains info necessary to drive the tank, not user input. For instance, the tank needs a direction it should head in, a point to aim at, a request to fire, etc. This component is essentially agnostic of whether the user is driving or an AI, which is the point. Moving on, the player system looks for this component, and based on the type of prefab, it can pluck necessary components from the entity to control it. More specifically, the constraint motors are primarily what gives you control over the tank object. Basically, the player system is like a control console for the tank that operates all the machinery in the background.
I haven't figured out the best way yet to feed player input into this system. Most likely the input controller will operate elsewhere in the game object and fire events to this system. An entity could be tagged as the player, and the input applied to the player's tank. The current input scheme is a quick hack to get the demo up and running.
Finally, the concept art you see on the top left of this post is my first attempt at digital drawing. A coworker was giving away his old professional Wacom tablet, and I claimed it! Although my artistic abilities are somewhat lacking, you can see a rough idea of the feel I'm going for in the game. I don't want to give away too much right now, because it's all still very early in development. I just thought I'd throw that out there as a sort of teaser.