|
|
@@ -20,12 +20,13 @@
|
|
|
|
|
|
# Introduction
|
|
|
|
|
|
-This is a constantly updated section where I'll try to put the answers to the
|
|
|
+This is a constantly updated section where I'm trying to put the answers to the
|
|
|
most frequently asked questions.<br/>
|
|
|
If you don't find your answer here, there are two cases: nobody has done it yet
|
|
|
-or this section needs updating. In both cases, try to
|
|
|
-[open a new issue](https://github.com/skypjack/entt/issues/new) or enter the
|
|
|
-[gitter channel](https://gitter.im/skypjack/entt) and ask your question.
|
|
|
+or this section needs updating. In both cases, you can
|
|
|
+[open a new issue](https://github.com/skypjack/entt/issues/new) or enter either
|
|
|
+the [gitter channel](https://gitter.im/skypjack/entt) or the
|
|
|
+[discord server](https://discord.gg/5BjPWBd) to ask for help.<br/>
|
|
|
Probably someone already has an answer for you and we can then integrate this
|
|
|
part of the documentation.
|
|
|
|
|
|
@@ -45,14 +46,14 @@ lot, achieving good results in many cases.
|
|
|
First of all, there are two things to do in a Windows project:
|
|
|
|
|
|
* Disable the [`/JMC`](https://docs.microsoft.com/cpp/build/reference/jmc)
|
|
|
- option (_Just My Code_ debugging), available starting in Visual Studio 2017
|
|
|
+ option (_Just My Code_ debugging), available starting with Visual Studio 2017
|
|
|
version 15.8.
|
|
|
|
|
|
* Set the [`_ITERATOR_DEBUG_LEVEL`](https://docs.microsoft.com/cpp/standard-library/iterator-debug-level)
|
|
|
macro to 0. This will disable checked iterators and iterator debugging.
|
|
|
|
|
|
-Moreover, the macro `ENTT_ASSERT` should be redefined to disable internal checks
|
|
|
-made by `EnTT` in debug:
|
|
|
+Moreover, set the `ENTT_DISABLE_ASSERT` variable or redefine the `ENTT_ASSERT`
|
|
|
+macro to disable internal debug checks in `EnTT`:
|
|
|
|
|
|
```cpp
|
|
|
#define ENTT_ASSERT(...) ((void)0)
|
|
|
@@ -61,22 +62,22 @@ made by `EnTT` in debug:
|
|
|
These asserts are introduced to help the users but they require to access to the
|
|
|
underlying containers and therefore risk ruining the performance in some cases.
|
|
|
|
|
|
-With these changes, debug performance should increase enough for most cases. If
|
|
|
-you want something more, you can also switch to an optimization level `O0`
|
|
|
-or preferably `O1`.
|
|
|
+With these changes, debug performance should increase enough in most cases. If
|
|
|
+you want something more, you can also switch to an optimization level `O0` or
|
|
|
+preferably `O1`.
|
|
|
|
|
|
## How can I represent hierarchies with my components?
|
|
|
|
|
|
This is one of the first questions that anyone makes when starting to work with
|
|
|
the entity-component-system architectural pattern.<br/>
|
|
|
-There are several approaches to the problem and what’s the best one depends
|
|
|
-mainly on the real problem one is facing. In all cases, how to do it doesn't
|
|
|
-strictly depend on the library in use, but the latter can certainly allow or
|
|
|
-not different techniques depending on how the data are laid out.
|
|
|
-
|
|
|
-I tried to describe some of the techniques that fit well with the model of
|
|
|
-`EnTT`. [Here](https://skypjack.github.io/2019-06-25-ecs-baf-part-4/) is the
|
|
|
-first post of a series that tries to explore the problem. More will probably
|
|
|
+There are several approaches to the problem and the best one depends mainly on
|
|
|
+the real problem one is facing. In all cases, how to do it doesn't strictly
|
|
|
+depend on the library in use, but the latter certainly allows or not different
|
|
|
+techniques depending on how the data are laid out.
|
|
|
+
|
|
|
+I tried to describe some of the approaches that fit well with the model of
|
|
|
+`EnTT`. [This](https://skypjack.github.io/2019-06-25-ecs-baf-part-4/) is the
|
|
|
+first post of a series that tries to _explore_ the problem. More will probably
|
|
|
come in future.<br/>
|
|
|
In addition, `EnTT` also offers the possibility to create stable storage types
|
|
|
and therefore have pointer stability for one, all or some components. This is by
|
|
|
@@ -90,6 +91,7 @@ Custom entity identifiers are definitely a good idea in two cases at least:
|
|
|
|
|
|
* If `std::uint32_t` isn't large enough for your purposes, since this is the
|
|
|
underlying type of `entt::entity`.
|
|
|
+
|
|
|
* If you want to avoid conflicts when using multiple registries.
|
|
|
|
|
|
Identifiers can be defined through enum classes and class types that define an
|
|
|
@@ -105,7 +107,7 @@ There is no limit to the number of identifiers that can be defined.
|
|
|
## Warning C4307: integral constant overflow
|
|
|
|
|
|
According to [this](https://github.com/skypjack/entt/issues/121) issue, using a
|
|
|
-hashed string under VS could generate a warning.<br/>
|
|
|
+hashed string under VS (toolset v141) could generate a warning.<br/>
|
|
|
First of all, I want to reassure you: it's expected and harmless. However, it
|
|
|
can be annoying.
|
|
|
|
|
|
@@ -136,7 +138,7 @@ errors during compilation.
|
|
|
|
|
|
It's a pretty big problem but fortunately it's not a problem of `EnTT` and there
|
|
|
is a fairly simple solution to it.<br/>
|
|
|
-It consists in defining the `NOMINMAX` macro before to include any other header
|
|
|
+It consists in defining the `NOMINMAX` macro before including any other header
|
|
|
so as to get rid of the extra definitions:
|
|
|
|
|
|
```cpp
|
|
|
@@ -197,7 +199,9 @@ If this isn't clear, below you can find a _vademecum_ for this purpose:
|
|
|
|
|
|
* `on_created` is invoked when a component is first added (neither modified nor
|
|
|
replaced) to an entity.
|
|
|
+
|
|
|
* `on_update` is called whenever an existing component is modified or replaced.
|
|
|
+
|
|
|
* `on_destroyed` is called when a component is explicitly or implicitly removed
|
|
|
from an entity.
|
|
|
|