alecthomas / alecthomas/entityx

Are memory requirements O(entities * component types)?

未关闭
#201 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C++
星标
2.3k
派生
301
PR 合并指标
30 天内没有已合并 PR

描述

Reading the code, it seems to me like components share the index of their Entity, e.g. the Position Component for Entity #1,000,000 will the 1,000,000th Position Component in the Position Component Pool.

Am I understanding this correctly? If I have 1,000,000 entities, and there is one instance of the Foobar component, but it happens to be on entity 999,999, then we'll have to eat the memory of unused 999,998 unused components in the Foobar pool?

Am I reading the code correctly? If I'm wrong, can you help me understand how?

I'm mainly looking at EntityManager::assign to make this determination, specifically in the placement new:

::new(pool->get(id.index())) C(std::forward(args) ...);

where `pool` is the component pool, and `id` is the entity id.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。