Sign in to follow this  
The Communist Duck

Yet another entity/component system

Recommended Posts

Hi. I've fiddled around, and I thought of a decent component design with XNA. I've tried to avoid the built in GameComponent for the most part.

There are Components such as PhysicsComponent and RenderComponent which derive from Component. Each Entity contains a list of components (I don't see myself needing to query for a PhysicsComponent; I could just send it a message). Each Component may register to some system - e.g. the PhysicsSystem, or the graphicsSystem (I think these would be static; comment?)

The World derives from DrawableGameComponent, and calls Update on each entity (which calls it on each Component) and Render on the GraphicsSystem (which has the list of RenderComponents).

I don't see myself needing a hugely complex one.

Feedback on it?

Share this post


Link to post
Share on other sites
Deran    101
[quote name='The Communist Duck' timestamp='1305886702' post='4813408']
Each Component may register to some system - e.g. the PhysicsSystem, or the graphicsSystem (I think these would be static; comment?)
[/quote]

You might find this useful: [url="http://gameprogrammingpatterns.com/service-locator.html"]http://gameprogrammingpatterns.com/service-locator.html[/url]

That way the systems wont have to be static, you can just have one static class that locates them.

There's also some stuff about components on that site.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this