#include <NetworkModule.h>
Public Member Functions | |
void | onConnectionEstablished () |
The method is triggered on both server and client when a connection establishes. | |
void | onConnectionTerminated (TNL::NetConnection::TerminationReason reason, const char *rejectionString) |
The method is triggered on both server and client when the connection is terminated. | |
TNL_DECLARE_RPC (s2cDisconnectClient,(unsigned charID)) | |
server broadcast information about a disconnect client using charID | |
TNL_DECLARE_RPC (c2sAddNewClient,(unsigned charID)) | |
client notifies connection to server. request to create new character | |
TNL_DECLARE_RPC (s2cAddNewClient,(unsigned charID, double x, double y, double z, double dirX, double dirY, double dirZ)) | |
server broadcast data information about new client | |
TNL_DECLARE_RPC (c2smakeMovement,(unsigned charID, double x, double y, double z, double dirX, double dirY, double dirZ)) | |
client movement notify to server | |
TNL_DECLARE_RPC (s2cmakeMovement,(unsigned charID, double x, double y, double z, double dirX, double dirY, double dirZ)) | |
server client movement broadcast method | |
TNL_DECLARE_RPC (c2sVoice,(unsigned charID, ByteBufferPtr voiceBuffer, bool echo)) | |
client voice buffer sending method to server | |
TNL_DECLARE_RPC (s2cVoice,(unsigned charID, ByteBufferPtr voiceBuffer)) | |
server broadcasting client voice | |
TNL_DECLARE_RPC (c2sFiremanInteractFire,(unsigned charID, StringPtr objName)) | |
client fireman-fire interaction notify method | |
TNL_DECLARE_RPC (s2cFiremanInteractFire,(unsigned charID, StringPtr objName)) | |
server fireman-fire interaction broadcast method | |
TNL_DECLARE_RPC (c2sMedicInteractPassenger,(unsigned charID, StringPtr objName)) | |
client medic-passenger interaction notify method | |
TNL_DECLARE_RPC (s2cMedicInteractPassenger,(unsigned charID, StringPtr objName)) | |
server medic-passenger interaction broadcast method | |
TNL_DECLARE_RPC (c2ssetCharacterState,(unsigned charID, StringPtr stateName)) | |
client character animation state change notify method | |
TNL_DECLARE_RPC (s2csetCharacterState,(unsigned charID, StringPtr stateName)) | |
server character animation state change broadcast method | |
TNL_DECLARE_RPC (c2smoveNPCtoDest,(unsigned charID, StringPtr objName, double x, double y, double z)) | |
client npc move to destination point request method | |
TNL_DECLARE_RPC (s2cmoveNPCtoDest,(unsigned charID, StringPtr objName, double x, double y, double z)) | |
server npc move to destination point broadcast method | |
TNL_DECLARE_RPC (c2srequestNPCtoFollow,(unsigned charID, StringPtr objName)) | |
client npc to follow object notift method | |
TNL_DECLARE_RPC (s2crequestNPCtoFollow,(unsigned charID, StringPtr objName)) | |
server npc to follow object broadcast method | |
TNL_DECLARE_RPC (c2srequestNPCtoStopFollow,(unsigned charID, StringPtr objName)) | |
client npc to stop following object notify method | |
TNL_DECLARE_RPC (s2crequestNPCtoStopFollow,(unsigned charID, StringPtr objName)) | |
server npc to stop following object broadcast method | |
TNL_DECLARE_RPC (s2cstartSimulation,()) | |
server start simulation broadcast method | |
TNL_DECLARE_RPC (s2crenderRatingMenu,()) | |
server finish simulation and render rating menu broadcast method | |
TNL_DECLARE_RPC (s2cAddResource,(int id, int amount)) | |
server add resource broadcast method | |
TNL_DECLARE_RPC (s2cAddPassenger,(double x, double y, double z)) | |
server create passenger on given position broadcast method | |
TNL_DECLARE_RPC (s2cCreateFire,(double x, double y, double z, double scale)) | |
server create fire on given position with give factor broadcast method | |
TNL_DECLARE_RPC (s2csendLastScores,(double captainTScore, double medicTScore, double firemanTScore)) | |
server broadcast lastest scores broadcast method | |
TNL_DECLARE_RPC (c2ssendScore,(unsigned charID, double captainScore, double medicScore, double firemanScore)) | |
client send rating menu scores to server method | |
TNL_DECLARE_RPC (c2screwInteraction,(unsigned charID, StringPtr npcName)) | |
client notify crew interaction on given npc name | |
TNL_DECLARE_RPC (s2ccrewInteraction,(unsigned charID, StringPtr npcName)) | |
server broadcast crew interaction on given npc name |
Developed using openTNL library. Uses RPC methods of TNL to provide communication between clients and server. Inherits voice and codec objects for voice communication The class inherits the EventConnection class of TNL library.
void NetworkModule::onConnectionEstablished | ( | ) |
The method is triggered on both server and client when a connection establishes.
The method sets the connection parameters and client information when the client connects. Yet this method is empty and its job is done using another method that a client notifies its new connection.
void NetworkModule::onConnectionTerminated | ( | TNL::NetConnection::TerminationReason | reason, | |
const char * | rejectionString | |||
) |
The method is triggered on both server and client when the connection is terminated.
reason | The enumerated reason of TNL library about the termination. | |
rejectionString | The rejection message provided by TNL. |