Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!

We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.

Data 'ponents

Posted by evolutional, 06 May 2013 · 263 views

I've been working (slowly) on the Unity-like Component System that backs my current game project. As time goes on, it's becoming less and less like Unity.

So I was thinking over the "tagging" system I added last time and quickly came to a couple of realisations.

1) Having a "string" based tag is limiting, what I really want is an object-based tag that would let me attach arbitrary data to the entity
2) Following on from this, I realised that this was akin to having a data-component

Now I'm thinking of splitting up my component system into DataComponents and BehaviourComponents. The key difference is that DataComponents would be just pure data attached to the GameObject. Behaviours are more like they are now, with a Start/Update method - I would also look more into beefing up the message passing so that the primary route to inter-object communication is via async messaging.

Why would I do this? The reason at the moment is very much down to the fact that I have a bunch of data associated with a component that I need to share between a couple of others. The way I'm doing it at the moment is to have components reference each other to grab the shared data. This feels bad. I could either consolidate them into one to try something new.

I'm thinking of doing the data component way.

Have you also considered using seperate systems atop of purely data based components, like in EntityX? I find that most convinient, and it decouples the whole thing to an extent where communication and dependency between entities, components and systems are reduced to the absolut minimum. You wouldn't even need a messaging system for the base functionallity that way. I don't know what your requirements are, but I'd say you can give it a look, if you havn't already ;)

Well, it basically looks like I'm on the way to recreating EntityX. I started with "let's recreate Unity's system".

Yeah, I know what you're talking about. I started out with a behaviour-component based approach as featured in that one gamastura articel, and ended up with my own implementation of EntityX.

Thanks for the tip though. EntityX looks like a nice system to work with.