Converting User Modules from Ygdrasil 0.1.x to 0.4.x


The facility previously handled by ygNetKeys is now handled by ygNetMessages. The ygNetMessages class is very similiar to ygNetKeys except that keys can now be compound data types. By making a direct correlation between these compound data types and the messages given to each node, the ygNetMessages class can handle the parsing of messages. After parsing out the data and placing it into the compound data type for network delivery, the message() function is called. At this point, the node member variables already have the necessary values and the message function only needs to intiate any processing related to those messages. This new functionality of message() is similiar to that of acceptNetKey(). In fact, acceptNetKey() is no longer necessary because message() is called on the client node after the new compound data type has been received.


Nodes written for previous versions of Ygdrasil can be made to work with version 0.4.x by following a few simple steps. However, a more complete redevelopment would be required to generate nodes that take advantage of features such as saving to file, graph message viewing, and runtime event message argument access.

Step 1

Run the updateClasses program located in the tools directory on both your source code and header file. This shell script will change all instances of ygNetKeys.h, addNetKey, netKeyChanged, dontBroadcastNetKey, unreliableKey to the new function naming scheme.

Step 2

Move conditional code for each key from acceptNetKey() into the message() function. Change the name of any key names that are the same as message names. Make a single conditional that traps all remaining keys to prevent generating errors on client nodes:

void userNode::message(const ygMessage& msg)
    //load a filename
    if (msg == "file")
        filename_ = msg.argString(0);
    //process changed key
    else if (msg == "file_key")
    //trap keys that dont require processing
    else if (msg == "color_key" || msg == "alpha_key" || msg == "size_key")

Step 3

Delete the acceptNetKey method from the source code and header file.