Jump to content
  • Advertisement
Sign in to follow this  
tstrimp

Generic Message System.

This topic is 4491 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 order to get my engine to integrate a scripting language well I'm trying to develop a generic message system that all kernel tasks can pass and receive. The issue I'm running into is how to identify messages. I'd rather not use integers and defines because I would like to be able to add and use custom messages strictly from the scripting side. Also, messages are going to need a type because tasks should be able to subscribe to specific messages along with a type of message. The last thing I need to support is the ability to allow certain tasks to hijack the message queue so I can do things like get text input instead of calling events. Are there any good articles on messaging systems and how they relate to a micro-kernel task system? Does anyone have any ideas/suggestions reguarding the messaging system? I should mention, I would also like this to be the primary form of communication between system tasks. Thanks for reading! Tim.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by tstrimp


Are there any good articles on messaging systems and how they relate to a micro-kernel task system? Does anyone have any ideas/suggestions reguarding the messaging system? I should mention, I would also like this to be the primary form of communication between system tasks.



I'd be interested too.

Quote:

I'd rather not use integers and defines because I would like to be able to add and use custom messages strictly from the scripting side.


I'm using strings for my game. You can cut, trim and bake them as you wish.

Share this post


Link to post
Share on other sites
I'm using strings for task names currently but if I get messages working between tasks then I should be able to remove them because they will not need to be accessed by name, just alerted to new messages that they have subscribed to.

Share this post


Link to post
Share on other sites
Easy speed+memory optimization:

use 32-bit ID:s for the message type. The ID:s are actually a hash-value you calculate from a string. This is may be the best of two worlds.

unsigned long exampleMessageType = Calc32BitHashFromString("RenderTextureMessageType");
SendMessage(exampleMessageType);


/Marcus

Share this post


Link to post
Share on other sites
Quote:
Original post by _swx_
So how do you deal with collisions?
The easiest way would be to assert() if you get a collision, and just rename the message so it doesn't collide. That's what we did for State of Emergency 2 (Except it was for map identifiers, not messages).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Take a look at the event-system in Mr Mike's sources from game coding complete

http://www.mcshaffry.com/GameCode/

Share this post


Link to post
Share on other sites
Quote:
Original post by marcusz
Easy speed+memory optimization:

use 32-bit ID:s for the message type. The ID:s are actually a hash-value you calculate from a string. This is may be the best of two worlds.


Oooo, I'll stash that one away for later. Thanks!

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!