Coder Social home page Coder Social logo

improve world.maintain() about sim-ecs HOT 3 CLOSED

nsstc avatar nsstc commented on June 5, 2024
improve world.maintain()

from sim-ecs.

Comments (3)

vmwxiong avatar vmwxiong commented on June 5, 2024

Could maybe copy the whole world, then asynchronously work on it over time, a little bit each tick?

Not familiar with what maintain does though, just spitballing from what you said here.

from sim-ecs.

minecrawler avatar minecrawler commented on June 5, 2024

Not familiar with what maintain does

This ECS works with the optimization, that each system carries a cache containing all entities it has to work on. This makes execution very fast, since you don't have to join or match anything, the dataSet is already available when system.run() executes.

There are only two hard things in Computer Science: cache invalidation and naming things.
-- Phil Karlton

So, you still have to make sure to keep the caches in sync with whatever happens in your world, and that's where world.maintain() comes into play. It syncs entities in the world with the systems' caches. This allows you to prepare changes to the world during one step and then sync them on the transition to the next step, which guarantees that all systems always work on the same entities per step. Having that work stretch out over several steps would mean that you unexpectedly have to wait for entities to hit your systems, instead of having them in there the next step guaranteed.

And that's also why I think that the only optimization for stretching out work would be to focus the syncing on systems which are actually in use (which is defined by the state - if you don't work with states, per default, all systems will run).

from sim-ecs.

minecrawler avatar minecrawler commented on June 5, 2024

world.maintain was removed in favor of auto-syncing changes in cache at save points

from sim-ecs.

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.