ChatBlade How To Documentation
How To Hook ChatBlade up to a Games Networking Code

Related ChatBlade Classes and functions:  
    CBChatSampleNetworkClient
    CBMFCTestClient
    CBChatHandler
    CBClientImplementation
    CBSampleChatServer.java

 
Summary:  
  Jump to section   Implement CBClientImplementation::SendChatMessage() to send a Chat Message to the games Chat Server via the games Networking code.  
  Jump to section Create a CBChatMessage instance for each Chat Message received over the wire.  
  Jump to section Call CBChatHandler::OnIncomingChatMessage() with the constructed CBChatMessage instances.   
Note:  ChatBlade ships with complete sample networking.  See CBMFCTestClient.cpp, CBChatSampleNetworkClient, and CBSampleImplementation.  It is recommended that all packets be encrypted and that Game Clients talk only with a Chat Server and not peer to peer in order to improve security.  
 

 
Details:  
 
Implement CBClientImplementation::SendChatMessage() to send a Chat Message to the games Chat Server via the games Networking code.  
     ChatBlade provides a stub CBClientImplementation::SendChatMessage() that Game Developers should implement to talk to the Games Networking code.  
ChatBlade invokes this function for each Chat Message which should be sent over the wire.  
Since each Licensee of ChatBlade may have differing Network back-ends, it is up to the Game Developer to implement this function to talk with their Network code.  
For security, it is recommended that all packets be encrypted and that Game Clients talk only to a Chat Server and never to each other via peer-to-peer.  
ChatBlade ships with sample Networking, not intended for production use.  See CBChatSampleNetworkClient.  
Sample Code:  
 
Create a CBChatMessage instance for each Chat Message received over the wire.  
     When the Game Client receives a Chat Message over the games Networking code, the Client should assemble a CBChatMessage instance out of the Network data.  
The CBChatMessage instance should have its tTimeStamp field stamped with the time the Chat Message was received.  
All other fields of the instance should be set, including, Source, Destination, Chat Channel, and the Text of the Chat Message.  
ChatBlade uses CBChatMessage instances to represent Chat Messages.  Network data needs to converted into such an instance in order for ChatBlade to process it efficiently.  
See CBChatSampleNetworkClient::ConvertNetworkStringToChatMessage() for an idea of how this might be done.  
Sample Code:  
 
Call CBChatHandler::OnIncomingChatMessage() with the constructed CBChatMessage instances.   
     Once a CBChatMessage instance has been created from the Network data, Game developers should pass that instance to ChatBlade for processing by invoking CBChatHandler::OnIncomingChatMessage() with the instance.  
ChatBlade checks that the Chat Message is not from an opposing faction, or someone on the Ignore list, then passes it to the appropriate CBTextWindowData instances that are Monitoring Chat Messages on the instances Chat Channel.  
Sample Code:  
 

 

Code Samples:  

Implementing CBClientImplementation::SendChatMessage().  
Implementation of this function shall depend on the Networking code specific to the Game.  
     //  For a sample implementation see CBChatSampleNetworkClient::SendChatMessage()
 
Creating a CBChatMessage instance out of the Network data.  
The code for this function shall be dependent on the how a Game formats the Network data.  
// For a sample implementation see CBChatSampleNetworkClient::ConvertNetworkStringToChatMessage()
    
 
Invoking CBChatHandler::OnIncomingChatMessage() with the CBChatMessage instances.  
     CBData::pChatHandler->OnIncomingChatMessage(cbChatMessage);
    
 
    
 
    

 

 

 

 

 

 
 
 
 
ChatBlade Copyright Flex Dolphynn