Improve overall motion + single-player now pushes out fast layer as fast as possible

isolation_bkp/dynres
Dominik Madarász 2021-10-27 15:14:46 +02:00
parent a607515424
commit a589845065
4 changed files with 57 additions and 55 deletions

View File

@ -1,9 +1,10 @@
#include "zpl.h"
#include "camera.h"
#include "platform.h"
#include "entity_view.h"
#include "game.h"
#define CAMERA_LERP_FACTOR 0.13
#define CAMERA_LERP_FACTOR 11.2f
static camera main_camera;
@ -20,9 +21,10 @@ void camera_update(void) {
if (!world) break;
entity_view *view = entity_view_get(&world->entities, main_camera.ent_id);
if (!view) break;
float smooth_ms = zpl_clamp((float)platform_frametime(), 0.0f, 1.0f);
main_camera.x = zpl_lerp(main_camera.x, view->x, CAMERA_LERP_FACTOR);
main_camera.y = zpl_lerp(main_camera.y, view->y, CAMERA_LERP_FACTOR);
main_camera.x = zpl_lerp(main_camera.x, view->x, CAMERA_LERP_FACTOR*smooth_ms);
main_camera.y = zpl_lerp(main_camera.y, view->y, CAMERA_LERP_FACTOR*smooth_ms);
if (main_camera.first_time) {
main_camera.first_time = false;

View File

@ -4,8 +4,8 @@
#include "world/world.h"
#include "game.h"
#define PREDICT_SMOOTH_FACTOR_LO 10.5
#define PREDICT_SMOOTH_FACTOR_HI 20.5
#define PREDICT_SMOOTH_FACTOR_LO 7.5
#define PREDICT_SMOOTH_FACTOR_HI 12.5
static inline float map_factor(float x) {
x = 1.0f - zpl_clamp01(x);
@ -69,7 +69,7 @@ void predict_receive_update(entity_view *d, entity_view *data) {
data->tran_time = d->tran_time;
}
#define ENTITY_DO_LERP_SP 1
#define ENTITY_DO_LERP_SP 0
void lerp_entity_positions(uint64_t key, entity_view *data) {
(void)key;

View File

@ -15,7 +15,7 @@
#define WORLD_LAYERING 0
#define WORLD_TRACKER_LAYERS 3
#define WORLD_TRACKER_UPDATE_FAST_MS 10
#define WORLD_TRACKER_UPDATE_FAST_MS 0
#define WORLD_TRACKER_UPDATE_NORMAL_MS 50
#define WORLD_TRACKER_UPDATE_SLOW_MS 100
#define WORLD_TRACKER_UPDATE_MP_FAST_MS 50

View File

@ -82,7 +82,7 @@ void EnterVehicle(ecs_iter_t *it) {
#define VEHICLE_DECEL 0.28f
#define VEHICLE_STEER 9.89f
#define VEHICLE_STEER_REVERT 6.0941816f
#define VEHICLE_POWER 34.89f
#define VEHICLE_POWER 97.89f
#define VEHICLE_BRAKE_FORCE 0.84f
void VehicleHandling(ecs_iter_t *it) {