eco2d/code/game/src/world/world.c

477 lines
15 KiB
C
Raw Normal View History

2021-05-04 17:41:30 +00:00
#include "zpl.h"
#include "librg.h"
2021-07-27 12:43:26 +00:00
#include "modules/components.h"
#include "modules/systems.h"
2021-05-04 17:41:30 +00:00
#include "world/world.h"
2021-05-06 16:26:52 +00:00
#include "entity_view.h"
2021-08-10 15:21:25 +00:00
#include "debug_replay.h"
2021-08-25 21:36:20 +00:00
#include "items.h"
2021-05-12 15:50:30 +00:00
#include "world/worldgen/worldgen.h"
2021-05-10 07:10:26 +00:00
#include "platform.h"
2021-05-13 12:17:44 +00:00
#include "profiler.h"
2021-05-04 17:41:30 +00:00
2021-05-05 13:14:02 +00:00
#include "packets/pkt_send_librg_update.h"
2021-08-09 13:35:47 +00:00
ZPL_TABLE(static, world_snapshot, world_snapshot_, entity_view);
2021-05-04 17:41:30 +00:00
static world_data world = {0};
2021-08-09 13:35:47 +00:00
static world_snapshot streamer_snapshot;
2021-05-04 17:41:30 +00:00
2021-05-06 16:26:52 +00:00
entity_view world_build_entity_view(int64_t e) {
2021-08-09 13:35:47 +00:00
entity_view *cached_ev = world_snapshot_get(&streamer_snapshot, e);
if (cached_ev) return *cached_ev;
2021-05-06 16:26:52 +00:00
entity_view view = {0};
2021-08-09 15:18:34 +00:00
const Classify *classify = ecs_get(world_ecs(), e, Classify);
2021-08-11 13:49:44 +00:00
ZPL_ASSERT(classify);
2021-07-27 15:57:50 +00:00
view.kind = classify->id;
2021-08-09 15:18:34 +00:00
const Position *pos = ecs_get(world_ecs(), e, Position);
2021-05-06 18:24:01 +00:00
if (pos) {
view.x = pos->x;
view.y = pos->y;
}
2021-08-09 15:18:34 +00:00
const Velocity *vel = ecs_get(world_ecs(), e, Velocity);
if (vel) {
view.flag |= EFLAG_INTERP;
view.vx = vel->x;
view.vy = vel->y;
2021-05-06 18:24:01 +00:00
}
2021-08-09 15:18:34 +00:00
const Health *health = ecs_get(world_ecs(), e, Health);
2021-07-27 16:34:31 +00:00
if (health) {
view.hp = health->hp;
view.max_hp = health->max_hp;
}
2021-07-27 11:30:43 +00:00
2021-08-09 18:58:52 +00:00
if (ecs_get(world_ecs(), e, Vehicle)) {
Vehicle const* veh = ecs_get(world_ecs(), e, Vehicle);
view.heading = veh->heading;
}
2021-08-25 21:36:20 +00:00
if (ecs_get(world_ecs(), e, ItemDrop)) {
ItemDrop const* dr = ecs_get(world_ecs(), e, ItemDrop);
view.asset = item_get_asset(dr->kind);
2021-08-30 15:50:05 +00:00
view.quantity = dr->quantity;
}
Inventory *inv = 0;
if ((inv = ecs_get_mut_if(world_ecs(), e, Inventory))) {
view.has_items = true;
for (int i = 0; i < ITEMS_INVENTORY_SIZE; i += 1) {
view.items[i] = inv->items[i];
}
2021-08-30 15:56:23 +00:00
const Input *in = ecs_get(world_ecs(), e, Input);
if (in)
view.selected_item = in->selected_item;
2021-08-25 21:36:20 +00:00
}
2021-08-10 22:02:11 +00:00
Chunk *chpos = 0;
if ((chpos = ecs_get_mut_if(world_ecs(), e, Chunk))) {
2021-05-06 18:24:01 +00:00
view.x = chpos->x;
view.y = chpos->y;
view.blocks_used = 1;
2021-07-27 11:30:43 +00:00
view.is_dirty = chpos->is_dirty;
chpos->is_dirty = false;
for (int i = 0; i < world.chunk_size*world.chunk_size; i += 1) {
2021-07-26 15:53:18 +00:00
view.blocks[i] = world.block_mapping[chpos->id][i];
}
2021-08-30 09:59:36 +00:00
for (int i = 0; i < world.chunk_size*world.chunk_size; i += 1) {
view.outer_blocks[i] = world.outer_block_mapping[chpos->id][i];
}
2021-05-06 18:24:01 +00:00
}
2021-05-06 16:26:52 +00:00
2021-08-09 13:35:47 +00:00
world_snapshot_set(&streamer_snapshot, e, view);
2021-05-06 16:26:52 +00:00
return view;
}
2021-05-05 22:03:43 +00:00
int32_t tracker_write_create(librg_world *w, librg_event *e) {
int64_t entity_id = librg_event_entity_get(w, e);
2021-05-09 14:41:19 +00:00
#ifdef WORLD_LAYERING
if (world.active_layer_id != WORLD_TRACKER_LAYERS-1) {
// NOTE(zaklaus): reject updates from smaller layers
return LIBRG_WRITE_REJECT;
}
#endif
2021-05-06 16:26:52 +00:00
size_t actual_length = librg_event_size_get(w, e);
char *buffer = librg_event_buffer_get(w, e);
2021-05-10 09:35:04 +00:00
return (int32_t)entity_view_pack_struct(buffer, actual_length, world_build_entity_view(entity_id));
2021-05-05 22:03:43 +00:00
}
int32_t tracker_write_remove(librg_world *w, librg_event *e) {
2021-05-12 14:02:12 +00:00
(void)e;
(void)w;
2021-05-09 14:41:19 +00:00
#ifdef WORLD_LAYERING
if (world.active_layer_id != WORLD_TRACKER_LAYERS-1) {
// NOTE(zaklaus): reject updates from smaller layers
return LIBRG_WRITE_REJECT;
}
#endif
2021-05-05 22:03:43 +00:00
return 0;
}
int32_t tracker_write_update(librg_world *w, librg_event *e) {
2021-05-06 16:26:52 +00:00
int64_t entity_id = librg_event_entity_get(w, e);
2021-05-05 22:03:43 +00:00
size_t actual_length = librg_event_size_get(w, e);
char *buffer = librg_event_buffer_get(w, e);
2021-05-10 09:24:55 +00:00
entity_view view = world_build_entity_view(entity_id);
2021-05-06 16:26:52 +00:00
2021-05-10 09:24:55 +00:00
// NOTE(zaklaus): exclude chunks from updates as they never move
{
2021-07-27 11:30:43 +00:00
if (view.kind == EKIND_CHUNK && !view.is_dirty) {
2021-05-10 09:24:55 +00:00
return LIBRG_WRITE_REJECT;
}
}
2021-05-10 09:35:04 +00:00
return (int32_t)entity_view_pack_struct(buffer, actual_length, view);
2021-05-05 22:03:43 +00:00
}
2021-05-06 15:30:38 +00:00
void world_setup_pkt_handlers(world_pkt_reader_proc *reader_proc, world_pkt_writer_proc *writer_proc) {
world.reader_proc = reader_proc;
world.writer_proc = writer_proc;
}
2021-05-12 16:28:39 +00:00
int32_t world_init(int32_t seed, uint16_t chunk_size, uint16_t chunk_amount) {
2021-05-06 15:30:38 +00:00
if (world.data) {
return 0;
}
world.seed = seed;
2021-05-04 17:41:30 +00:00
world.chunk_size = chunk_size;
2021-05-08 06:55:12 +00:00
world.chunk_amount = chunk_amount;
2021-05-04 17:41:30 +00:00
world.dim = (world.chunk_size * world.chunk_amount);
2021-05-08 07:07:24 +00:00
world.size = world.dim * world.dim;
2021-05-04 17:41:30 +00:00
2021-05-06 07:56:38 +00:00
if (world.tracker == NULL) {
world.tracker = librg_world_create();
}
2021-05-06 15:30:38 +00:00
2021-05-04 17:41:30 +00:00
if (world.tracker == NULL) {
zpl_printf("[ERROR] An error occurred while trying to create a server world.\n");
return WORLD_ERROR_TRACKER_FAILED;
}
/* config our world grid */
2021-05-12 16:28:39 +00:00
librg_config_chunksize_set(world.tracker, WORLD_BLOCK_SIZE * world.chunk_size, WORLD_BLOCK_SIZE * world.chunk_size, 0);
librg_config_chunkamount_set(world.tracker, world.chunk_amount, world.chunk_amount, 0);
2021-05-12 14:42:22 +00:00
librg_config_chunkoffset_set(world.tracker, LIBRG_OFFSET_BEG, LIBRG_OFFSET_BEG, LIBRG_OFFSET_BEG);
2021-05-04 17:41:30 +00:00
2021-05-05 22:03:43 +00:00
librg_event_set(world.tracker, LIBRG_WRITE_CREATE, tracker_write_create);
librg_event_set(world.tracker, LIBRG_WRITE_REMOVE, tracker_write_remove);
librg_event_set(world.tracker, LIBRG_WRITE_UPDATE, tracker_write_update);
2021-05-04 17:41:30 +00:00
world.data = zpl_malloc(sizeof(uint8_t)*world.size);
if (!world.data) {
return WORLD_ERROR_OUTOFMEM;
}
world.ecs = ecs_init();
2021-07-27 12:43:26 +00:00
ECS_IMPORT(world.ecs, Components);
ECS_IMPORT(world.ecs, Systems);
world.ecs_update = ecs_query_new(world.ecs, "components.ClientInfo, components.Position");
2021-07-26 15:53:18 +00:00
world.chunk_mapping = zpl_malloc(sizeof(ecs_entity_t)*zpl_square(chunk_amount));
world.block_mapping = zpl_malloc(sizeof(uint8_t*)*zpl_square(chunk_amount));
2021-08-30 09:59:36 +00:00
world.outer_block_mapping = zpl_malloc(sizeof(uint8_t*)*zpl_square(chunk_amount));
2021-08-09 13:35:47 +00:00
world_snapshot_init(&streamer_snapshot, zpl_heap());
2021-05-12 14:02:12 +00:00
int32_t world_build_status = worldgen_test(&world);
2021-05-09 16:25:34 +00:00
ZPL_ASSERT(world_build_status >= 0);
for (int i = 0; i < world.chunk_amount * world.chunk_amount; ++i) {
2021-05-04 17:41:30 +00:00
ecs_entity_t e = ecs_new(world.ecs, 0);
2021-07-27 15:57:50 +00:00
ecs_set(world.ecs, e, Classify, {.id = EKIND_CHUNK });
Chunk *chunk = ecs_get_mut(world.ecs, e, Chunk, NULL);
2021-05-04 17:41:30 +00:00
librg_entity_track(world.tracker, e);
2021-05-08 20:32:31 +00:00
librg_entity_chunk_set(world.tracker, e, i);
librg_chunk_to_chunkpos(world.tracker, i, &chunk->x, &chunk->y, NULL);
2021-07-26 15:53:18 +00:00
world.chunk_mapping[i] = e;
world.block_mapping[i] = zpl_malloc(sizeof(uint8_t)*zpl_square(chunk_size));
2021-08-30 09:59:36 +00:00
world.outer_block_mapping[i] = zpl_malloc(sizeof(uint8_t)*zpl_square(chunk_size));
2021-07-26 15:53:18 +00:00
chunk->id = i;
2021-07-27 11:30:43 +00:00
chunk->is_dirty = false;
2021-05-14 05:02:25 +00:00
for (int y = 0; y < chunk_size; y += 1) {
for (int x = 0; x < chunk_size; x += 1) {
int chk_x = chunk->x * chunk_size;
int chk_y = chunk->y * chunk_size;
2021-08-30 09:59:36 +00:00
2021-07-26 15:53:18 +00:00
uint8_t *c = &world.block_mapping[i][(y*chunk_size)+x];
2021-07-19 08:28:23 +00:00
*c = world.data[(chk_y+y)*world.dim + (chk_x+x)];
2021-08-30 09:59:36 +00:00
c = &world.outer_block_mapping[i][(y*chunk_size)+x];
*c = 0;
}
2021-05-14 05:02:25 +00:00
}
2021-05-04 17:41:30 +00:00
}
2021-08-30 09:59:36 +00:00
zpl_mfree(world.data);
world.data = NULL;
2021-05-04 17:41:30 +00:00
zpl_printf("[INFO] Created a new server world\n");
return world_build_status;
2021-05-04 17:41:30 +00:00
}
int32_t world_destroy(void) {
librg_world_destroy(world.tracker);
ecs_fini(world.ecs);
2021-07-26 15:53:18 +00:00
zpl_mfree(world.chunk_mapping);
for (int i = 0; i < zpl_square(world.chunk_amount); i+=1) {
zpl_mfree(world.block_mapping[i]);
2021-08-30 10:00:09 +00:00
zpl_mfree(world.outer_block_mapping[i]);
2021-07-26 15:53:18 +00:00
}
zpl_mfree(world.block_mapping);
2021-08-30 09:59:36 +00:00
zpl_mfree(world.outer_block_mapping);
2021-08-09 13:35:47 +00:00
world_snapshot_destroy(&streamer_snapshot);
2021-05-04 17:41:30 +00:00
zpl_memset(&world, 0, sizeof(world));
zpl_printf("[INFO] World was destroyed.\n");
return WORLD_ERROR_NONE;
}
2021-05-08 16:10:34 +00:00
#define WORLD_LIBRG_BUFSIZ 2000000
2021-05-06 18:24:01 +00:00
static void world_tracker_update(uint8_t ticker, uint32_t freq, uint8_t radius) {
if (world.tracker_update[ticker] > zpl_time_rel_ms()) return;
world.tracker_update[ticker] = zpl_time_rel_ms() + freq;
2021-05-05 22:03:43 +00:00
2021-05-13 12:17:44 +00:00
profile(PROF_WORLD_WRITE) {
ecs_iter_t it = ecs_query_iter(world.ecs_update);
static char buffer[WORLD_LIBRG_BUFSIZ] = {0};
world.active_layer_id = ticker;
2021-05-13 12:17:44 +00:00
while (ecs_query_next(&it)) {
ClientInfo *p = ecs_column(&it, ClientInfo, 1);
2021-05-13 12:17:44 +00:00
for (int i = 0; i < it.count; i++) {
size_t datalen = WORLD_LIBRG_BUFSIZ;
2021-05-13 12:17:44 +00:00
// TODO(zaklaus): SUPER TEMPORARY HOT !!! simulate variable radius queries
{
2021-09-08 15:34:30 +00:00
librg_entity_radius_set(world_tracker(), it.entities[i], radius);
2021-05-13 12:17:44 +00:00
}
// TODO(zaklaus): push radius once librg patch comes in
2021-09-08 14:12:38 +00:00
int32_t result = librg_world_write(world_tracker(), it.entities[i], buffer, &datalen, NULL);
2021-05-13 12:17:44 +00:00
if (result > 0) {
zpl_printf("[info] buffer size was not enough, please increase it by at least: %d\n", result);
} else if (result < 0) {
zpl_printf("[error] an error happened writing the world %d\n", result);
}
2021-05-13 12:17:44 +00:00
pkt_send_librg_update((uint64_t)p[i].peer, p[i].view_id, ticker, buffer, datalen);
2021-05-05 13:14:02 +00:00
}
}
2021-08-09 13:35:47 +00:00
// NOTE(zaklaus): clear out our streaming snapshot
// TODO(zaklaus): move this to zpl
{
zpl_array_clear(streamer_snapshot.hashes);
zpl_array_clear(streamer_snapshot.entries);
}
2021-05-05 13:14:02 +00:00
}
2021-05-05 13:52:28 +00:00
}
2021-05-10 07:10:26 +00:00
2021-05-05 13:52:28 +00:00
int32_t world_update() {
2021-05-13 13:44:08 +00:00
profile (PROF_UPDATE_SYSTEMS) {
ecs_progress(world.ecs, 0.0f);
}
world_tracker_update(0, WORLD_TRACKER_UPDATE_FAST_MS, 2);
world_tracker_update(1, WORLD_TRACKER_UPDATE_NORMAL_MS, 4);
world_tracker_update(2, WORLD_TRACKER_UPDATE_SLOW_MS, 6);
2021-08-10 15:21:25 +00:00
debug_replay_update();
2021-05-04 17:41:30 +00:00
return 0;
}
2021-05-04 19:22:55 +00:00
int32_t world_read(void* data, uint32_t datalen, void *udata) {
2021-05-04 17:41:30 +00:00
if (world.reader_proc) {
2021-05-04 19:22:55 +00:00
return world.reader_proc(data, datalen, udata);
2021-05-04 17:41:30 +00:00
}
return -1;
}
2021-05-04 19:22:55 +00:00
int32_t world_write(pkt_header *pkt, void *udata) {
2021-05-04 17:41:30 +00:00
if (world.writer_proc) {
2021-05-04 19:22:55 +00:00
return world.writer_proc(pkt, udata);
2021-05-04 17:41:30 +00:00
}
return -1;
}
uint32_t world_buf(uint8_t const **ptr, uint32_t *width) {
ZPL_ASSERT_NOT_NULL(world.data);
ZPL_ASSERT_NOT_NULL(ptr);
*ptr = world.data;
2021-05-08 07:07:24 +00:00
if (width) *width = world.dim;
2021-05-04 17:41:30 +00:00
return world.size;
}
2021-08-30 17:39:25 +00:00
uint32_t world_seed(void) {
return world.seed;
}
2021-05-04 17:41:30 +00:00
ecs_world_t * world_ecs() {
2021-08-30 15:50:05 +00:00
if (world.ecs_stage != NULL) {
return world.ecs_stage;
}
2021-05-04 17:41:30 +00:00
return world.ecs;
}
2021-08-30 15:50:05 +00:00
void world_set_stage(ecs_world_t *ecs) {
world.ecs_stage = ecs;
}
2021-08-09 13:35:47 +00:00
librg_world *world_tracker() {
2021-05-04 17:41:30 +00:00
return world.tracker;
}
uint16_t world_chunk_size(void) {
return world.chunk_size;
}
2021-05-08 06:55:12 +00:00
uint16_t world_chunk_amount(void) {
return world.chunk_amount;
}
uint16_t world_dim(void) {
2021-05-12 16:28:39 +00:00
return WORLD_BLOCK_SIZE * world.chunk_size * world.chunk_amount;
2021-05-04 17:41:30 +00:00
}
2021-07-26 15:53:18 +00:00
ecs_entity_t world_chunk_mapping(librg_chunk id) {
2021-08-11 13:49:44 +00:00
ZPL_ASSERT(id >= 0 && id < zpl_square(world.chunk_amount));
2021-07-26 15:53:18 +00:00
return world.chunk_mapping[id];
}
world_block_lookup world_block_from_realpos(float x, float y) {
x = zpl_clamp(x, 0, world_dim()-1);
y = zpl_clamp(y, 0, world_dim()-1);
librg_chunk chunk_id = librg_chunk_from_realpos(world.tracker, x, y, 0);
ecs_entity_t e = world.chunk_mapping[chunk_id];
int32_t size = world.chunk_size * WORLD_BLOCK_SIZE;
int16_t chunk_x, chunk_y;
librg_chunk_to_chunkpos(world.tracker, chunk_id, &chunk_x, &chunk_y, NULL);
// NOTE(zaklaus): pos relative to chunk
float chx = x - chunk_x * size;
float chy = y - chunk_y * size;
uint32_t bx = (uint32_t)chx / WORLD_BLOCK_SIZE;
uint32_t by = (uint32_t)chy / WORLD_BLOCK_SIZE;
uint32_t block_idx = (by*world.chunk_size)+bx;
2021-08-30 09:59:36 +00:00
uint8_t block_id = world.outer_block_mapping[chunk_id][block_idx];
if (block_id == 0) {
block_id = world.block_mapping[chunk_id][block_idx];
}
2021-07-26 15:53:18 +00:00
// NOTE(zaklaus): pos relative to block's center
float box = chx - bx * WORLD_BLOCK_SIZE - WORLD_BLOCK_SIZE/2.0f;
float boy = chy - by * WORLD_BLOCK_SIZE - WORLD_BLOCK_SIZE/2.0f;
world_block_lookup lookup = {
.id = block_idx,
.block_id = block_id,
2021-07-27 11:30:43 +00:00
.chunk_id = chunk_id,
.chunk_e = e,
2021-07-26 15:53:18 +00:00
.ox = box,
.oy = boy,
};
return lookup;
}
2021-07-27 11:30:43 +00:00
world_block_lookup world_block_from_index(int64_t id, uint16_t block_idx) {
2021-08-30 09:59:36 +00:00
uint8_t block_id = world.outer_block_mapping[id][block_idx];
if (block_id == 0) {
block_id = world.block_mapping[id][block_idx];
}
2021-07-27 11:30:43 +00:00
world_block_lookup lookup = {
.id = block_idx,
.block_id = block_id,
.chunk_id = id,
.chunk_e = world.chunk_mapping[id],
};
return lookup;
}
int64_t world_chunk_from_realpos(float x, float y) {
librg_chunk chunk_id = librg_chunk_from_realpos(world.tracker, x, y, 0);
return world.chunk_mapping[chunk_id];
}
int64_t world_chunk_from_entity(ecs_entity_t id) {
return librg_entity_chunk_get(world.tracker, id);
}
2021-08-30 15:50:05 +00:00
void world_chunk_replace_block(int64_t id, uint16_t block_idx, uint8_t block_id) {
2021-08-11 13:49:44 +00:00
ZPL_ASSERT(block_idx >= 0 && block_idx < zpl_square(world.chunk_size));
2021-07-27 11:30:43 +00:00
world.block_mapping[id][block_idx] = block_id;
2021-08-30 15:50:05 +00:00
world_chunk_mark_dirty(world.chunk_mapping[id]);
2021-07-27 11:30:43 +00:00
}
2021-08-30 16:14:35 +00:00
bool world_chunk_place_block(int64_t id, uint16_t block_idx, uint8_t block_id) {
2021-08-30 09:59:36 +00:00
ZPL_ASSERT(block_idx >= 0 && block_idx < zpl_square(world.chunk_size));
2021-08-30 16:14:35 +00:00
if (world.outer_block_mapping[id][block_idx] != 0 && block_id != 0) return false;
2021-08-30 09:59:36 +00:00
world.outer_block_mapping[id][block_idx] = block_id;
2021-08-30 15:50:05 +00:00
world_chunk_mark_dirty(world.chunk_mapping[id]);
2021-08-30 16:14:35 +00:00
return true;
2021-08-30 09:59:36 +00:00
}
2021-07-27 11:30:43 +00:00
uint8_t *world_chunk_get_blocks(int64_t id) {
return world.block_mapping[id];
}
2021-08-30 15:50:05 +00:00
void world_chunk_mark_dirty(ecs_entity_t e) {
2021-07-27 12:43:26 +00:00
bool was_added=false;
2021-08-30 15:50:05 +00:00
Chunk *chunk = ecs_get_mut(world_ecs(), e, Chunk, &was_added);
2021-08-11 13:49:44 +00:00
ZPL_ASSERT(!was_added);
2021-07-27 11:30:43 +00:00
if (chunk) chunk->is_dirty = true;
}
2021-08-30 15:50:05 +00:00
uint8_t world_chunk_is_dirty(ecs_entity_t e) {
2021-07-27 12:43:26 +00:00
bool was_added=false;
2021-08-30 15:50:05 +00:00
Chunk *chunk = ecs_get_mut(world_ecs(), e, Chunk, &was_added);
2021-08-11 13:49:44 +00:00
ZPL_ASSERT(!was_added);
2021-07-27 11:30:43 +00:00
if (chunk) return chunk->is_dirty;
return false;
2021-08-09 13:35:47 +00:00
}
2021-08-09 17:30:39 +00:00
int64_t *world_chunk_fetch_entities(librg_chunk chunk_id, size_t *ents_len) {
ZPL_ASSERT_NOT_NULL(ents_len);
static int64_t ents[UINT16_MAX];
*ents_len = UINT16_MAX;
librg_world_fetch_chunk(world.tracker, chunk_id, ents, ents_len);
return ents;
}
int64_t *world_chunk_fetch_entities_realpos(float x, float y, size_t *ents_len) {
return world_chunk_fetch_entities(librg_chunk_from_realpos(world.tracker, x, y, 0), ents_len);
}
int64_t *world_chunk_query_entities(int64_t e, size_t *ents_len, int8_t radius) {
ZPL_ASSERT_NOT_NULL(ents_len);
static int64_t ents[UINT16_MAX];
*ents_len = UINT16_MAX;
librg_entity_radius_set(world.tracker, e, radius);
librg_world_query(world.tracker, e, ents, ents_len);
return ents;
2021-08-10 15:21:25 +00:00
}
uint8_t world_entity_valid(ecs_entity_t e) {
if (!e) return false;
2021-08-30 15:50:05 +00:00
return ecs_is_alive(world_ecs(), e);
2021-08-10 15:21:25 +00:00
}