By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,469 Members | 996 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,469 IT Pros & Developers. It's quick & easy.

Which is better?

P: 89
Hey again!

I've made 2 separate systems, an ECS and a Collision detection system for a game. I want an event handling system for handling the communication between components and game management systems (collision detection, ECS and so on). After a bit of prototyping and thinking I've come to two separate ways I can handle this and I'm just curious as of which of these (or possibly any other way) is better.

1. I can have the event handling system deal with entities and give the event to the entity in question. Once received the entity could distribute the event to its proper components, but I see a problem with event duplication if there is multiple components of the same type on the entity in question, plus I'd rather not have the event (or anyone else who will receive the event), know who else got this event (like a target/receiver list or something inside the event).

2. The second way is that I could reference the components them selves directly within the event handling system, but I find the approach messy in a way (because of maintenance and debugging reasons). In my view the event handling system should keep to handling the events and have minimal interaction with the entities and/or components in question which is the soul purpose of the entity.

If you have any opinions or other ideas/solutions, I'd love to hear and I appreciate any help :)
4 Weeks Ago #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 202
Sounds too generic theoretical description of a question to me. It may get better if the OP can provide specific details along with appropriate examples.
4 Weeks Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.