diff --git a/docs/FAQ.md b/docs/FAQ.md index 6df3058f9..27b297bb7 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -46,9 +46,23 @@ This is likely because you're creating a query in a loop. Queries should be crea ## Can Flecs be compiled to web assembly? Yes it can! See the [quickstart manual](Quickstart.md) for more information. -## Why am I getting an “use of undeclared identifier 'FLECS__E …’” compiler error? +## Why am I getting an “use of undeclared identifier 'FLECS_ID …’” compiler error? This happens in C if the variable that holds the component id can't be found. This example shows how to fix it: https://github.com/SanderMertens/flecs/tree/master/examples/c/entities/fwd_declare_component +## Why are my entity ids so large? +When you inspect the integer value of an entity you may see that this value is very large, usually around 4 billion. This is not a bug, and instead means that the entity id has been recycled. This example shows when recycling happens: + +```cpp +flecs::entity e1 = world.entity(); // small id +e1.destruct(); // id is made available for recycling + +flecs::entity e2 = world.entity(); // recycles e1 +e1.is_alive(); // false +e2.is_alive(); // true + +std::cout << e2.id(); // large id, upper 32 bits contains liveliness count +``` + ## What is the difference between add & set? Why do both exist? An `add` just adds a component without assigning a value to it. A `set` assigns a value to the component. Both operations ensure that the entity will have the component afterwards.