Sign in to follow this  

Consoles and textbased event systems

This topic is 3661 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

In my game, Im thinking of having all gameplay related communication go via a message hub, in textbased form. This would allow the use of a traditional console. Also, levelloading could just execute a long list of commands to spawn enemies and entities. Keystrokes could be bound to commands to move the player for input etc. Now that you know what Im talking about; is this a good idea? The things that bother me is: * Having ALL communication go through the console isnt exactly OOP. Where do I draw the line of what goes through there? * Sending std::string 's around is performance intensive. Char* would be better, but not as good as direct function calls. Hows the performance on console communication? * How do the classes know of each other? By name? By id? If a class instance needs to speak to a certain other class instance, how do I retrieve the name/id? This is at least how I think it works when I see consoles in games. Or are they just representation of some enums passing around or whatnot? We also have the the issue of this kind of system is a hell to debug. Any hints? Deal or no deal on the console? Anyone have any nice articles on this issue?

Share this post


Link to post
Share on other sites
It sounds like a good idea to me. It will make automated testing trivial, for example. It will also easily enable replays, and recording of sessions for debugging, etc.

I would have anything that constitutes input go via the console. This includes network input (after being read and parsed), AI (after being decided), etc.

I don't think sending std::strings around will be performance intensive at all. They're hardly heavyweight objects, and a typical console system isn't sending thousands per second.

How do the classes know of each other? Well, I wouldn't use this on a class-to-class level, just for getting things done at a fairly high level, ie. inputs and controls of some nature.

Share this post


Link to post
Share on other sites

This topic is 3661 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.

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