Talk:LGP Objects

From NexusCrossing

Jump to: navigation, search

[edit] Message Passing

I would like to implement a message passing system among objects.

The format for a message to be sent to an object should be something similar to:

RecievingObject.recieveMessage(ObjectID sender, MessageType type, string message);

lgp::World should have a method Wold.passMessage(ObjectID sender, ObjectID recipient, MessageType type, string message);

The values for sender and recipient should be fairly obvious as to their intent. ObjectID in this case is referring to an object ID which at this time is of type long int. It is not totally decided yet as to whether or not a typedef should be created for this, or if it is better to just leave it as long int.

MessageType will be an enumerated data type that will provide easy labels for types of messages. These could be things such as CHAT, STATUS, MOVE, COMBAT, DAMAGE, or just about anything else as the project grows. This identifier will help the receiving object decide what type of message it is getting ready to process.

It is within the realm of possibility that this may later become a string or similar in order to allow for greater flexibility; especially if we add the ability to define message handlers and message types at runtime. --Emry 06:40, 21 July 2010 (UTC)



Depending on the messages involved, much of the message processing will probably be processed using boost::tokenizer and boost::regex. Tuples may also be useful for such items as coordinates and the like. -- Emry 04:14, 23 July 2010 (UTC)

Personal tools