Update 'Step 0: ECS Architecture'
parent
0a3198317c
commit
46cf360c26
|
@ -61,6 +61,7 @@ In a game, it is expected than entities can be created and removed at any time,
|
||||||
One way to solve this is to implement a memory pool for the entities and components. This way, a new entity will merely draw from the pool, and a removed entity will just return to the pool. No new allocation needed. This is covered by the lecture series as well, though it is much later down the series.
|
One way to solve this is to implement a memory pool for the entities and components. This way, a new entity will merely draw from the pool, and a removed entity will just return to the pool. No new allocation needed. This is covered by the lecture series as well, though it is much later down the series.
|
||||||
This is actually a premature optimisation, which is bad. However, I thought it would be fun to implement a memory pool. That's why I did it.
|
This is actually a premature optimisation, which is bad. However, I thought it would be fun to implement a memory pool. That's why I did it.
|
||||||
**Note: this does not get rid of dynamic allocation usage. The library SC will make use of it for obvious reasons.**
|
**Note: this does not get rid of dynamic allocation usage. The library SC will make use of it for obvious reasons.**
|
||||||
|
|
||||||
The mempool struct can be seen in `mempool.c`:
|
The mempool struct can be seen in `mempool.c`:
|
||||||
```
|
```
|
||||||
typedef struct MemPool
|
typedef struct MemPool
|
||||||
|
|
Loading…
Reference in New Issue