Sign in to follow this  
DarkZoulz

Messaging and user input

Recommended Posts

Greetings, I am in the process of writing a game engine. I am using the component-based entity approach where each game entity contains a list of components that define the behavior of the entity, rather than using a inheritance hierarchy. I have a messaging system in place that allows the engine to pass messages to components that in turn can react to the changes. What i'm wondering about is if I should use this messaging system to pass simple user input events to the components. Like if the user moves the mouse or presses a key. The reason i'm having second thoughts about this is because it would probably hog alot of performance? or am I just paranoid? Maybe I should write a seperate system that allows components to just read user input when needed instead? Anyone how have created a similar engine or system and have experience from this?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
At the very least, you should implement some sort of intermediate layer between user input and object messages. What if you want game objects to send messages to other ones? What if the player wants to change the keys used to execute a certain action, what if more than one action should be triggered with a keypress, etc.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Don't worry about performance until profiling tells you too. Design your engine, build it and experiment. This engine will likely never be finished but you will learn a lot from it, making your next one that much better.

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