diff --git a/include/librg.h b/include/librg.h index 60d49ce..d612e92 100644 --- a/include/librg.h +++ b/include/librg.h @@ -20,6 +20,10 @@ * sdl2.h * * Version History: + * 3.3.1 + * - Updated zpl dependencies + * - Removed zpl_math dependency (replaced by internal module in zpl) + * * 3.3.0 * - Added ipv6 support * - Added safe bitstream reads for internal methods @@ -36,7 +40,6 @@ * - Added helper methods: librg_time_now, librg_standard_deviation * - Changed ctx->tick_delay from u16 to f64 (slightly more precision) * - * Version History: * 3.1.0 * - Removed zpl_cull and zpl_event dependencies * - added librg_network_kick() @@ -111,20 +114,20 @@ /* include definitions */ #ifndef LIBRG_CUSTOM_INCLUDES - #ifdef ZPL_SYSTEM_WINDOWS - #define _WINSOCK_DEPRECATED_NO_WARNINGS - #endif #ifdef LIBRG_IMPLEMENTATION #define ZPL_IMPLEMENTATION - #define ZPLM_IMPLEMENTATION #define ENET_IMPLEMENTATION #endif #include "zpl.h" - #include "zpl_math.h" + + #ifdef ZPL_SYSTEM_WINDOWS + #define _WINSOCK_DEPRECATED_NO_WARNINGS + #endif + #include "enet.h" #endif -/* library mode (stastic or dynamic) */ +/* library mode (static or dynamic) */ #ifdef LIBRG_SHARED #if defined(_WIN32) #define LIBRG_API ZPL_EXTERN __declspec(dllexport) @@ -204,7 +207,7 @@ ZPL_TABLE_DECLARE(extern, librg_table_t, librg_table_, u32); ZPL_TABLE_DECLARE(static, librg_event_pool, librg_event_pool_, librg_event_block); /** - * Allocate librg ctx + * Allocates librg ctx * (to be used inside bindings) */ LIBRG_API void *librg_allocate_ptr(enum librg_pointer_type pointer_type); @@ -256,7 +259,7 @@ typedef struct librg_entity_t { u32 type; u64 flags; - zplm_vec3 position; + zpl_vec3 position; f32 stream_range; void *user_data; @@ -298,37 +301,37 @@ LIBRG_API usize librg_entity_query(struct librg_ctx_t *ctx, librg_entity_id enti */ LIBRG_API b32 librg_entity_valid(struct librg_ctx_t *ctx, librg_entity_id id); /** - * Try to find an entity that is assossiated with a particular peer, or NULL + * Try to find an entity that is associated with a particular peer, or NULL */ LIBRG_API struct librg_entity_t *librg_entity_find(struct librg_ctx_t *ctx, librg_peer_t *peer); /** - * Set particular entity visible or invisible + * Set particular's entity visibility * for other entities in stream zone */ LIBRG_API void librg_entity_visibility_set(struct librg_ctx_t *ctx, librg_entity_id entity_id, b32 state); /** - * Set particular entity visible or invisible + * Set particular's entity visibility * for other particular entity */ LIBRG_API void librg_entity_visibility_set_for(struct librg_ctx_t *ctx, librg_entity_id entity_id, librg_entity_id target, b32 state); /** - * Get particular entity visible or invisible + * Get particular entity's visibility * for other entities in stream zone */ LIBRG_API b32 librg_entity_visibility_get(struct librg_ctx_t *ctx, librg_entity_id entity_id); /** - * Get particular entity visible or invisible + * Get particular entity's visibility * for other particular entity */ LIBRG_API b32 librg_entity_visibility_get_for(struct librg_ctx_t *ctx, librg_entity_id entity_id, librg_entity_id target); /** - * Set some entity as client streamable - * Which means, that client will become responsive for sending + * Set an entity as client streamable + * Which means, that client will become responsible for sending * updates about this entity * - * And this entity wont be sent to the client, until he stops being the streamer + * And this entity won't be sent to the client, until he stops being the streamer * - * Setting other client as streamer, will remove previous streamer from entity + * Setting other client as streamer will remove previous streamer from entity */ LIBRG_API void librg_entity_control_set(struct librg_ctx_t *ctx, librg_entity_id entity_id, librg_peer_t *peer); /** @@ -336,7 +339,7 @@ LIBRG_API void librg_entity_control_set(struct librg_ctx_t *ctx, librg_entity_id */ LIBRG_API librg_peer_t *librg_entity_control_get(struct librg_ctx_t *ctx, librg_entity_id entity_id); /** - * Remove some entity from stream ownership of the client + * Remove an entity from stream ownership of the client */ LIBRG_API void librg_entity_control_remove(struct librg_ctx_t *ctx, librg_entity_id entity_id); /** @@ -407,7 +410,7 @@ typedef struct librg_event_t { librg_peer_t *peer; /* optional: peer is used for built-in events */ - u64 flags; /* flags for that event */ + u64 flags; /* this event's flags */ void *user_data; /* optional: user information */ } librg_event_t; @@ -437,19 +440,19 @@ LIBRG_API u64 librg_event_add(struct librg_ctx_t *ctx, u64 id, librg_event_cb ca LIBRG_API void librg_event_trigger(struct librg_ctx_t *ctx, u64 id, struct librg_event_t *event); /** * Used to remove particular callback from - * event chain, so it wont be called ever again + * event chain, so it won't be called ever again * * @param id usually you define event ids inside enum * @param index returned by librg_event_add */ LIBRG_API void librg_event_remove(struct librg_ctx_t *ctx, u64 id, u64 index); /** - * Used to reject some event from triggering from + * Used to reject an event from triggering from * inside of executing callback */ LIBRG_API void librg_event_reject(struct librg_event_t *event); /** - * Used to check if some event can be rejected + * Used to check if an event can be rejected */ LIBRG_API b32 librg_event_rejectable(struct librg_event_t *event); /** @@ -475,15 +478,15 @@ typedef struct librg_data_t { } librg_data_t; /** - * Initialize new bitstream with default mem size + * Initialize new bitstream with default memory size */ LIBRG_API void librg_data_init(struct librg_data_t *data); /** - * Initialize new bitstream with custom mem size + * Initialize new bitstream with custom memory size */ LIBRG_API void librg_data_init_size(struct librg_data_t *data, usize size); /** - * Initialize new bitstream with custom mem size (bindings stuff) + * Initialize new bitstream with custom memory size (used mostly by language bindings) */ LIBRG_API struct librg_data_t *librg_data_init_new(); /** @@ -492,7 +495,7 @@ LIBRG_API struct librg_data_t *librg_data_init_new(); LIBRG_API void librg_data_free(struct librg_data_t *data); /** * Reset initialized bitstream - * NOTE: doesnt remove any data, just resets read and write pos to 0 + * NOTE: it doesn't remove any data, it only resets read and write pos to 0 */ LIBRG_API void librg_data_reset(struct librg_data_t *data); /** @@ -519,7 +522,7 @@ LIBRG_API void librg_data_wptr(struct librg_data_t *data, void *ptr, usize size) LIBRG_API void librg_data_rptr_at(struct librg_data_t *data, void *ptr, usize size, isize position); LIBRG_API void librg_data_wptr_at(struct librg_data_t *data, void *ptr, usize size, isize position); /** - * A helprer macro for onliner methods + * A helprer macro for one-liner methods */ #define LIBRG_GEN_DATA_READWRITE(TYPE) \ LIBRG_API TYPE ZPL_JOIN2(librg_data_r,TYPE)(struct librg_data_t *data); \ @@ -577,7 +580,7 @@ typedef struct librg_message_t { } librg_message_t; /** - * Check are we connected + * Check for connectivity */ LIBRG_API b32 librg_is_connected(struct librg_ctx_t *ctx); /** @@ -661,7 +664,7 @@ LIBRG_API void librg_message_send_instream_except(struct librg_ctx_t *ctx, librg /** * Get current execution time - * On server side returns time aprox since process is up and running + * On server side returns time approx since process is up and running * On client side returns synced time client time to server time. * Ideally calling this method on both connected client and server at the same time * will return pretty much similar time, or at least 2 that are quite close to one another @@ -743,8 +746,8 @@ typedef struct librg_space_t { zpl_allocator_t allocator; u32 max_nodes; isize dimensions; - zplm_aabb3 boundary; - zplm_vec3 min_bounds; + zpl_aabb3 boundary; + zpl_vec3 min_bounds; b32 use_min_bounds; zpl_array(usize) free_nodes; zpl_array(struct librg_space_t) spaces; @@ -766,8 +769,8 @@ typedef struct librg_ctx_t { u16 max_connections; u32 max_entities; - zplm_vec3 world_size; - zplm_vec3 min_branch_size; + zpl_vec3 world_size; + zpl_vec3 min_branch_size; f64 last_update; void *user_data; @@ -946,16 +949,16 @@ extern "C" { LIBRG_INTERNAL void librg__world_update(void *); - LIBRG_INTERNAL void librg__world_entity_query(librg_ctx_t *ctx, librg_entity_id entity, librg_space_t *c, zplm_aabb3 bounds, librg_entity_id **out_entities); + LIBRG_INTERNAL void librg__world_entity_query(librg_ctx_t *ctx, librg_entity_id entity, librg_space_t *c, zpl_aabb3 bounds, librg_entity_id **out_entities); LIBRG_INTERNAL b32 librg__world_entity_destroy(librg_ctx_t *ctx, librg_entity_id id); /* space stuff */ - LIBRG_INTERNAL void librg__space_init(librg_space_t *c, zpl_allocator_t a, isize dims, zplm_aabb3 bounds, zplm_vec3 min_bounds, u32 max_nodes); + LIBRG_INTERNAL void librg__space_init(librg_space_t *c, zpl_allocator_t a, isize dims, zpl_aabb3 bounds, zpl_vec3 min_bounds, u32 max_nodes); LIBRG_INTERNAL void librg__space_clear(librg_space_t *c); b32 librg__space_remove_node(librg_space_t *c, librg_entity_t *tag); - LIBRG_INTERNAL b32 librg__space_intersects(isize dims, zplm_aabb3 a, zplm_aabb3 b) { + LIBRG_INTERNAL b32 librg__space_intersects(isize dims, zpl_aabb3 a, zpl_aabb3 b) { for (i32 i = 0; i < dims; ++i) { if (zpl_abs(a.centre.e[i] - b.centre.e[i]) > (a.half_size.e[i] + b.half_size.e[i])) return false; } @@ -963,7 +966,7 @@ extern "C" { return true; } - LIBRG_INTERNAL b32 librg__space_contains(isize dims, zplm_aabb3 a, f32 *point) { + LIBRG_INTERNAL b32 librg__space_contains(isize dims, zpl_aabb3 a, f32 *point) { for (i32 i = 0; i < dims; ++i) { if (!( a.centre.e[i] - a.half_size.e[i] <= point[i] && a.centre.e[i] + a.half_size.e[i] >= point[i])) { @@ -1045,15 +1048,15 @@ extern "C" { } // streamer - zplm_aabb3 world = {0}; - world.centre = zplm_vec3f(0, 0, 0); - world.half_size = zplm_vec3f(ctx->world_size.x, ctx->world_size.y, ctx->world_size.z); + zpl_aabb3 world = {0}; + world.centre = zpl_vec3f(0, 0, 0); + world.half_size = zpl_vec3f(ctx->world_size.x, ctx->world_size.y, ctx->world_size.z); u32 dimension = ctx->world_size.z == 0.0f ? LIBRG_SPACE_2D : LIBRG_SPACE_3D; if (ctx->min_branch_size.x == -1.0f && ctx->min_branch_size.y == -1.0f && ctx->min_branch_size.z == -1.0f) { - zplm_vec3 no_min_bounds = { 0 }; + zpl_vec3 no_min_bounds = { 0 }; ctx->min_branch_size = no_min_bounds; } @@ -1256,7 +1259,7 @@ extern "C" { entity->type = type; entity->flags = LIBRG_ENTITY_ALIVE; - entity->position = zplm_vec3f_zero(); + entity->position = zpl_vec3f_zero(); entity->stream_range = librg_option_get(LIBRG_DEFAULT_STREAM_RANGE) * 1.0f; entity->stream_branch = NULL; @@ -1292,9 +1295,9 @@ extern "C" { // reset array to 0 zpl_array_count(blob->last_query) = 0; - zplm_aabb3 search_bounds; + zpl_aabb3 search_bounds; search_bounds.centre = blob->position; - search_bounds.half_size = zplm_vec3f(blob->stream_range, blob->stream_range, blob->stream_range); + search_bounds.half_size = zpl_vec3f(blob->stream_range, blob->stream_range, blob->stream_range); librg__world_entity_query(ctx, entity, &ctx->world, search_bounds, &blob->last_query); *out_entities = blob->last_query; @@ -1843,10 +1846,10 @@ extern "C" { mean = sum / (f64)size; for (isize i = 0; i < size; i++) { - deviation += zplm_pow(values[i] - mean, 2); + deviation += zpl_pow(values[i] - mean, 2); } - return zplm_sqrt(deviation / (f64)size); + return zpl_sqrt(deviation / (f64)size); } #endif @@ -2102,7 +2105,7 @@ extern "C" { blob->type = librg_option_get(LIBRG_DEFAULT_CLIENT_TYPE); blob->flags = (LIBRG_ENTITY_ALIVE | LIBRG_ENTITY_CLIENT); - blob->position = zplm_vec3f_zero(); + blob->position = zpl_vec3f_zero(); // add server peer to storage librg_table_set(&msg->ctx->network.connected_peers, cast(u64)msg->peer, entity); @@ -2223,8 +2226,8 @@ extern "C" { librg_entity_id entity = librg_data_rent(msg->data); u32 type = librg_data_ru32(msg->data); - zplm_vec3 position; - librg_data_rptr(msg->data, &position, sizeof(zplm_vec3)); + zpl_vec3 position; + librg_data_rptr(msg->data, &position, sizeof(zpl_vec3)); // Create new entity on client side librg_entity_t *blob = &msg->ctx->entity.list[entity]; @@ -2264,7 +2267,7 @@ extern "C" { for (usize i = 0; i < query_size; ++i) { librg_entity_id entity = librg_data_rent(msg->data); - zplm_vec3 position; + zpl_vec3 position; librg_data_rptr(msg->data, &position, sizeof(position)); if (!librg_entity_valid(msg->ctx, entity)) { @@ -2310,7 +2313,7 @@ extern "C" { librg_data_read_safe(u32, size, msg->data); if (librg_data_capacity(msg->data) < librg_data_get_rpos(msg->data) + size || - librg_data_capacity(msg->data) < librg_data_get_rpos(msg->data) + sizeof(zplm_vec3)) { + librg_data_capacity(msg->data) < librg_data_get_rpos(msg->data) + sizeof(zpl_vec3)) { librg_dbg("invalid packet size on client streamer update\n"); return; } @@ -2393,7 +2396,7 @@ extern "C" { // check if user rejected the event if (!(event.flags & LIBRG_EVENT_REJECTED)) { - librg_data_wptr(&subdata, &blob->position, sizeof(zplm_vec3)); + librg_data_wptr(&subdata, &blob->position, sizeof(zpl_vec3)); librg_data_went(&data, entity); librg_data_wu32(&data, librg_data_get_wpos(&subdata)); @@ -2681,7 +2684,7 @@ extern "C" { // =======================================================================// #if 1 - b32 librg__space_bounds_small_enough(zplm_aabb3 a, zplm_vec3 b) { + b32 librg__space_bounds_small_enough(zpl_aabb3 a, zpl_vec3 b) { //TODO(zaklaus): Is this the best way we can determine bounds for k-d ? return a.half_size.x <= b.x && a.half_size.y <= b.y && a.half_size.z <= b.z; } @@ -2698,7 +2701,7 @@ extern "C" { }; void librg__space_split(librg_space_t *c) { - zplm_aabb3 hd = c->boundary; + zpl_aabb3 hd = c->boundary; for (i32 i = 0; i < c->dimensions; ++i) { hd.half_size.e[i] /= 2.0f; } @@ -2710,7 +2713,7 @@ extern "C" { f32 p[3] = {0}; for (i32 i = 0; i < loops; ++i) { librg_space_t space = {0}; - zplm_aabb3 bounds = {0}; + zpl_aabb3 bounds = {0}; p[0] = c->boundary.centre.e[0] + hd.half_size.e[0]*librg__space_tpl[i][0]; p[1] = c->boundary.centre.e[1] + hd.half_size.e[1]*librg__space_tpl[i][1]; p[2] = c->boundary.centre.e[2] + hd.half_size.e[2]*librg__space_tpl[i][2]; @@ -2746,7 +2749,7 @@ extern "C" { return false; } - void librg__space_init(librg_space_t *c, zpl_allocator_t a, isize dims, zplm_aabb3 bounds, zplm_vec3 min_bounds, u32 max_nodes) { + void librg__space_init(librg_space_t *c, zpl_allocator_t a, isize dims, zpl_aabb3 bounds, zpl_vec3 min_bounds, u32 max_nodes) { librg_space_t c_ = {0}; *c = c_; c->allocator = a; @@ -2754,7 +2757,7 @@ extern "C" { c->min_bounds = min_bounds; c->max_nodes = max_nodes; c->dimensions = dims; - c->use_min_bounds = zplm_vec3_mag(min_bounds) > 0.0f; + c->use_min_bounds = zpl_vec3_mag(min_bounds) > 0.0f; } void librg__space_clear(librg_space_t *c) { @@ -2891,7 +2894,7 @@ extern "C" { - void librg__world_entity_query(librg_ctx_t *ctx, librg_entity_id entity, librg_space_t *c, zplm_aabb3 bounds, librg_entity_id **out_entities) { + void librg__world_entity_query(librg_ctx_t *ctx, librg_entity_id entity, librg_space_t *c, zpl_aabb3 bounds, librg_entity_id **out_entities) { if (c->nodes == NULL) return; if (!librg__space_intersects(c->dimensions, c->boundary, bounds)) return; @@ -2955,7 +2958,7 @@ extern "C" { } entity->flags = LIBRG_ENTITY_NONE; - entity->position = zplm_vec3f_zero(); + entity->position = zpl_vec3f_zero(); entity->type = 0; entity->stream_branch = NULL; diff --git a/other/librg_limiter.h b/other/librg_limiter.h index 6dd3871..a41ea4c 100644 --- a/other/librg_limiter.h +++ b/other/librg_limiter.h @@ -25,7 +25,7 @@ extern "C" { f32 update_deteoriation; f32 update_moving_treshold; - zplm_vec3_t last_position; + zpl_vec3_t last_position; } librg_limiter_t; LIBRG_API void librg_limiter_init(librg_limiter_t *entity_limit); @@ -51,10 +51,10 @@ extern "C" { if (entity_limit->update_time < entity_limit->update_delay) { entity_limit->update_time += ctx->tick_delay; { - zplm_vec3_t dir; - zplm_vec3_sub(&dir, entity_limit->last_position, entity->position); + zpl_vec3_t dir; + zpl_vec3_sub(&dir, entity_limit->last_position, entity->position); - b32 is_moving = (zplm_vec3_dot(dir, dir) > entity_limit->update_moving_treshold); + b32 is_moving = (zpl_vec3_dot(dir, dir) > entity_limit->update_moving_treshold); if (is_moving || entity_limit->update_now) { entity_limit->update_delay = entity_limit->update_initial_delay; diff --git a/package-lock.json b/package-lock.json index de8fa57..6436d50 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,18 @@ { "name": "librg.c", - "version": "3.2.0", + "version": "3.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { "enet.c": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/enet.c/-/enet.c-2.0.1.tgz", - "integrity": "sha512-+v3k2vaNd28qIZnFYn5glnfO7XpV21yxPDLNYNEF56SRUAubJDCzFyWj1TfPbCvfb1gYAoNT6EhlQOrU91W9xw==" + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/enet.c/-/enet.c-2.1.2.tgz", + "integrity": "sha512-9B9ypSFnzxsTWpjxTgDQtNGVrnk3ObBSWb1F6oiGu5Weodyg65NBXQiSWa4Q/nh/MvGjy9bFXRfJlUOQbtohNw==" }, "zpl.c": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/zpl.c/-/zpl.c-6.6.0.tgz", - "integrity": "sha512-juTf8XVFvFhqYLpPgLyLg6whqRlO65qckWoRrIPasJV+nckU+0DEcykW5xBVWuFvgy0Fq6UnjEwi2zbrsRbH+A==" + "version": "8.12.2", + "resolved": "https://registry.npmjs.org/zpl.c/-/zpl.c-8.12.2.tgz", + "integrity": "sha512-dABeQ7Jd8qeYuRnc9njX17bQvEOQdczBb1kZuzdzETEImFKvbA4RfB04mcP5LWSYWhmKwJryXiK3KSnHrsKJhQ==" } } } diff --git a/package.json b/package.json index d14c52c..9925494 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "librg.c", - "version": "3.3.0", + "version": "3.3.1", "description": "Pure C library for building simple and elegant cross-platform mmo client-server solutions.", "main": "include/librg.h", "directories": { @@ -21,6 +21,6 @@ "homepage": "https://github.com/reguider/librg#readme", "dependencies": { "enet.c": "^2.0.1", - "zpl.c": "^6.6.0" + "zpl.c": "^8.12.2" } } diff --git a/test/build-test.c b/test/build-test.c index b750a4a..b44eeba 100644 --- a/test/build-test.c +++ b/test/build-test.c @@ -11,7 +11,7 @@ int main() { ctx.tick_delay = 32; ctx.mode = LIBRG_MODE_SERVER; - ctx.world_size = zplm_vec3f(5000.0f, 5000.0f, 0.0f); + ctx.world_size = zpl_vec3f(5000.0f, 5000.0f, 0.0f); librg_init(&ctx); diff --git a/test/build-test.cpp b/test/build-test.cpp index 82aa23e..8d7e3e0 100644 --- a/test/build-test.cpp +++ b/test/build-test.cpp @@ -11,7 +11,7 @@ int main() { ctx.tick_delay = 32; ctx.mode = LIBRG_MODE_SERVER; - ctx.world_size = zplm_vec3f(5000.0f, 5000.0f, 0.0f); + ctx.world_size = zpl_vec3f(5000.0f, 5000.0f, 0.0f); librg_init(&ctx); diff --git a/test/cli-client.c b/test/cli-client.c index 6906701..9ff920b 100644 --- a/test/cli-client.c +++ b/test/cli-client.c @@ -37,7 +37,7 @@ int main() { librg_ctx_t original = {0}; original.tick_delay = 100; original.mode = LIBRG_MODE_CLIENT; - original.world_size = zplm_vec3f(5000.0f, 5000.0f, 0.f); + original.world_size = zpl_vec3f(5000.0f, 5000.0f, 0.f); original.max_entities = 60000; #define size 1 diff --git a/test/cli-server.c b/test/cli-server.c index e904bcb..3d9cc57 100644 --- a/test/cli-server.c +++ b/test/cli-server.c @@ -68,8 +68,8 @@ int main() { ctx.tick_delay = 64; ctx.mode = LIBRG_MODE_SERVER; - ctx.world_size = zplm_vec3f(5000.0f, 5000.0f, 0.f); - ctx.min_branch_size = zplm_vec3f(-1, -1, -1); + ctx.world_size = zpl_vec3f(5000.0f, 5000.0f, 0.f); + ctx.min_branch_size = zpl_vec3f(-1, -1, -1); ctx.max_entities = 60000; ctx.max_connections = 1200; diff --git a/test/demo-client.c b/test/demo-client.c index 62ae9a9..3bb4c1e 100644 --- a/test/demo-client.c +++ b/test/demo-client.c @@ -21,7 +21,7 @@ enum { typedef struct { struct { - zplm_vec3_t accel; + zpl_vec3_t accel; f32 walk_time; f32 cooldown; i32 max_hp; @@ -31,7 +31,7 @@ typedef struct { #ifdef DEMO_CLIENT // interpolation f32 delta; - zplm_vec3_t curr_pos, last_pos, target_pos; + zpl_vec3_t curr_pos, last_pos, target_pos; #endif } hero_t; @@ -144,8 +144,8 @@ void interpolate_npcs(librg_ctx_t *ctx) { hero->delta += 16.666f / (ctx->timesync.server_delay / 0.001f); - zplm_vec3_t delta_pos; - zplm_vec3_lerp(&delta_pos, hero->last_pos, hero->target_pos, zpl_clamp01(hero->delta)); + zpl_vec3_t delta_pos; + zpl_vec3_lerp(&delta_pos, hero->last_pos, hero->target_pos, zpl_clamp01(hero->delta)); hero->curr_pos = delta_pos; // hero->curr_pos = entity->position; @@ -283,7 +283,7 @@ int main(int argc, char *argv[]) { ctx.tick_delay = 16.66666666666 * 4; // ctx.tick_delay = 250; ctx.mode = LIBRG_MODE_CLIENT; - ctx.world_size = zplm_vec3f(50000.0f, 50000.0f, 0.f); + ctx.world_size = zpl_vec3f(50000.0f, 50000.0f, 0.f); ctx.max_entities = 16000; librg_option_set(LIBRG_NETWORK_BUFFER_SIZE, 2); diff --git a/test/demo-server.c b/test/demo-server.c index 858eb5f..f3ce293 100644 --- a/test/demo-server.c +++ b/test/demo-server.c @@ -20,7 +20,7 @@ enum { typedef struct hero_t { struct { - zplm_vec3_t accel; + zpl_vec3_t accel; f32 walk_time; f32 cooldown; i32 max_hp; @@ -30,7 +30,7 @@ typedef struct hero_t { #ifdef DEMO_CLIENT // interpolation f32 delta; - zplm_vec3_t curr_pos, last_pos, target_pos; + zpl_vec3_t curr_pos, last_pos, target_pos; #endif librg_entity_t *follower1; @@ -140,7 +140,7 @@ void ai_think(librg_ctx_t *ctx) { hero->stream.accel.y = (hero->stream.accel.y > -1.0) ? ((hero->stream.accel.y < 1.0) ? hero->stream.accel.y : 1.0) : -1.0; } else { - zplm_vec3_t curpos = entity->position; + zpl_vec3_t curpos = entity->position; curpos.x += hero->stream.accel.x; curpos.y += hero->stream.accel.y; @@ -155,7 +155,7 @@ void ai_think(librg_ctx_t *ctx) { hero->stream.accel.y *= -1; } #define PP(x) x*x - if (zplm_vec3_mag2(hero->stream.accel) > PP(0.3)) { + if (zpl_vec3_mag2(hero->stream.accel) > PP(0.3)) { entity->position = curpos; } #undef PP @@ -198,7 +198,7 @@ int main() { ctx.mode = LIBRG_MODE_SERVER; ctx.tick_delay = 16.66666666666 * 4; // ctx.tick_delay = 1000; - ctx.world_size = zplm_vec3f(50000.0f, 50000.0f, 0.f); + ctx.world_size = zpl_vec3f(50000.0f, 50000.0f, 0.f); ctx.max_connections = 128; ctx.max_entities = 16000,