private void StartSimulationOnConnectedPeers() { var writer = new Serializer(); //Create a new seed and send it with a start-message to all clients //The message also contains the respective player-id and the servers' frame rate var seed = new Random().Next(int.MinValue, int.MaxValue); foreach (var player in _playerIds) { writer.Reset(); writer.Put((byte)MessageTag.StartSimulation); new Init { Seed = seed, ActorID = player.Value, AllActors = _playerIds.Values.ToArray(), TargetFPS = TargetFps }.Serialize(writer); _server.Send(player.Key, Compressor.Compress(writer)); } }
protected override void OnReceiveMessage(IServer server, ISession session, object message) { // Console.WriteLine(message); server.Send($"hello {message}", session); }
protected override void OnReceiveMessage(IServer server, ISession session, object message) { ((Messages.Register)message).DateTime = DateTime.Now; server.Send(message, session); }