Weekly update of Top Down Shooter
All I have to show for it so far is a movable sphere on an invisible floor with a fixed camera. Most of the work is behind the code, in designing and planning it. Given the month-long deadline I gave myself, I don't want to get myself carried away in doing this. Also, I just got a new job and I have to work 40 hours (which I have not done in over a year) so I don't get as much time with this as I wanted to.
Components and Systems in the game
In the relatively little time I spent working on the game last week, most of the focus was on doing a design based on this. I have made Transform, Geometry, Movement, PlayerControl and Light components which already work for systems. Also, I found someone who wrote an article on using the ECS design for the same genre of game that I'm making, so this really helps a lot!
There are no specific classes for game entities/objects, just a generic Entity class that takes any kind of components, and only one of each. Some components are specific to the game, and other ones are more generic and general purpose. I'm fine with this- the low number of components still makes the code manageable.
I want to use more diagrams in my articles, so I will make one soon to give an idea of how the classes are laid out. For now I'll just write them out here:
Transform: Stores position, rotation, and scale
Movement: Applies change to transform
Geometry: Model representation of object
Light: Stores color, intensity (and other attributes)
PlayerControl: Stores input for player actions
FollowTarget: References another Entity to follow (through Transform)
Geometry - Transform -> Any entity represented as a visible object
Geometry - Transform - Movement - PlayerControl -> controllable player entity
Geometry - Transform - Movement - Bullet -> a bullet entity
Camera - Transform -> a camera entity
Light -> Light entity
BasicRenderer -> Draws visible objects with a default shader
PlayerController -> Takes input from player, updates movements
BulletCollision -> Adds, removes and updates bullets, check for collision (soon)
FollowTarget will be used for making enemies that always chase the player, and to move the camera with the player.
I need to figure out a good way in grouping and pooling the entities. Currently I have a Scene class that keeps a list of Visible entities to draw, and lights. This is good for passing to the BasicRenderer, and you can use any Camera you want with it. Additionally, I store the bullet entities in another list, which gets passed to the BulletCollision system.
The problem is that when the objects are defined for other behaviors, such as bullets, they are referenced in more than one place. When I have to erase a bullet from the bullet list, the bullet still exists in memory. It remains in the Scene's list, so the bullet is still drawn and frozen in place. So for now I may just deal with putting ALL entities into one list, to have one place to add and remove entities to, and have each system filter them out in real time.
That basically sums up how far I've gotten with the game. Like I said it's just a sphere (placeholder for a player model) that is moved around with the keyboard, and in an empty background. I will be adding a "target practice" test before having enemies with some sense of AI. If there's more time next week, perhaps doing more work with the graphics as well.