500 users license
$700

Wednesday, January 30, 2008

Pig Latin?

ElectroServer's web admin interface makes it easy to set language filters, but what if we want all the public chat in a given room to be translated in some fashion?
  • Replace all words on a given list with a random string made of characters from "!@#$%^&*"
  • Expand each of the acronyms on a given list, so that "btw" becomes "by the way", etc.
  • Have a game where all chat is encrypted using a simple cipher, and an encrypted quotation is presented. First player to submit the correct decrypted quotation wins, with incorrect guesses appearing in encrypted form.
  • Have a silly room where everything anybody says is translated into Pig Latin. Eryvay illysay!
PluginPigLatin is an example extension added with ElectroServer 4.0.3. Here's how you can make your own custom translation plug-in. First, create a Java class that extends BasePlugin. Add a method to do the translation, such as String translate(String message).

Override a single method of BasePlugin:
   public ChainAction userSendPublicMessage(UserPublicMessageContext context) {
String message = context.getMessage();
String returnMessage = translate(message.trim());
context.setMessage(returnMessage);
return ChainAction.OkAndContinue;
}
Next edit (or create) the Extension.xml file to include your plugin. Copy the compiled class and new version of Extension.xml to the proper folders for ElectroServer, then reboot the server.

Finally, in the Flash client that allows the user to join a room where you want the translation plug-in to be used, add the new plug-in to the list of plug-ins for the room. Any PublicMessageRequest the user sends will be processed by userSendPublicMessage. Easy!

For more information, see the PluginPigLatin example, and the plug-in tutorial on our new wiki.

Labels: , , , ,

2 Comments:

Anonymous gamezekial said...

Great post! ElectroServer seems to be really flexible!

January 30, 2008 11:19 PM  
Anonymous Robert said...

Awesome, I didn't know this was possible. So in my MMOG where the avatars are Rap Stars and Gangsters, the chat could get translated so everyone says, "Foh-shizzle my nizzle!" Lol, this has so much potential.

January 31, 2008 3:53 AM  

Post a Comment

<< Home