protected override void OnCreate() { mCommandBufferSystem = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); var firstQuery = new EntityQueryDesc() { None = new ComponentType[] { typeof(CSecondsToDeath), typeof(CTarget) }, All = new ComponentType[] { ComponentType.ReadWrite <CRandomizer>(), ComponentType.ReadOnly <STeam>(), ComponentType.ReadOnly <TBeeTag>() } }; var secondQuery = Utility.CopyEntityQueryDesc(firstQuery); mFirstTeamQuery = GetEntityQuery(firstQuery); mFirstTeamQuery.SetSharedComponentFilter(new STeam { Value = 0 }); mSecondTeamQuery = GetEntityQuery(secondQuery); mSecondTeamQuery.SetSharedComponentFilter(new STeam { Value = 1 }); }
protected override void OnCreate() { var reliabilityParams = new ReliableUtility.Parameters { WindowSize = 32 }; #if UNITY_EDITOR m_ClientPacketDelay = UnityEditor.EditorPrefs.GetInt("MultiplayerPlayMode_" + UnityEngine.Application.productName + "_ClientDelay"); m_ClientPacketDrop = UnityEditor.EditorPrefs.GetInt("MultiplayerPlayMode_" + UnityEngine.Application.productName + "_ClientDropRate"); int networkRate = 60; // TODO: read from some better place // All 3 packet types every frame stored for maximum delay, doubled for safety margin int maxPackets = 2 * (networkRate * 3 * m_ClientPacketDelay + 999) / 1000; var simulatorParams = new SimulatorUtility.Parameters { MaxPacketSize = NetworkParameterConstants.MTU, MaxPacketCount = maxPackets, PacketDelayMs = m_ClientPacketDelay, PacketDropPercentage = m_ClientPacketDrop }; m_Driver = new UdpNetworkDriver(simulatorParams, reliabilityParams); #else m_Driver = new UdpNetworkDriver(reliabilityParams); #endif m_ConcurrentDriver = m_Driver.ToConcurrent(); m_UnreliablePipeline = NetworkPipeline.Null; m_ReliablePipeline = NetworkPipeline.Null; m_DriverListening = false; m_Barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); numNetworkIds = new NativeArray <int>(1, Allocator.Persistent); freeNetworkIds = new NativeQueue <int>(Allocator.Persistent); rpcQueue = InternalRpcCollection.GetRpcQueue <RpcSetNetworkId>(); }
protected override void OnCreate() { base.OnCreate(); // Find the ECB system once and store it for later usage _commandBufferSystem = World .GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); }
protected override void OnCreate( ) { becb = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem> (); group_MMMamager = EntityManager.CreateEntityQuery ( ComponentType.ReadOnly <IsAliveTag> (), ComponentType.ReadOnly <NNManagerComponent> (), ComponentType.Exclude <NNMangerIsSpawningNewGenerationTag> () ); group_finishedPopulation = EntityManager.CreateEntityQuery ( ComponentType.ReadOnly <IsAliveTag> (), // ComponentType.ReadOnly <NNIsFinishedTag> (), ... ComponentType.ReadOnly <NNBrainTag> (), ComponentType.ReadOnly <NNIsFinishedTag> (), // ComponentType.ReadOnly <NNIsFinishedTag> (), ComponentType.Exclude <NNIsPreviousGenerationTag> (), ComponentType.Exclude <NNIsFirstGenerationTag> (), ComponentType.ReadWrite <NNManagerSharedComponent> () ); }
protected override void OnCreate() { m_Barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_PredictionGroup = World.GetOrCreateSystem <GhostPredictionSystemGroup>(); RequireSingletonForUpdate <LevelComponent>(); RequireSingletonForUpdate <GhostPrefabCollectionComponent>(); }
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member protected override void OnCreateManager() #pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { var reliabilityParams = new ReliableUtility.Parameters { WindowSize = 32 }; if (UnityEngine.Debug.isDebugBuild) { m_ClientPacketDelay = UnityEngine.PlayerPrefs.GetInt("MultiplayerPlayMode_" + UnityEngine.Application.productName + "_ClientDelay"); m_ClientPacketDrop = UnityEngine.PlayerPrefs.GetInt("MultiplayerPlayMode_" + UnityEngine.Application.productName + "_ClientDropRate"); int networkRate = 60; // TODO: read from some better place // All 3 packet types every frame stored for maximum delay, doubled for safety margin int maxPackets = 2 * (networkRate * 3 * m_ClientPacketDelay + 999) / 1000; var simulatorParams = new SimulatorUtility.Parameters { MaxPacketSize = NetworkParameterConstants.MTU, MaxPacketCount = maxPackets, PacketDelayMs = m_ClientPacketDelay, PacketDropPercentage = m_ClientPacketDrop }; m_Driver = new UdpNetworkDriver(simulatorParams, reliabilityParams); UnityEngine.Debug.Log("Using simulator with latency=" + m_ClientPacketDelay + " packet drop=" + m_ClientPacketDrop); } else { m_Driver = new UdpNetworkDriver(reliabilityParams); } m_ConcurrentDriver = m_Driver.ToConcurrent(); m_UnreliablePipeline = NetworkPipeline.Null; m_ReliablePipeline = NetworkPipeline.Null; m_DriverListening = false; m_Barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); numNetworkIds = new NativeArray <int>(1, Allocator.Persistent); freeNetworkIds = new NativeQueue <int>(Allocator.Persistent); rpcQueue = InternalRpcCollection.GetRpcQueue <RpcSetNetworkId>(); }
/// <summary> /// Need to call base.OnCreate() at start of the function. /// </summary> protected override void OnCreate() { beginInitializationBuffer = World.GetExistingSystem <BeginInitializationEntityCommandBufferSystem>(); beginSimulationBuffer = World.GetExistingSystem <BeginSimulationEntityCommandBufferSystem>(); endSimulationBuffer = World.GetExistingSystem <EndSimulationEntityCommandBufferSystem>(); beginPresentationBuffer = World.GetExistingSystem <BeginPresentationEntityCommandBufferSystem>(); }
protected override void OnCreate() { _barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); _mapQuery = GetEntityQuery( ComponentType.ReadOnly <GenerateMap>(), ComponentType.ReadOnly <MapData>(), ComponentType.ReadWrite <MapTiles>(), ComponentType.ReadWrite <MapRooms>() ); _playerQuery = GetEntityQuery( ComponentType.ReadOnly <Player>(), ComponentType.ReadWrite <Position>()); _monsterArchetype = EntityManager.CreateArchetype( ComponentType.ReadOnly <Monster>(), ComponentType.ReadWrite <Position>(), ComponentType.ReadWrite <Renderable>(), ComponentType.ReadWrite <Name>(), ComponentType.ReadOnly <TilesInView>(), ComponentType.ReadOnly <ViewRange>() ); RequireForUpdate(_mapQuery); }
protected override void OnCreate() { simBeginCBS = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); simEndCBS = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>(); qWithDeferEntityID = GetEntityQuery(ComponentType.ReadOnly <DeferEntityID>()); mFillCacheJob = new FillDeferEntityJob(); }
protected override void OnCreateManager() { m_Barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_RpcQueue = World.GetOrCreateSystem <MultiplayerSampleRpcSystem>().GetRpcQueue <RpcLoadLevel>(); m_LevelGroup = GetEntityQuery(ComponentType.ReadWrite <LevelComponent>()); RequireSingletonForUpdate <ServerSettings>(); }
protected override void OnCreate( ) { becb = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem> (); group_MMMamager = EntityManager.CreateEntityQuery ( ComponentType.ReadOnly <IsAliveTag> (), ComponentType.ReadOnly <NNMangerIsSpawningNewGenerationTag> () // ComponentType.ReadOnly <NNManagerComponent> () ); group_parentPopulation = EntityManager.CreateEntityQuery ( ComponentType.ReadOnly <IsAliveTag> (), // ComponentType.ReadOnly <NNIsFinishedTag> (), ... ComponentType.ReadOnly <NNBrainTag> (), ComponentType.ReadOnly <NNIsPreviousGenerationTag> (), ComponentType.ReadOnly <NNManagerSharedComponent> () ); group_offspringPopulation = EntityManager.CreateEntityQuery ( ComponentType.ReadOnly <IsSpawningTag> (), ComponentType.ReadOnly <NNBrainTag> (), ComponentType.ReadOnly <NNManagerSharedComponent> () ); l_managerSharedData = new List <NNManagerSharedComponent> (1000); }
protected override void OnCreate() { RequireSingletonForUpdate <GhostSpawnQueueComponent>(); RequireSingletonForUpdate <PredictedGhostSpawnList>(); _barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); }
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_GhostCollectionSystem = World.GetOrCreateSystem <GhostCollectionSystem>(); m_ghostEntityMap = new NativeHashMap <int, Entity>(2048, Allocator.Persistent); m_spawnedGhostEntityMap = new NativeHashMap <SpawnedGhost, Entity>(2048, Allocator.Persistent); playerGroup = GetEntityQuery( ComponentType.ReadWrite <NetworkStreamConnection>(), ComponentType.ReadOnly <NetworkStreamInGame>(), ComponentType.Exclude <NetworkStreamDisconnected>()); ghostCleanupGroup = GetEntityQuery(ComponentType.ReadOnly <GhostComponent>(), ComponentType.Exclude <PreSpawnedGhostId>()); clearJobGroup = GetEntityQuery(ComponentType.ReadOnly <GhostComponent>(), ComponentType.Exclude <PreSpawnedGhostId>()); m_Barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_CompressionModel = new NetworkCompressionModel(Allocator.Persistent); #if UNITY_EDITOR || DEVELOPMENT_BUILD m_StatsCollection = World.GetOrCreateSystem <GhostStatsCollectionSystem>(); #endif m_GhostDespawnSystem = World.GetOrCreateSystem <GhostDespawnSystem>(); RequireSingletonForUpdate <GhostPrefabCollectionComponent>(); m_ReceivedGhostVersion = new NativeArray <ulong>(1, Allocator.Persistent); m_GhostCompletionCount = new NativeArray <int>(2, Allocator.Persistent); }
protected override void OnCreate() { ecbSystem = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); EntityManager em = ecbSystem.EntityManager; blockPrefab = new Entity[10]; for (short i = 0; i < 10; ++i) { var prefab = em.CreateEntity(); em.AddSharedComponentData(prefab, new RenderMesh { mesh = GetCubeMesh(), material = GetCubeMaterial(i) }); em.AddComponentData(prefab, new Rotation { Value = Quaternion.identity }); em.AddComponentData(prefab, new LocalToWorld()); em.AddComponentData(prefab, new BlockTagComponent()); em.AddComponentData(prefab, new Translation { Value = float3.zero }); blockPrefab[i] = prefab; } }
protected override void OnCreate() { RequireSingletonForUpdate <EnableLagCompensationGame>(); RequireSingletonForUpdate <LagCompensationSpawner>(); RequireForUpdate(GetEntityQuery(ComponentType.ReadOnly <NetworkIdComponent>(), ComponentType.Exclude <NetworkStreamInGame>())); m_Barrier = World.GetExistingSystem <BeginSimulationEntityCommandBufferSystem>(); }
protected override void OnCreate() { m_Barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); RequireSingletonForUpdate <LevelComponent>(); RequireForUpdate(GetEntityQuery(typeof(UpdateChunkTag), typeof(ChunkComponent))); }
private void Start() { if (spawnAtEcs) { commandBufferSystem = World.DefaultGameObjectInjectionWorld .GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); var entityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(ecsPrefab, new GameObjectConversionSettings(World.DefaultGameObjectInjectionWorld, GameObjectConversionUtility.ConversionFlags.SceneViewLiveLink, new BlobAssetStore())); var jobHandle = new MyEcsSpawnJob() { CommandBuffer = commandBufferSystem.CreateCommandBuffer(), NumberOfCubes = numberOfCubes, EcsPrefab = entityPrefab, MyRandom = new Random((uint)UnityEngine.Random.Range(1, 100000)) }.Schedule(); commandBufferSystem.AddJobHandleForProducer(jobHandle); } else { for (var i = 0; i < numberOfCubes; i++) { Instantiate(monoPrefab).transform.position = new Vector3(UnityEngine.Random.Range(-100, 100f), 0, 0); } } }
protected override void OnCreate() { m_beginBarrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_NetworkReceiveSystemGroup = World.GetOrCreateSystem <NetworkReceiveSystemGroup>(); m_NetworkTimeSystem = World.GetOrCreateSystem <NetworkTimeSystem>(); m_fixedUpdateMarker = new ProfilerMarker("ClientFixedUpdate"); }
protected override void OnCreate( ) { becb = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem> (); buildPhysicsWorld = World.GetOrCreateSystem <BuildPhysicsWorld> (); group_pathPlanners = EntityManager.CreateEntityQuery ( ComponentType.ReadOnly <IsAliveTag> (), ComponentType.Exclude <CanFindPathTag> (), ComponentType.ReadWrite <PathPlannerComponent> () ); EntityArchetype entityArchetype = EntityManager.CreateArchetype ( typeof(IsAliveTag), typeof(PathPlannerComponent), typeof(PathNodesBuffer), typeof(Prefab) ); // Example { Entity pathPlannerPrefabEntity = EntityManager.CreateEntity(entityArchetype); EntityManager.SetName(pathPlannerPrefabEntity, "PathPlannar"); NativeArray <Entity> na_pathPLannerEntities = EntityManager.Instantiate(pathPlannerPrefabEntity, 100, Allocator.Temp); na_pathPLannerEntities.Dispose(); EntityManager.SetName(pathPlannerPrefabEntity, "PathPlannarPrefab"); } }
protected override void OnCreate() { m_Barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_LevelGroup = GetEntityQuery(ComponentType.ReadWrite <LevelComponent>()); RequireForUpdate(m_LevelGroup); RequireSingletonForUpdate <GhostPrefabCollectionComponent>(); }
protected override void OnCreate() { m_CommandBuffer = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_RpcSettingsQueue = World.GetOrCreateSystem <RpcSystem>().GetRpcQueue <RpcPlayerSetup>(); m_RpcRemoteCmdQueue = World.GetOrCreateSystem <RpcSystem>().GetRpcQueue <RpcRemoteCommand>(); m_ConnectionQuery = GetEntityQuery(ComponentType.ReadOnly <NetworkStreamConnection>()); }
protected override void OnCreate() { base.OnCreate(); m_EndSimulationEcbSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>(); m_BeginSimulationBufferSystem = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); /* World.CreateSystem<EntityCommandBuffer>(new EntityCommandBuffer());*/ _entityHerosArchetype = EntityManager.CreateArchetype( typeof(Translation), typeof(HashRegion), typeof(MoveStats), typeof(AbilityStats), typeof(AbilityCouldownStats), typeof(AbilityCouldownPerform), typeof(MovePerformForColliderJob), typeof(AbilityPerform), typeof(SouffleDeFeuColliderForJob), typeof(SouffleDeFeuStats), typeof(ColliderSphere), typeof(HerosArchetype), typeof(DamageCount), typeof(HealthPoint)); //_query = GetEntityQuery(typeof(LocalToWorld), typeof(Spawner_FromEntity)); _query = GetEntityQuery(typeof(SouffleDeFeuTemp), typeof(HashRegion)); _heroesQuery = EntityManager.CreateEntityQuery(typeof(MoveStats)); //var ah = Resources.Load<GameObject>("Heros").GetComponent<MoveStats>(); }
protected override void OnCreate() { base.OnCreate(); _monsterPrefabsQuery = GetEntityQuery( ComponentType.ReadOnly <Prefab>(), ComponentType.ReadOnly <Monster>() ); _monstersQuery = GetEntityQuery( ComponentType.ReadOnly <Monster>() ); _changeMonsterCountQuery = GetEntityQuery( ComponentType.ReadOnly <ChangeMonsterCount>() ); _mapQuery = GetEntityQuery( ComponentType.ReadWrite <MapState>(), ComponentType.ReadOnly <MapData>() ); _barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); RequireForUpdate(_changeMonsterCountQuery); }
protected override void OnCreateManager() { m_DataStream = new DataStreamWriter(2048, Allocator.Persistent); ghostGroup = GetComponentGroup(typeof(GhostComponent), typeof(GhostSystemStateComponent)); var filterSpawn = new EntityArchetypeQuery { All = new ComponentType[] { typeof(GhostComponent) }, None = new ComponentType[] { typeof(GhostSystemStateComponent) } }; var filterDespawn = new EntityArchetypeQuery { All = new ComponentType[] { typeof(GhostSystemStateComponent) }, None = new ComponentType[] { typeof(GhostComponent) } }; ghostSpawnGroup = GetComponentGroup(filterSpawn); ghostDespawnGroup = GetComponentGroup(filterDespawn); m_FreeGhostIds = new NativeQueue <int>(Allocator.Persistent); m_AllocatedGhostIds = new NativeArray <int>(1, Allocator.Persistent); m_AllocatedGhostIds[0] = 1; // To make sure 0 is invalid connectionGroup = GetComponentGroup( ComponentType.ReadWrite <NetworkStreamConnection>(), ComponentType.ReadOnly <PlayerStateComponentData>()); m_ServerSimulation = World.GetExistingManager <ServerSimulationSystemGroup>(); m_Barrier = World.GetOrCreateManager <BeginSimulationEntityCommandBufferSystem>(); m_ConnectionStates = new List <ConnectionStateData>(256); m_ConnectionStateLookup = new NativeHashMap <Entity, int>(256, Allocator.Persistent); m_CompressionModel = new NetworkCompressionModel(Allocator.Persistent); m_SerialSpawnChunks = new NativeList <PrioChunk>(1024, Allocator.Persistent); }
protected override void OnCreateManager() { barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); bulletSpawnArchetype = EntityManager.CreateArchetype( ComponentType.ReadWrite <PredictedSpawnRequestComponent>(), ComponentType.ReadWrite <BulletSnapshotData>()); lastPredictedSpawn = new NativeArray <uint>(1, Allocator.Persistent); }
protected override void OnCreate() { base.OnCreate(); m_DestroyGroup = GetEntityQuery(ComponentType.ReadWrite <GhostShipState>(), ComponentType.Exclude <ShipSnapshotData>()); m_Barrier = World.GetExistingSystem <BeginSimulationEntityCommandBufferSystem>(); }
protected override void OnCreate() { m_EntityCommandBuffer = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_Query = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { ComponentType.ReadOnly <Prefab>(), ComponentType.ReadOnly <C_ItemData>(), }, }); }
protected override void OnCreate() { m_BeginSimEcb = World.GetExistingSystem <BeginSimulationEntityCommandBufferSystem>(); //We need to make sure we have NCE before we start the update loop (otherwise it's unnecessary) RequireSingletonForUpdate <NetworkIdComponent>(); RequireSingletonForUpdate <CameraAuthoringComponent>(); }
protected override void OnCreate() { m_EntityCommandBuffer = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_Query = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { typeof(Translation), typeof(TC_Pickable) }, }); }