use MP update rate
parent
9f60890a20
commit
3436bed2ac
|
@ -62,7 +62,7 @@ void predict_receive_update(entity_view *d, entity_view *data) {
|
|||
data->tran_time = d->tran_time;
|
||||
}
|
||||
|
||||
#define ENTITY_DO_LERP_SP 0
|
||||
#define ENTITY_DO_LERP_SP 1
|
||||
|
||||
void lerp_entity_positions(uint64_t key, entity_view *data) {
|
||||
(void)key;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#define PROF_COLLATE_WINDOW 0.5
|
||||
|
||||
static float profiler_warmup = 3.0f;
|
||||
|
||||
// NOTE(zaklaus): KEEP ORDER IN SYNC WITH profiler_kind ENUM !!!
|
||||
static profiler profilers[] = {
|
||||
{ .id = PROF_TOTAL_TIME, .name = "measured time" },
|
||||
|
@ -33,6 +35,13 @@ void profiler_stop(profiler_kind id) {
|
|||
}
|
||||
|
||||
void profiler_collate() {
|
||||
if (profiler_warmup > 0) {
|
||||
profiler_warmup -= GetFrameTime();
|
||||
for (uint32_t i = PROF_MAIN_LOOP; i < MAX_PROF; i += 1) {
|
||||
profiler_reset(i);
|
||||
}
|
||||
return;
|
||||
}
|
||||
static double frame_counter = 0.0;
|
||||
static uint64_t frames = 0;
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "packets/pkt_send_librg_update.h"
|
||||
|
||||
#define ECO2D_STREAM_ACTIONFILTER 1
|
||||
|
||||
ZPL_TABLE(static, world_snapshot, world_snapshot_, entity_view);
|
||||
|
||||
static world_data world = {0};
|
||||
|
@ -350,15 +352,17 @@ int32_t world_update() {
|
|||
ecs_progress(world.ecs, 0.0f);
|
||||
}
|
||||
|
||||
float fast_ms = WORLD_TRACKER_UPDATE_FAST_MS;
|
||||
float normal_ms = WORLD_TRACKER_UPDATE_NORMAL_MS;
|
||||
float slow_ms = WORLD_TRACKER_UPDATE_SLOW_MS;
|
||||
float fast_ms = WORLD_TRACKER_UPDATE_MP_FAST_MS;
|
||||
float normal_ms = WORLD_TRACKER_UPDATE_MP_NORMAL_MS;
|
||||
float slow_ms = WORLD_TRACKER_UPDATE_MP_SLOW_MS;
|
||||
|
||||
if (game_get_kind() != GAMEKIND_SINGLE) {
|
||||
fast_ms = WORLD_TRACKER_UPDATE_MP_FAST_MS;
|
||||
normal_ms = WORLD_TRACKER_UPDATE_MP_NORMAL_MS;
|
||||
slow_ms = WORLD_TRACKER_UPDATE_MP_SLOW_MS;
|
||||
#if 0
|
||||
if (game_get_kind() == GAMEKIND_SINGLE) {
|
||||
fast_ms = WORLD_TRACKER_UPDATE_FAST_MS;
|
||||
normal_ms = WORLD_TRACKER_UPDATE_NORMAL_MS;
|
||||
slow_ms = WORLD_TRACKER_UPDATE_SLOW_MS;
|
||||
}
|
||||
#endif
|
||||
|
||||
world_tracker_update(0, fast_ms, 1);
|
||||
world_tracker_update(1, normal_ms, 2);
|
||||
|
|
|
@ -27,6 +27,9 @@ void IntegratePositions(ecs_iter_t *it) {
|
|||
Velocity *v = ecs_field(it, Velocity, 2);
|
||||
|
||||
for (int i = 0; i < it->count; i++) {
|
||||
if (ecs_get(it->world, it->entities[i], IsInVehicle)) {
|
||||
continue;
|
||||
}
|
||||
if (zpl_abs(v[i].x) >= 0.001f || zpl_abs(v[i].y) >= 0.001f) {
|
||||
// NOTE(zaklaus): world bounds
|
||||
{
|
||||
|
@ -129,6 +132,9 @@ void ApplyWorldDragOnVelocity(ecs_iter_t *it) {
|
|||
|
||||
for (int i = 0; i < it->count; i++) {
|
||||
if (zpl_abs(v[i].x) < 0.001f && zpl_abs(v[i].y) < 0.001f) continue;
|
||||
if (ecs_get(it->world, it->entities[i], IsInVehicle)) {
|
||||
continue;
|
||||
}
|
||||
world_block_lookup lookup = world_block_from_realpos(p[i].x, p[i].y);
|
||||
float drag = zpl_clamp(blocks_get_drag(lookup.bid), 0.0f, 1.0f);
|
||||
float friction = blocks_get_friction(lookup.bid);
|
||||
|
|
|
@ -156,7 +156,7 @@ void VehicleHandling(ecs_iter_t *it) {
|
|||
// NOTE(zaklaus): Update passenger position
|
||||
{
|
||||
Velocity *v2 = ecs_get_mut(it->world, pe, Velocity);
|
||||
entity_set_position(pe, p[i].x+v[i].x, p[i].y+v[i].y);
|
||||
entity_set_position(pe, p[i].x, p[i].y);
|
||||
*v2 = v[i];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue