-
Notifications
You must be signed in to change notification settings - Fork 1.1k
What are the roles of these servers in NF
Regarding Master Server, the plugin named NFMasterNet_ServerPlugin holding all Wolrd Server peers and Login Server peers. Besides, the plugin NFMasterNet_HttpServerPlugig provides the HTTP service to expand more features.
NFMasterNet_ServerModule::OnLoginRegisteredProcess
The Master called the OnLoginRegisteredProcess function when a Login Server registered to the Master Server
NFMasterNet_ServerModule::OnRefreshLoginInfoProcess
The Master called the OnRefreshLoginInfoProcess function when a Login Server reported the state to the Master Server
NFMasterNet_ServerModule::OnWorldRegisteredProcess
The Master called the OnWorldRegisteredProcess function when a World Server registered to the Master Server
NFMasterNet_ServerModule::OnRefreshWorldInfoProcess
The Master called the OnRefreshWorldInfoProcess function when a World Server reported the state to the Master Server
The plugin named NFLoginNet_ServerPlugin holding all client peers when the front-end first time connect to the back-end, once the front-end got the proxy information then disconnect from the Login Server.
NFLoginLogicModule::OnClientConnected
The Login Servers call the OnClientConnected operation once one client has connected to the Login Server.
NFLoginLogicModule::OnLoginProcess
The World Server holding all Game Server peers, DB Server peers and Proxy Server peers. Additionally, the World Server responses for reporting the Proxy-State and Game State to the Master Server. Besides, the World Server responses some business that cross Game Server (NFWorldLogicPlugin).
void OnGameServerRegisteredProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnGameServerUnRegisteredProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnRefreshGameServerInfoProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnDBServerRegisteredProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnDBServerUnRegisteredProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnRefreshDBServerInfoProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnProxyServerRegisteredProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnProxyServerUnRegisteredProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnRefreshProxyServerInfoProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
NFWorldToMasterModule::ServerReport
The World Servers call the function NFWorldToMasterModule::ServerReport to report the information about the workload to the Master Server per 10 Seconds.
void SynGameToProxy();
void SynGameToProxy(const NFSOCK nFD);
void SynWorldToProxy();
void SynWorldToProxy(const NFSOCK nFD);
void SynWorldToGame();
void SynWorldToGame(const NFSOCK nFD);
void SynWorldToDB();
void SynWorldToDB(const NFSOCK nFD);
void SynDBToGame();
void SynDBToGame(const NFSOCK nFD);
The World Servers call those functions when the Proxy Server, DB Server and Game Server connected to the World Server or disconnected, which to synchronize the information to all servers.
void OnProxyServerRegisteredProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnProxyServerUnRegisteredProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnRefreshProxyServerInfoProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
virtual void SendMsgPBToGate(const uint16_t nMsgID, google::protobuf::Message& xMsg, const NFGUID& self);
virtual void SendGroupMsgPBToGate(const uint16_t nMsgID, google::protobuf::Message& xMsg, const int nSceneID, const int nGroupID);
virtual void SendGroupMsgPBToGate(const uint16_t nMsgID, google::protobuf::Message& xMsg, const int nSceneID, const int nGroupID, const NFGUID exceptID);
virtual void SendMsgToGate(const uint16_t nMsgID, const std::string& strMsg, const NFGUID& self);
virtual void SendGroupMsgPBToGate(const uint16_t nMsgID, const std::string& strMsg, const int nSceneID, const int nGroupID);
virtual void SendGroupMsgPBToGate(const uint16_t nMsgID, const std::string& strMsg, const int nSceneID, const int nGroupID, const NFGUID exceptID);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_ENTER_GAME, this, &NFGameServerNet_ServerModule::OnClientEnterGameProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_LEAVE_GAME, this, &NFGameServerNet_ServerModule::OnClientLeaveGameProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_ROLE_LIST, this, &NFGameServerNet_ServerModule::OnReqRoleListProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_CREATE_ROLE, this, &NFGameServerNet_ServerModule::OnCreateRoleGameProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_DELETE_ROLE, this, &NFGameServerNet_ServerModule::OnDeleteRoleGameProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_SWAP_SCENE, this, &NFGameServerNet_ServerModule::OnClientSwapSceneProcess);
m_pNetModule->AddReceiveCallBack(NFMsg::EGMI_REQ_ENTER_GAME_FINISH, this, &NFGameServerNet_ServerModule::OnClientEnterGameFinishProcess);
The Game Servers call the ServerReport function when connected to the World Server, this function describes how the game servers report their current workload to the World Server.
NFGameServerToWorldModule::ServerReport()
NFAutoBroadcastModule
This module's job is to broadcast players' property and record to other players
NFSceneAutoBroadcastModule
This module's job is to broadcast the group's property and record to the player who in this group
void OnSocketClientEvent(const NFSOCK nSockIndex, const NF_NET_EVENT eEvent, NFINet* pNet);
void OnClientDisconnect(const NFSOCK nAddress);
void OnClientConnected(const NFSOCK nAddress);
void OnConnectKeyProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnReqServerListProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnSelectServerProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnReqRoleListProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnReqCreateRoleProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnReqDelRoleProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnReqEnterGameServer(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
//////////////////////////////////////////////////////////////////////////
void OnOtherMessage(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
NFProxyServerToWorldModule::ServerReport()
NFProxyServerToWorldModule::OnServerInfoProcess
When the Proxy connected to one World Server, that World Server will tell all the World Servers and Game Server to this Proxy, then this Proxy will try to connect those servers.
void OnClientDisconnect(const NFSOCK nAddress);
void OnClientConnected(const NFSOCK nAddress);
void OnRequireRoleListProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnCreateRoleGameProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnDeleteRoleGameProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnLoadRoleDataProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
void OnSaveRoleDataProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen);
NFDBToWorldModule::ServerReport
NFDBToWorldModule::AfterInit()
NFDBToWorldModule::Register(NFINet* pNet)
In terms of DB Server, if you want to debug and store the player's data, please running REDIS with pasword NoahGameFrame which like below:
requirepass "hello world"
NoSqlServer.xlsx