diff --git a/code/apps/client/source/game.c b/code/apps/client/source/game.c index 979ce86..1d8e036 100644 --- a/code/apps/client/source/game.c +++ b/code/apps/client/source/game.c @@ -100,7 +100,7 @@ void flecs_dash_init() { ECS_IMPORT(world_ecs(), FlecsSystemsCivetweb); ecs_set(world_ecs(), 0, EcsDashServer, {.port = 27001}); - ecs_set_target_fps(world_ecs(), 60); + // ecs_set_target_fps(world_ecs(), 60); } void game_init(int8_t play_mode, uint32_t num_viewers, int32_t seed, uint16_t block_size, uint16_t chunk_size, uint16_t chunk_amount, int8_t is_dash_enabled) { @@ -180,4 +180,4 @@ void game_world_cleanup_entities(void) { } -} \ No newline at end of file +} diff --git a/code/apps/client/source/main.c b/code/apps/client/source/main.c index 64553be..4f39d33 100644 --- a/code/apps/client/source/main.c +++ b/code/apps/client/source/main.c @@ -29,7 +29,7 @@ int main(int argc, char** argv) zpl_opts_add(&opts, "v", "viewer-only", "run viewer-only client", ZPL_OPTS_FLAG); zpl_opts_add(&opts, "c", "viewer-count", "number of viewers (detachable clients)", ZPL_OPTS_INT); zpl_opts_add(&opts, "p", "preview-map", "draw world preview", ZPL_OPTS_FLAG); - zpl_opts_add(&opts, "dd", "disable-dash", "disables flecs dash", ZPL_OPTS_FLAG); + zpl_opts_add(&opts, "ed", "enable-dash", "enables flecs dash", ZPL_OPTS_FLAG); zpl_opts_add(&opts, "s", "seed", "world seed", ZPL_OPTS_INT); zpl_opts_add(&opts, "r", "random-seed", "generate random world seed", ZPL_OPTS_FLAG); zpl_opts_add(&opts, "bs", "block-size", "amount of units within a block (single axis)", ZPL_OPTS_INT); @@ -46,7 +46,7 @@ int main(int argc, char** argv) } int8_t is_viewer_only = zpl_opts_has_arg(&opts, "viewer-only"); - int8_t is_dash_enabled = !zpl_opts_has_arg(&opts, "disable-dash"); + int8_t is_dash_enabled = zpl_opts_has_arg(&opts, "enable-dash"); int32_t seed = zpl_opts_integer(&opts, "seed", DEFAULT_WORLD_SEED); uint16_t num_viewers = zpl_opts_integer(&opts, "viewer-count", 1); uint16_t block_size = zpl_opts_integer(&opts, "block-size", DEFAULT_BLOCK_SIZE); diff --git a/code/apps/client/source/platform_raylib.c b/code/apps/client/source/platform_raylib.c index e750196..c660abd 100644 --- a/code/apps/client/source/platform_raylib.c +++ b/code/apps/client/source/platform_raylib.c @@ -248,6 +248,10 @@ void lerp_entity_positions(uint64_t key, entity_view *data) { } } +float platform_frametime() { + return GetFrameTime(); +} + void do_entity_fadeinout(uint64_t key, entity_view * data) { switch (data->tran_effect) { case ETRAN_FADEIN: { diff --git a/code/apps/client/source/platform_text.c b/code/apps/client/source/platform_text.c index 2524294..dd59586 100644 --- a/code/apps/client/source/platform_text.c +++ b/code/apps/client/source/platform_text.c @@ -21,6 +21,10 @@ uint8_t platform_is_running() { return is_running; } +float platform_frametime() { + return 1.0f; +} + void platform_render() { zpl_printf("o"); zpl_sleep_ms(1000); diff --git a/code/common/platform.h b/code/common/platform.h index 740d61e..5fc6b47 100644 --- a/code/common/platform.h +++ b/code/common/platform.h @@ -3,6 +3,7 @@ void platform_init(); void platform_shutdown(); +float platform_frametime(); uint8_t platform_is_running(); void platform_input(); diff --git a/code/common/world/world.c b/code/common/world/world.c index 735791d..344f965 100644 --- a/code/common/world/world.c +++ b/code/common/world/world.c @@ -5,6 +5,7 @@ #include "modules/physics.h" #include "world/world.h" #include "entity_view.h" +#include "platform.h" #include "packets/pkt_send_librg_update.h" @@ -206,8 +207,9 @@ static void world_tracker_update(uint8_t ticker, uint32_t freq, uint8_t radius) } } + int32_t world_update() { - ecs_progress(world.ecs, 0); + ecs_progress(world.ecs, platform_frametime()); world_tracker_update(0, WORLD_TRACKER_UPDATE_FAST_MS, 2); world_tracker_update(1, WORLD_TRACKER_UPDATE_NORMAL_MS, 4);