private void NotifyAllNodesSynched() { // Called from client the first time they complete their node synch MDLog.Trace(LOG_CAT, $"Peer [{Multiplayer.GetRpcSenderId()}] has completed node synchronization"); if (!PeerSynchInfo.ContainsKey(Multiplayer.GetRpcSenderId())) { PeerSynchInfo[Multiplayer.GetRpcSenderId()].CompletedNodeSynch = true; } }
private void ClientSynchStatus(int SynchedNodes) { // Synch in progress MDLog.Debug(LOG_CAT, $"Peer [{Multiplayer.GetRpcSenderId()}] has synched {SynchedNodes} out of {NodeList.Count} nodes"); // Send status update to all players so they can update UI UpdateSynchStatusOnAllClients(Multiplayer.GetRpcSenderId(), (float)SynchedNodes / NodeList.Count); // Update our own UI OnPlayerSynchStatusUpdateEvent(Multiplayer.GetRpcSenderId(), (float)SynchedNodes / NodeList.Count); }
public void NetRequestRespawn() { if (!Self.Multiplayer.IsNetworkServer()) { return; } if (DeathmatchMode) { ChooseSpawnPointAndDoSpawn(Multiplayer.GetRpcSenderId()); } }
private void ClientSynchDone() { // Great this client is done MDLog.Debug(LOG_CAT, $"Peer [{Multiplayer.GetRpcSenderId()}] completed synch"); if (PeerSynchInfo.ContainsKey(Multiplayer.GetRpcSenderId())) { PeerSynchInfo[Multiplayer.GetRpcSenderId()].CompletedSynch = true; } // Send status update to all players so they can update UI UpdateSynchStatusOnAllClients(Multiplayer.GetRpcSenderId(), 1f); // Update our own UI OnPlayerSynchStatusUpdateEvent(Multiplayer.GetRpcSenderId(), 1f); }
public void RegisterNickname(string ClientNick) { char[] NickArray = ClientNick.ToCharArray(); NickArray = Array.FindAll(NickArray, car => char.IsLetter(car) || car == '_'); ClientNick = new string(NickArray); if (ClientNick.Length == 0) { ((NetworkedMultiplayerENet)Multiplayer.NetworkPeer).DisconnectPeer(Multiplayer.GetRpcSenderId()); } string Identifier = $"{ClientNick}#{Multiplayer.GetRpcSenderId()}"; Nicknames.Add(Multiplayer.GetRpcSenderId(), Identifier); Log("Registered player ", Identifier); }
private void ClockedCall(uint Tick, ClockedRemoteCall.TypeOfCall Type, string NodePath, string Method, MDRemoteMode Mode, params object[] Parameters) { Node Target = GetNodeOrNull(NodePath); if (Target == null) { MDLog.Warn(LOG_CAT, $"Could not find target [{NodePath}] for ClockedRpcCall."); return; } MDLog.Trace(LOG_CAT, $"Got clocked call {Method} on {NodePath} with parameters ({MDStatics.GetParametersAsString(Parameters)})"); ClockedRemoteCall RemoteCall = new ClockedRemoteCall(Tick, Type, WeakRef(Target), Method, Mode, Multiplayer.GetRpcSenderId(), Parameters); // Check if we should already invoke this (if the time has already passed) if (!RemoteCall.Invoke(GameClock.GetRemoteTick())) { ClockedRemoteCallList.Add(RemoteCall); } }
public void NetDamage(int Damage) { Health -= Damage; CheckDie(Multiplayer.GetRpcSenderId()); }
private void ResponseTicksMsec(uint ClientTicksMsec, uint ServerTimeOfRequest, int RequestNumber) { MDLog.Debug(LOG_CAT, $"Msec response number {RequestNumber} from peer [{Multiplayer.GetRpcSenderId()}] is {ClientTicksMsec} local Msec is {OS.GetTicksMsec()}"); PeerSynchInfo[Multiplayer.GetRpcSenderId()].ProcessMSecResponse(ClientTicksMsec, ServerTimeOfRequest, RequestNumber); }
private void PingResponse(uint ServerTimeOfRequest) { int ping = (int)(OS.GetTicksMsec() - ServerTimeOfRequest); PeerSynchInfo[Multiplayer.GetRpcSenderId()].PushPlayerPingToQueue(ping); }
private void RequestPing(uint ServerTimeOfRequest) { // Respond RpcId(Multiplayer.GetRpcSenderId(), nameof(PingResponse), ServerTimeOfRequest); MDLog.Trace(LOG_CAT, "Responded to server request for ping"); }