I had planned to have something substantial to show off by now, but unfortunately I spent most of my time this week refactoring a bunch of code. Since it was what I spent the most time on this week, I thought I'd write about how I am using Component Based Game Design.
[size="3"]What is it?
Component Based Game Design is a somewhat new idea that has grown in popularity over the past couple of years. In CBGD entities in a game world are defined as aggregates of components that provide different pieces of functionality. A ball, for example, might have a physics component for handling physics (duh) and a graphics component for displaying the ball onto the screen. In the ideal implementation each component is independent and provides specific functionality to the entity, and components can be toggled on and off at any time without having an effect on other systems in the game.
[size="3"]What's so great about it?
CBGD makes it much easier to add new objects to the game. To add a new object all I need to do is specify the properties of the object within its components. Continuing with the ball example, I might tell the physics component that it is a circle with a radius of 0.5 meters and a restitution, or bounciness, of 0.5. The ball will automatically start to respond to physics without any other instructions.
[size="3"]How did I do it?
I got a lot of the ideas about my implementation from this forum thread at GameDev.net. In my implementation components store the data relevant to their particular functionality, and other systems in the game do the real work. A PhysicsComponent, for example, only stores data about the entity's shape and material properties, and the PhysicsManager does the actual physics processing. I have found that this makes for a much more flexible system than one that relies on the components themselves to do all the work.
[size="3"]Where can someone find out more?
I have found a number of resources that talk about implementing this type of system in a game:
Outboard component-based entity system architecture- the previously mentioned forum thread
Component based game engine design- look here for even more links
Evolve Your Hierarchy
A Data-Driven Game Object System Powerpoint Hopefully I'll have something exciting to show off by the end of this week. Thanks for reading!
[font="Arial"]Repost from http://hydroxicacidgames.wordpress.com/.[/font] [size=2][font="Arial"]Hello out there to anyone who's reading, and welcome to my new blog!
What is this? This blog is about my programming and game development experiences. I started this blog to showcase some of the things I am working on and to put a little piece of myself out on the internet. If you want to find out more about me, read my aptly named "About Me" page (if you can't find it, I probably haven't made it yet).
So what are you working on? Recently I have been working on a 2D game that I've tentatively titled Meep Wars (do tentative titles go in italics?). Honestly, I haven't worked much of the game design out yet, but I think it will have characters that look like the guy in the image below, and I know that it's going to be epic.
No, that's not a hat. Its a gun. Its cute, isn't it? Kind of? Come on, use your imagination.
Did someone say physics? Recently I integrated the Farseer Physics Engine into my game engine. This was not a simple feat, let me tell you, because of both the dearth of documentation and the fact that I am using OpenTK as my graphics API. The Farseer folks, in their infinite wisdom, chose to use XNA's Vector2 class, which means that every time I want to interact with the physics engine I have to convert between OpenTK's Vector2 class and XNA's Vector2 class. To add additional complexity, the Farseer engine wants values between 0.1 and 10, so I have to scale back and forth between pixel and physics world coordinate systems.
Fortunately, for your viewing pleasure, I have prevailed! Okay, so I haven't gotten triangles to work correctly yet. Whatever; circles and squares are all anyone really needs anyway.
You can download the program here. Checkout the ReadMe for directions. It requires OpenGL drivers and .Net 4.0. Enjoy this mildly diverting entertainment!