Giter VIP home page Giter VIP logo

Comments (7)

SanderMertens avatar SanderMertens commented on June 21, 2024 1

Fixed!

from flecs.

copygirl avatar copygirl commented on June 21, 2024

Which are the floating-point numbers that are used in Flecs' built-in systems? I can think of delta_time and other timing related functionality, but you can roll you own, and call ecs_progress to move the world one step forward. There might also be the possibility of overriding ecs_ftime_t with a non-floating-point type.

Can't speak on your other questions.

from flecs.

SanderMertens avatar SanderMertens commented on June 21, 2024

Yes it can. Like @copygirl mentioned you can override the ecs_ftime_t type (see flecs header) to an integer type, which will change all floating point time keeping features to use an integer. You can also call ecs_progress with a fixed/application specified time value.

Flecs has a reflection framework that lets you build any kind of serialization on top of it. Take a look at the JSON code for an example.

from flecs.

Eragon-Brisingr avatar Eragon-Brisingr commented on June 21, 2024
  • If I change ecs_ftime_t to uint32_t, the following code would cause an infinite loop: https://github.com/SanderMertens/flecs/blob/a666b506c74ceaabd79d35c09b67c5df4259503c/flecs.c#L24078
  • I have also found several uses of floating point numbers in the source code, and I cannot evaluate whether they will affect deterministic calculations.
  • After performing Json serialization, can it be guaranteed that the states of the two ends are completely consistent, such as the order of execution of entities in the next frame, the allocation logic of ecs_id, and so on?

from flecs.

SanderMertens avatar SanderMertens commented on June 21, 2024

Ah, the infinite loop sounds like an issue that was recently reported on the Discord as well. I'll take a look at that.

There are plenty of cases where floating point numbers are used in the code, though all usages related to time use the ecs_ftime_t type. That's the only one that should affect gameplay code because of delta_time, unless you explicitly build your game logic on other floating point values (which you shouldn't do if you want it to be deterministic).

The JSON serializer is not deterministic. I mentioned it because it's an example of a serializer that's built on top of the reflection framework. You can build a deterministic serializer on top of the reflection framework, there's nothing in it that'd prevent you from doing that.

from flecs.

Eragon-Brisingr avatar Eragon-Brisingr commented on June 21, 2024

@SanderMertens thank your answer. when infinite loop fixed i will close this issue.

from flecs.

Eragon-Brisingr avatar Eragon-Brisingr commented on June 21, 2024

@SanderMertens , I am currently attempting network synchronization with Lockstep based on Flecs.

  • When referring to the Json serialization solution, I noticed that information such as ecs_id cannot be overwritten to the client. After tracing the source code, I understood that I need to serialize the status and entity id information in ecs_world_t.store.entity_index. However, there seems to be no public API to access ecs_entity_index_t. Is there a reasonable way to complete the above function? (Modifying the source code is acceptable)
  • Could you provide a list of system states that need to be serialized? I am unsure whether the initial state consistency and calculation order are satisfied after completing the id status initialization synchronization.

Also, thank you for providing such a clean ecs solution for the community to use.

from flecs.

Related Issues (20)

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.