Positronics
30-06-2006, 12:18 PM
I have been working on a raid loot distribution and DKP management mod for a while. Apparently the mod utilises the chat channel extensively for communication between the raid members and the loot master.
During the course of development, I turned out to have spent quite some time creating a reusable framework for synchronization through a single channel.
I thought that after all this time spent the framework become quite easy now to implement in virtually any new mods which require syncing through a channel. The mod dev can just define the sync command and create the handling function, without having to worry about the communication bit.
Features of this framework include:
- Basic XOR encryption of all string sent to prevent casual spoofing.
- Large string transmission (yes, it does transmit strings longer than the 255-char limit) This is done by automatic separation of the string into "chunks" of 245 characters, each chunk with an identification header.
- Unique key for each set of string. This is to verify integrity of data especially when the response is specified to a particular request, and also to verify that all data chunks are received before re-merging.
- Easy definition of new sync commands. This is simply a matter of mapping the command word of choice to the name of the function which handles the command. (eg. TblCommands["NEWCMD"]="HandlingFunction_1" will redirect all chat message with command "NEWCMD" to function "HandlingFunction_1" for processing, etc.)
http://ad-infinitum.net.nz/AdInfDKP/comm_demo1.jpg
As shown here, the addon transmits long string, encoded in hex XOR'd format. The header "nj4ma/1" sets the command's unique key to nj4ma and /1 tells the client that this is the first chunk, likewise "nj4ma/2" tells the addon that it's the second chunk. Notice the last chunk is indicated by a semicolon at its end. The addon reads through chunk#1 through to the number ending with semicolon of the same key to find any nil value (which means missing chunk, and it will request the missing one again), and if none it will combine them together and de-XOR into the original command. (Commands are input as table of parameters which is automatically parsed into one-line text)
I don't know whether anyone else has done something like this before or not, but if you guys think this will be useful in your development then I am willing to publish the communication bit alone for reuse (mainly because I think the hours I spent on the communication bit shouldn't be wasted entirely into my humble DKP mod). But if no one will use it then I won't bother, you guys say it.
During the course of development, I turned out to have spent quite some time creating a reusable framework for synchronization through a single channel.
I thought that after all this time spent the framework become quite easy now to implement in virtually any new mods which require syncing through a channel. The mod dev can just define the sync command and create the handling function, without having to worry about the communication bit.
Features of this framework include:
- Basic XOR encryption of all string sent to prevent casual spoofing.
- Large string transmission (yes, it does transmit strings longer than the 255-char limit) This is done by automatic separation of the string into "chunks" of 245 characters, each chunk with an identification header.
- Unique key for each set of string. This is to verify integrity of data especially when the response is specified to a particular request, and also to verify that all data chunks are received before re-merging.
- Easy definition of new sync commands. This is simply a matter of mapping the command word of choice to the name of the function which handles the command. (eg. TblCommands["NEWCMD"]="HandlingFunction_1" will redirect all chat message with command "NEWCMD" to function "HandlingFunction_1" for processing, etc.)
http://ad-infinitum.net.nz/AdInfDKP/comm_demo1.jpg
As shown here, the addon transmits long string, encoded in hex XOR'd format. The header "nj4ma/1" sets the command's unique key to nj4ma and /1 tells the client that this is the first chunk, likewise "nj4ma/2" tells the addon that it's the second chunk. Notice the last chunk is indicated by a semicolon at its end. The addon reads through chunk#1 through to the number ending with semicolon of the same key to find any nil value (which means missing chunk, and it will request the missing one again), and if none it will combine them together and de-XOR into the original command. (Commands are input as table of parameters which is automatically parsed into one-line text)
I don't know whether anyone else has done something like this before or not, but if you guys think this will be useful in your development then I am willing to publish the communication bit alone for reuse (mainly because I think the hours I spent on the communication bit shouldn't be wasted entirely into my humble DKP mod). But if no one will use it then I won't bother, you guys say it.