Jump to content
  • Advertisement
Sign in to follow this  
earl3982

Data-Driven Design via a Game Object System

This topic is 4886 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

While reading and studying material over at the Ogre3D (an open source 3d engine), I came across a page that discussed game object systems and data-driven design in games (http://www.ogre3d.org/wiki/index.php/Architecture_and_Design_in_Games). I was wondering: Have you tried this approach? If so, how successful were you? If your game was multiplayer, how did you deal with synchronization? Are you willing to share some details of your implementation? Like some class diagrams or information flow diagrams? Do you know of any additional resources on the web for this topic? Thanks in advance. -stephen

Share this post


Link to post
Share on other sites
Advertisement
Last night I got on gamedev to search for thoughts on this matter, I think I got just what I was looking for :) I read over everything yesterday and today to try and grasp the entire concept before replying.

I have never done a system like this in a game (my games are never complicated anyway). But I think I like the idea that a game is just a collection of independent systems operating on a database. I would like to learn more about this kind of component architecture as well. However, a few issues stand out in my mind, I think that discussing them would help explain the actual workings of such a system:

Do these Component/Property/Attributes (components)...
1. only represent data fields in a database.
2. represent both data and the behavior associated with the data.

In the first case, I would add a PhysicsModel component that stores all physics data and then run the component data through a "PhysicsEngine" system every tick; however, in the second case, the PhysicsModel component itself will perform the physics computations on the data every tick.

In the first case, how can I declare that a certain piece of data should be accepted by a particular system or not? More data, such as a bPhysicsObject field or does PhysicsEngine does its thing to ALL PhysicsModel components it can see?

In the second case, how can I declare components that provide data that does not need to be operated on (e.g. RenderScale component) It seems wasteful to have something like an empty update function:


bool RenderScaleComponent::canBeUpdated(void) const
{
return false;
}

void RenderScaleComponent::update(float timeDelta)
{}

^
|
Inefficient? Or am I thinking about this all wrong?


Would it be best to store a component in a database that allows arbitrary queries to the data contained within, and also performs some operation the data each tick? For example, should the aforementioned PhysicsEngine be a database that not only stores all PhysicsModel components, but also performs computations on the data every tick? The alternative would be storing PhysicsModel components in a generic "data store" database and making the PhysicsEngine query the data store for the components it wants.

I'm leaning towards the last method, and then I'll be able to operate in batches nicely. Also, for network play, I could just send changes to the data store to the server. The server can sort out conflicts between clients on its own. Maybe synchronize all clients every few seconds by sending them the server's version of the entire data store

Share this post


Link to post
Share on other sites
Yeh, the whole idea is very interesting. It's just the implementation that is mysterious. Anyone else have any ideas?

Share this post


Link to post
Share on other sites
Hi,

Jussi Lepisto did something like that in his spineless engine using python.

One could do something similar in C++ by implementing introspection/reflection support in the engine's classes or rely on RTTI/type_info (dynamic_cast is your friend here, or just compare type_info structs).

Edit:
Assuming the components are not just stupid data, but also contain some logic the question of inter-component communication rises. E.g. a physic component should pass the position/orientation result of it's computations to the transform component. This could be accomplished if some kind of messaging is used between the component. Another possibility is using callback's e.g. in the form of signal/slots.


regards,
stephan

[Edited by - stephanh on July 29, 2005 12:17:51 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!