protected override void OnCreate() { m_NewGhosts = new NativeList <T>(16, Allocator.Persistent); m_NewGhostIds = new NativeList <int>(16, Allocator.Persistent); m_InitialArchetype = EntityManager.CreateArchetype(ComponentType.ReadWrite <T>(), ComponentType.ReadWrite <GhostComponent>()); m_GhostUpdateSystemGroup = World.GetOrCreateSystem <GhostUpdateSystemGroup>(); m_GhostMap = m_GhostUpdateSystemGroup.GhostEntityMap; m_ConcurrentGhostMap = m_GhostMap.AsParallelWriter(); m_DestroyGroup = GetEntityQuery(ComponentType.ReadOnly <T>(), ComponentType.Exclude <GhostComponent>(), ComponentType.Exclude <PredictedGhostSpawnRequestComponent>()); m_SpawnRequestGroup = GetEntityQuery(ComponentType.ReadOnly <T>(), ComponentType.ReadOnly <PredictedGhostSpawnRequestComponent>()); m_PlayerGroup = GetEntityQuery(ComponentType.ReadOnly <NetworkStreamConnection>(), ComponentType.ReadOnly <NetworkIdComponent>(), ComponentType.Exclude <NetworkStreamDisconnected>()); m_InvalidGhosts = new NativeList <Entity>(1024, Allocator.Persistent); m_DelayedSpawnQueue = new NativeQueue <DelayedSpawnGhost>(Allocator.Persistent); m_CurrentDelayedSpawnList = new NativeList <DelayedSpawnGhost>(1024, Allocator.Persistent); m_ConcurrentDelayedSpawnQueue = m_DelayedSpawnQueue.AsParallelWriter(); m_PredictedSpawnQueue = new NativeQueue <DelayedSpawnGhost>(Allocator.Persistent); m_CurrentPredictedSpawnList = new NativeList <DelayedSpawnGhost>(1024, Allocator.Persistent); m_ConcurrentPredictedSpawnQueue = m_PredictedSpawnQueue.AsParallelWriter(); m_Barrier = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>(); m_PredictSpawnGhosts = new NativeList <PredictSpawnGhost>(16, Allocator.Persistent); m_PredictionSpawnCleanupMap = new NativeHashMap <int, int>(16, Allocator.Persistent); m_ClientSimulationSystemGroup = World.GetOrCreateSystem <ClientSimulationSystemGroup>(); }
protected override void OnCreate() { m_GhostCollectionSystem = World.GetOrCreateSystem <GhostCollectionSystem>(); m_DelayedSpawnQueue = new NativeQueue <DelayedSpawnGhost>(Allocator.Persistent); m_ClientSimulationSystemGroup = World.GetExistingSystem <ClientSimulationSystemGroup>(); m_GhostReceiveSystem = World.GetOrCreateSystem <GhostReceiveSystem>(); }
protected override void OnCreate() { m_Barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_ClientSimulationSystemGroup = World.GetOrCreateSystem <ClientSimulationSystemGroup>(); m_interpolatedDespawnQueue = new NativeQueue <DelayedDespawnGhost>(Allocator.Persistent); m_predictedDespawnQueue = new NativeQueue <DelayedDespawnGhost>(Allocator.Persistent); }
protected override void OnCreate() { m_GhostPredictionSystemGroup = World.GetExistingSystem <GhostPredictionSystemGroup>(); m_ClientSimulationSystemGroup = World.GetExistingSystem <ClientSimulationSystemGroup>(); PredictionState = new NativeHashMap <ArchetypeChunk, System.IntPtr>(128, Allocator.Persistent); m_StillUsedPredictionState = new NativeHashMap <ArchetypeChunk, int>(128, Allocator.Persistent); m_NewPredictionState = new NativeQueue <PredictionStateEntry>(Allocator.Persistent); m_PredictionQuery = GetEntityQuery(ComponentType.ReadOnly <PredictedGhostComponent>(), ComponentType.ReadOnly <GhostComponent>()); m_GhostCollectionSystem = World.GetOrCreateSystem <GhostCollectionSystem>(); m_ChildEntityLookup = new NativeHashMap <Entity, EntityChunkLookup>(1024, Allocator.Persistent); m_ChildEntityQuery = GetEntityQuery(ComponentType.ReadOnly <GhostChildEntityComponent>()); }
protected override void OnCreate() { var ent = EntityManager.CreateEntity(); EntityManager.AddComponentData(ent, default(PredictedGhostSpawnList)); EntityManager.AddBuffer <PredictedGhostSpawn>(ent); RequireSingletonForUpdate <PredictedGhostSpawnList>(); m_BeginSimulationBarrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_GhostInitQuery = GetEntityQuery(ComponentType.ReadOnly <PredictedGhostSpawnRequestComponent>(), ComponentType.ReadOnly <GhostTypeComponent>(), ComponentType.ReadWrite <GhostComponent>()); m_ClientSimulationSystemGroup = World.GetExistingSystem <ClientSimulationSystemGroup>(); m_ChildEntityLookup = new NativeHashMap <Entity, EntityChunkLookup>(1024, Allocator.Persistent); m_ChildEntityQuery = GetEntityQuery(ComponentType.ReadOnly <GhostChildEntityComponent>()); }
protected override void OnCreate() { base.OnCreate(); m_IncomingDataQuery = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { typeof(CommandTargetComponent), typeof(NetworkStreamInGame) }, None = new ComponentType[] { typeof(NetworkStreamDisconnected), typeof(NetworkStreamRequestDisconnect) } }); m_CommandCollectionSystem = World.GetOrCreateSystem <CommandCollectionSystem>(); m_ReceiveSystem = World.GetOrCreateSystem <NetworkStreamReceiveSystem>(); m_ClientSimulationSystemGroup = World.GetOrCreateSystem <ClientSimulationSystemGroup>(); m_NetworkCompressionModel = new NetworkCompressionModel(Allocator.Persistent); }
protected override void OnCreate() { m_StatIndex = -1; m_ServerSimulationSystemGroup = World.GetExistingSystem <ServerSimulationSystemGroup>(); m_ClientSimulationSystemGroup = World.GetExistingSystem <ClientSimulationSystemGroup>(); if (m_ClientSimulationSystemGroup != null) { m_NetworkTimeSystem = World.GetOrCreateSystem <NetworkTimeSystem>(); } m_SnapshotStats = new NativeArray <uint>(0, Allocator.Persistent); m_SnapshotTicks = new NativeList <uint>(16, Allocator.Persistent); m_TimeSamples = new NativeList <TimeSample>(16, Allocator.Persistent); m_CommandTicks = new NativeList <uint>(16, Allocator.Persistent); m_PacketQueue = new List <Packet>(); m_PacketPool = new List <byte[]>(); }
protected override void OnCreate() { #if UNITY_EDITOR || DEVELOPMENT_BUILD m_GhostStatsCollectionSystem = World.GetOrCreateSystem <GhostStatsCollectionSystem>(); m_NetStats = new NativeArray <uint>(2, Allocator.Persistent); #endif m_ReceiveSystem = World.GetOrCreateSystem <NetworkStreamReceiveSystem>(); m_ClientSimulationSystemGroup = World.GetOrCreateSystem <ClientSimulationSystemGroup>(); m_CompressionModel = new NetworkCompressionModel(Allocator.Persistent); RequireForUpdate(EntityManager.CreateEntityQuery( ComponentType.ReadOnly <NetworkStreamInGame>(), ComponentType.ReadOnly <NetworkStreamConnection>(), ComponentType.ReadOnly <NetworkSnapshotAckComponent>(), ComponentType.ReadOnly <CommandTargetComponent>(), ComponentType.Exclude <NetworkStreamDisconnected>())); if (typeof(TCommandData) != typeof(NullCommandData)) { RequireForUpdate(EntityManager.CreateEntityQuery(ComponentType.ReadOnly <TCommandData>())); } }