Code Monkey home page Code Monkey logo

ecs.example's People

Contributors

chromealex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

echeg

ecs.example's Issues

Doesn't work with the modern version of the ECS

The example doesen't work with the modern version of the ECS and deps.

If you clone it, init and update the submodule and install all the dependencies, there are some compilation errors where either some classes or methods are missing or some more subtle ones.

Tried on the latest LTS which is 2022.3.1f1 as of the date of writing this.

It would be great if the example could be updated to work.

Errors after update to current version ecs

If you update ecs to the current version, then several errors will appear:

ArgumentException: Seed must be non-zero
Unity.Mathematics.Random.CheckInitState () (at Library/PackageCache/[email protected]/Unity.Mathematics/random.cs:573)
Unity.Mathematics.Random..ctor (System.UInt32 seed) (at Library/PackageCache/[email protected]/Unity.Mathematics/random.cs:26)
ME.ECS.RandomUtils.GetRandomValue (System.UInt32& randomState) (at Assets/Plugins/ecs/ECS/Core/Utils/RandomUtils.cs:97)
ME.ECS.World.GetRandomValue () (at Assets/Plugins/ecs/ECS/Core/World/World.cs:696)
ME.ECS.World.RunTick (ME.ECS.Tick tick, System.Single fixedDeltaTime) (at Assets/Plugins/ecs/ECS/Core/World/World.cs:2591)
ME.ECS.World.Simulate (ME.ECS.Tick from, ME.ECS.Tick to) (at Assets/Plugins/ecs/ECS/Core/World/World.cs:3005)
ME.ECS.World.UpdateLogic (System.Single deltaTime) (at Assets/Plugins/ecs/ECS/Core/World/World.cs:1946)
ME.ECS.World.Update (System.Single deltaTime) (at Assets/Plugins/ecs/ECS/Core/World/World.cs:2295)
Example.ExampleInitializer.Update () (at Assets/Example/Generator/ExampleInitializer.cs:55)

and 

InStateException: [ME.ECS] Could not perform action because current step is in state (ModulesLogicTick, SystemsVisualTick).
ME.ECS.InStateException.ThrowWorldStateCheck () (at Assets/Plugins/ecs/ECS/Core/Exceptions.cs:84)
ME.ECS.Network.NetworkModule`1[TState].CallRPC (System.Object instance, ME.ECS.RPCId rpcId, System.Boolean storeInHistory, System.Object[] parameters) (at Assets/Plugins/ecs/ECS/Modules/NetworkModule/NetworkModule.cs:437)
ME.ECS.Network.NetworkModule`1[TState].SystemRPC (System.Object instance, ME.ECS.RPCId rpcId, System.Object[] parameters) (at Assets/Plugins/ecs/ECS/Modules/NetworkModule/NetworkModule.cs:853)
ME.ECS.Network.NetworkModule`1[TState].SendPing (System.Single deltaTime) (at Assets/Plugins/ecs/ECS/Modules/NetworkModule/NetworkModule.cs:654)
ME.ECS.Network.NetworkModule`1[TState].UpdatePost (System.Single& deltaTime) (at Assets/Plugins/ecs/ECS/Modules/NetworkModule/NetworkModule.cs:799)
ME.ECS.World.UpdateVisualPost (System.Single deltaTime) (at Assets/Plugins/ecs/ECS/Core/World/World.cs:2131)
ME.ECS.World.LateUpdate (System.Single deltaTime) (at Assets/Plugins/ecs/ECS/Core/World/World.cs:2302)
Example.ExampleInitializer.LateUpdate () (at Assets/Example/Generator/ExampleInitializer.cs:63)

This error will spam until there is a connection to the room.

OnJoinedRoom. IsMaster: False
Seed: 42822139
Set active player: 2

After connect second user we have second error:

EmptyEntityException: [ME.ECS] You are trying to change empty entity.
ME.ECS.EmptyEntityException.Throw () (at Assets/Plugins/ecs/ECS/Core/Exceptions.cs:64)
ME.ECS.EmptyEntityException.Throw (ME.ECS.Entity entity) (at Assets/Plugins/ecs/ECS/Core/Exceptions.cs:70)
ME.ECS.World.SetData[TComponent] (ME.ECS.Entity& entity, TComponent& data, ME.ECS.ComponentLifetime lifetime) (at Assets/Plugins/ecs/ECS/Core/WorldStructComponents.cs:2670)
ME.ECS.EntityExtensionsV1.SetData[TComponent] (ME.ECS.Entity& entity, TComponent& data, ME.ECS.ComponentLifetime lifetime) (at Assets/Plugins/ecs/ECS/Core/Entities.cs:227)
Example.Features.Logic.InputFeature.MovePlayer_RPC (System.Int32 actorId, Example.Features.Logic.Input.Markers.InputDir dir) (at Assets/Example/Features/Logic/Input/InputFeature.cs:60)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
ME.ECS.Network.NetworkModule`1[TState].ME.ECS.StatesHistory.IEventRunner.RunEvent (ME.ECS.StatesHistory.HistoryEvent historyEvent) (at Assets/Plugins/ecs/ECS/Modules/NetworkModule/NetworkModule.cs:566)
ME.ECS.StatesHistory.StatesHistoryModule`1[TState].RunEvent (ME.ECS.StatesHistory.HistoryEvent historyEvent) (at Assets/Plugins/ecs/ECS/Modules/StatesHistoryModule/StatesHistoryModule.cs:937)
ME.ECS.StatesHistory.StatesHistoryModule`1[TState].PlayEventsForTickPre (ME.ECS.Tick tick) (at Assets/Plugins/ecs/ECS/Modules/StatesHistoryModule/StatesHistoryModule.cs:896)
ME.ECS.World.PlayPlugin1ForTickPre (ME.ECS.Tick tick) (at Assets/Plugins/ecs/ECS/Modules/StatesHistoryModule/StatesHistoryModule.cs:37)
ME.ECS.World.PlayPluginsForTickPre (ME.ECS.Tick tick) (at Assets/Plugins/ecs/ECS/Core/World/World.cs:3054)
ME.ECS.World.RunTick (ME.ECS.Tick tick, System.Single fixedDeltaTime) (at Assets/Plugins/ecs/ECS/Core/World/World.cs:2511)
ME.ECS.World.Simulate (ME.ECS.Tick from, ME.ECS.Tick to) (at Assets/Plugins/ecs/ECS/Core/World/World.cs:3005)
ME.ECS.World.UpdateLogic (System.Single deltaTime) (at Assets/Plugins/ecs/ECS/Core/World/World.cs:1946)
ME.ECS.World.Update (System.Single deltaTime) (at Assets/Plugins/ecs/ECS/Core/World/World.cs:2295)
Example.ExampleInitializer.Update () (at Assets/Example/Generator/ExampleInitializer.cs:55)

Settings:

image

Unity 2020.2.4f1 Windows 10

Rollbacks

And where can you see information or an example of how rollbacks work?

From the diagram, I realized that the input (markers) is being resimulated. And there are some checkpoints.

But in order to make the correct resimulation it is necessary to resimulate all systems. How realistic is this in heavy logic?
For example, if our simulation can work maximum 100 times per second, and in runtime it works 30 times per second.
Then, having received the packet 0.5s ago, we must resimulate the last 15 ticks. 15 / (100-30) = 0.214s is about 6.5 ticks of a normal simulation.
What do you think should be the speed (ticks per second) of the simulation for everything to run smoothly?

As a rule, some of the behavior is optimized due to the fact that the input has a delay. For example, you press to create a soldier and he is placed on the field in 1s. Thus, with a delay of 0.5s, we simply put a soldier whose timer is immediately 0.5s (1-0.5)
And we don't need to resimulate the entire state.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.