From e14a5184ced1d3d1b2615e3aeca5a9a096b6725e Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Fri, 6 Dec 2024 00:18:06 +0100 Subject: [PATCH] Tune car params --- assets.h | 2 +- racing.h | 29 +++++++++++++++++++++-------- renderer.h | 4 ++-- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/assets.h b/assets.h index 6701581..8da4834 100644 --- a/assets.h +++ b/assets.h @@ -18,7 +18,7 @@ static const char *LCR_maps[] = { - "LM;;;0;#*s1s0" + "LM;;;0;#*H1k0J" "#=s0s0 #fd190" // big concrete "#=s0B0 #fd910" // concrete wall diff --git a/racing.h b/racing.h index 5101927..0c90396 100644 --- a/racing.h +++ b/racing.h @@ -21,8 +21,8 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit #define LCR_PHYSICS_UNIT 4096 ///< length of map square for physics engine -#define TPE_RESHAPE_TENSION_LIMIT 10 -#define TPE_RESHAPE_ITERATIONS 5 +#define TPE_RESHAPE_TENSION_LIMIT 3 +#define TPE_RESHAPE_ITERATIONS 8 #include "map.h" #include "tinyphysicsengine.h" @@ -30,16 +30,15 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit // TODO: move some of this to constants? #define LCR_GRAVITY (LCR_PHYSICS_UNIT / 160) + #define LCR_CAR_FORWARD_FRICTION (TPE_F / 180) #define LCR_CAR_AIR_FRICTION 32 - #define LCR_CAR_STAND_FRICTION_MULTIPLIER 32 #define LCR_CAR_STEER_FRICTION (TPE_F) #define LCR_CAR_ELASTICITY (TPE_F / 150) -#define LCR_CAR_ACCELERATION (LCR_PHYSICS_UNIT / 20) - -#define LCR_CAR_STEER_SPEED (LCR_GAME_UNIT / 16) -#define LCR_CAR_STEER_MAX ((7 * LCR_GAME_UNIT) / 24) +#define LCR_CAR_ACCELERATION (LCR_PHYSICS_UNIT / 19) +#define LCR_CAR_STEER_SPEED (LCR_GAME_UNIT / 17) +#define LCR_CAR_STEER_MAX (LCR_GAME_UNIT / 2) // multipliers (in 8ths) of friction and acceleration on concrete: #define LCR_CAR_GRASS_FACTOR 5 @@ -637,6 +636,20 @@ uint32_t LCR_racingStep(unsigned int input) { LCR_LOG2("racing step start"); +/* +for (int i = 0; i < LCR_CAR_JOINTS; ++i) + printf(" %d: %d %d %d, %d %d %d\n", + i,LCR_racing.carBody.joints[i].position.x, + LCR_racing.carBody.joints[i].position.y, + LCR_racing.carBody.joints[i].position.z, + LCR_racing.carBody.joints[i].velocity[0], + LCR_racing.carBody.joints[i].velocity[1], + LCR_racing.carBody.joints[i].velocity[0]); + +printf("------\n"); +*/ + + uint32_t result = 0; TPE_Vec3 carForw, carRight, carUp, carVel; uint8_t groundMat = LCR_BLOCK_MATERIAL_CONCRETE; // material under wheels @@ -726,7 +739,7 @@ uint32_t LCR_racingStep(unsigned int input) { LCR_GameUnit rotateBy = (LCR_racing.wheelCollisions & 0x0f) ? // on ground slow down wheel rot. - (LCR_racingGetCarSpeedUnsigned() / 16) : LCR_GAME_UNIT / 32; + (LCR_racingGetCarSpeedUnsigned() / 8) : LCR_GAME_UNIT / 32; if (!(input & LCR_RACING_INPUT_BACK)) rotateBy *= -1; diff --git a/renderer.h b/renderer.h index 646ab38..1bdd91e 100644 --- a/renderer.h +++ b/renderer.h @@ -1446,12 +1446,12 @@ void _LCR_rendererAnimateCar(void) LCR_renderer.animatedCarVerts[index + 2] -= (LCR_renderer.animatedCarVerts[index] * LCR_renderer.wheelSteer) - / (8 * S3L_F); + / (16 * S3L_F); //(8 * S3L_F); LCR_renderer.animatedCarVerts[index] += ((LCR_renderer.animatedCarVerts[index + 2] - LCR_renderer.wheelRotationCenters[2]) * LCR_renderer.wheelSteer) - / (2 * S3L_F); + / (4 * S3L_F); //(2 * S3L_F); } } }