Coder Social home page Coder Social logo

Comments (7)

skypjack avatar skypjack commented on May 9, 2024

In production environment I usually want to be sure that all the entities have been correctly deleted, thus all resources have been correctly released.
That's why there is an assert in debug mode to force a call to reset at the end of the process.

It works as expected, this is not a bug, I'm sorry.

from entt.

skypjack avatar skypjack commented on May 9, 2024

Actually no, if you call registry.reset(); (that is the recommended way) everything works just fine.
I can partially agree on the fact that components would be destroyed in any case, but I'm reworking the ECS to use raw storage (aka chars), thus it won't apply anymore.
That being said, I don't see the problem of invoking reset before to destroy the ECS yet, I'm sorry. What's the real problem you are experiencing?

from entt.

skypjack avatar skypjack commented on May 9, 2024

Mainly because the reset can throw (it depends on the components' types and we have no control over them) and to check that components have been properly destroyed is easier, faster and safer. Moreover because I want to be sure I've destroyed all the components on purpose when I destroy the registry. I don't want it to hide issues around by cleaning up my data.
Again, I don't see the problem with calling reset before to discard the registry yet, if any.

from entt.

skypjack avatar skypjack commented on May 9, 2024

Actually RAII idiom is something slightly different from what you got if you find this breaks it. And unobvious is something undocumented, that isn't the case for the requirement of calling reset.
I'm sorry but you can't have the cake and eat it with EnTT, at least with version 1.x (the current master). Version 2.x on which I'm working on right now won't have that assert probably, so stay tuned if you are interested.

from entt.

skypjack avatar skypjack commented on May 9, 2024

Just a question.
If I succeeded to remove the requirement of statically specifying components when users declare the registry, so that you can do this:

Registry registry;
// ...
auto entity = registry.create<Position>();
// ...

Do you think it could be a nice to have feature? I'm interested in the opinion from users.
The price to pay is a potential performance hit when you create components, that's all. Performance during iterations should be unaffected.
Moreover multicomponent views should reach the performance of single component views and still nothing to specify at compile-time time.

What about?

That's something I'm working on...


RAII doesn't apply here. Components aren't resources the pool acquire and must release. You misunderstood how RAII works and what's the purpose of that assert, really.

from entt.

skypjack avatar skypjack commented on May 9, 2024

Well, the biggest difference should be in terms of compilation time when you change the components list or a component definition. The registry is included in all the files that work with components, the single component affects only a few files. In large projects it means you have far less files to recompile.
Other differences exist but have not that impact indeed.

from entt.

skypjack avatar skypjack commented on May 9, 2024

Good. So, as long as performance aren't affected, you have no preferences. Thank you.
See #13 for more details on upcoming changes if you want to discuss them or give your own suggestions.

from entt.

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.