Esempio n. 1
0
        public SnapshotNetComponent(AOSClient client)
            : base(client)
        {
            snapshotSystem     = new SnapshotSystem(client);
            charSnapshotSystem = new CharacterSnapshotSystem(this, snapshotSystem);

            objectComponent = client.GetComponent <ObjectNetComponent>();
            objectComponent.OnCreatableInstantiated += ObjectComponent_OnCreatableInstantiated;
            objectComponent.OnCreatableDestroyed    += ObjectComponent_OnCreatableDestroyed;

            DashCMD.AddScreen(new DashCMDScreen("snapshot", "Displays information about the snapshot system.", true,
                                                (screen) =>
            {
                screen.WriteLine("Snapshot Round-Trip Time: {0}s", rtt);
                screen.WriteLine("Last Outbound Snapshot:", ConsoleColor.Cyan);
                screen.WriteLine("PacketHeader: {0} bytes", lastOutboundPacketStats.PacketHeader);
                screen.WriteLine("Acks: {0} bytes", lastOutboundPacketStats.Acks);
                screen.WriteLine("PlayerData: {0} bytes", lastOutboundPacketStats.PlayerData);
                screen.WriteLine("Total: {0} bytes", lastOutboundPacketStats.Total);
            })
            {
                SleepTime = 30
            });

            DashCMD.SetCVar("cl_tickrate", DEFAULT_TICKRATE);
            DashCMD.SetCVar("cl_await_sv_snap", false);

            //DashCMD.SetCVar("cl_tickrate", 25);
            //DashCMD.SetCVar("cl_await_sv_snap", true);

            syncTime = tickrate;
        }
        public override void Start()
        {
            if (AOSClient.Instance == null)
            {
                throw new InvalidOperationException("Cannot start networked gamemode, no net client has been created!");
            }

            Client          = AOSClient.Instance;
            NetChannel      = Client.GetChannel(AOSChannelType.Gamemode);
            objectComponent = Client.GetComponent <ObjectNetComponent>();

            base.Start();
        }
Esempio n. 3
0
        public MPWorld(MasterRenderer renderer)
            : base(renderer)
        {
            players      = new Dictionary <ushort, ClientPlayer>();
            physEntities = new Dictionary <ushort, GameObject>();
            TimeOfDay    = 10;

            // Grab network components and the world channel
            client            = AOSClient.Instance;
            snapshotComponent = client.GetComponent <SnapshotNetComponent>();
            objectComponent   = client.GetComponent <ObjectNetComponent>();
            channel           = client.GetChannel(AOSChannelType.World);

            // Add remotes
            channel.AddRemoteEvent("Client_ThrowGrenade", R_ThrowGrenade);
            channel.AddRemoteEvent("Client_ShootMelon", R_ShootMelon);
            channel.AddRemoteEvent("Client_ServerImpact", R_ServerImpact);
            channel.AddRemoteEvent("Client_RolledBackServerPlayer", R_RolledBackServerPlayer);

            // Hook into component events
            objectComponent.OnCreatableInstantiated  += ObjectComponent_OnCreatableInstantiated;
            objectComponent.OnCreatableDestroyed     += ObjectComponent_OnCreatableDestroyed;
            snapshotComponent.OnWorldSnapshotInbound += SnapshotComponent_OnWorldSnapshotInbound;
        }