Comments (7)
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.
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 char
s), 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.
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.
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.
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.
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.
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)
- Difficult to understand how it works without examples HOT 5
- 'each': is not a member of 'entt::basic registry<entt::entity,std::allocator<Entity>> HOT 1
- class object to entt? HOT 8
- Serialization of "dead" components
- C++20 ranges trait specializations
- Efficiently iterating over a set of groups? HOT 2
- Signals not triggering properly in storage mixin iterator based insert HOT 2
- Access violation when using registry.clear<Component>() HOT 9
- Is it possible to use entt::nth_argument_t with lambdas that capture? HOT 6
- Question it is posible to use Entt with lightweight wrapper class as a entt::entity HOT 2
- Calling valid() on empty entt::valid leads to a segmentation fault.
- Add ability to compare entt::null and entt::handle
- Components with overriden new operator. HOT 6
- sparse_set_iterator::operator[] causes warnings when used with size_t HOT 6
- Working with multiple storages for the same type and preparing a view for each of the storages HOT 3
- entt build error: unused type alias 'common_type' HOT 9
- assert on destroy (inside of release function) non-orphan entity HOT 8
- Handling large tilemap HOT 7
- Acecss components of an entity, without giving full registry access HOT 14
- bazel version and compatibility number out of sync
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from entt.