Tinker with physics again

This commit is contained in:
Miloslav Ciz 2025-04-23 16:55:34 +02:00
parent b4aa9cd867
commit 0e694589eb
4 changed files with 52 additions and 23 deletions

View file

@ -1,5 +1,7 @@
=========== GENERAL ==============
- when non-rotating, the car is very fast, allowing uberbugs: find out why and
fix
- fix the ramp map again due to new physics
- should drifting make a sound?
- keyboard ghosting is an issue, particularly when initiating drift with brake
@ -51,13 +53,21 @@
- something with multiple finishes DONE
- U-ramp to build speed and jump up to catch a CP (done) DONE
- jump through air ring with CP DONE
- test:
- long replay
- replay stretching works
- replay validation?
- final tests:
- very long replay
- different resolutions
- different settings (332, POTATO, ...)
- crazy shit with physics
- replay with input not occuring for more that LCR_SETTING_GHOST_STEP
- replay validation
- at the end check error handling, make sure the game handles garbage data in
resource file etc.
- different platforms
- error handling (bad map format, bad replay format, items in data file, ...)
- valgrind, cppcheck, different compilers, optimization levels, ...
- play replay from one platform on another
- play all maps a lot
- correct saving or replays etc
- empty and large data file
- FPS on each platform
=========== BUGS =================

2
data
View file

@ -144,3 +144,5 @@ details
#RLCtiny4;00LCtiny4;1787f12a 0000267:0221:0093:0091:00b3:0041:0033:0031:0043:0041:0033:0051:0063:01e2:00a3:00d1:0065:0059:0051:0043:0031:0063:00e1:0163:0031
#BLCtiny4;
#RLCtiny4;00LCtiny4;1787f12a 0000184:0011:00c9:0071:0133:0051:0073:00e1:0033:00f1:0053:00a1:0063:0071:0123:0041
#RLCtiny1;00LCtiny1;7e39e006 0000347:0011:0319:0031:0169:0041:0159:00b1:01e3:0071:0073:0021:0043:0051:0095:0033:01a1:0073:0031:0063:0031:0363:0161:00f3:0091:0089:0031
#BLCtiny1;

View file

@ -263,6 +263,11 @@ changes to the source code. This is inspired by suckless programs.
TODO
~~~~~ CREDITS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Everything was created by drummyfish. Special thanks goes to my friends Blitz
and Ramon for help with testing <3
~~~~~ FAQ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: Is this game really free? Do I have to pay for it? What can I legally do with

View file

@ -57,8 +57,8 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit
#define LCR_PHYSICS_UNIT 4096 ///< len. of square for phys. engine
#define TPE_RESHAPE_TENSION_LIMIT 3
#define TPE_RESHAPE_ITERATIONS 7 /**< Empirically tested, seems to have a
#define TPE_RESHAPE_TENSION_LIMIT 8
#define TPE_RESHAPE_ITERATIONS 16 /**< Empirically tested, seems to have a
big impact on bugs that happen when
driving onto a curved ramp under
various angles. */
@ -1128,17 +1128,23 @@ void _LCR_racingWheelAccelerate(unsigned int wheel, TPE_Vec3 dir,
int _LCR_racingCarShapeOK(void)
{
int r = 1;
TPE_Unit bodyTension = 0;
TPE_Connection *c = LCR_racing.carConnections;
for (int i = 0; i < LCR_racing.carBody.jointCount; ++i)
r &= TPE_connectionTension(TPE_dist(
LCR_racing.carBody.joints[
LCR_racing.carBody.connections[i].joint1].position,
LCR_racing.carBody.joints[
LCR_racing.carBody.connections[i].joint2].position),
LCR_racing.carBody.connections[i].length) < TPE_F / 16; // 16: magic con.
for (int i = 0; i < LCR_CAR_CONNECTIONS; ++i) // joint tension
{
bodyTension += TPE_abs(
TPE_connectionTension(
TPE_LENGTH(
TPE_vec3Minus(
LCR_racing.carJoints[c->joint1].position,
LCR_racing.carJoints[c->joint2].position)),
c->length));
return r;
c++;
}
return (bodyTension / LCR_CAR_CONNECTIONS) <= TPE_RESHAPE_TENSION_LIMIT;
}
/**
@ -1444,12 +1450,10 @@ uint32_t LCR_racingStep(unsigned int input)
TPE_Joint joints[LCR_CAR_JOINTS];
if (_LCR_racingCarShapeOK()) // in rare cases this may not hold
LCR_racing.carBody.flags |= TPE_BODY_FLAG_NONROTATING;
else
{
LCR_LOG1("car not OK in non-rotating step");
}
if (!_LCR_racingCarShapeOK())
printf("NOT OOOOOOOOOOOK\n");
LCR_racing.carBody.flags |= TPE_BODY_FLAG_NONROTATING;
for (int i = 0; i < LCR_CAR_JOINTS; ++i)
joints[i] = LCR_racing.carBody.joints[i];
@ -1479,7 +1483,15 @@ uint32_t LCR_racingStep(unsigned int input)
if ((LCR_racing.carBody.flags & TPE_BODY_FLAG_UNRESOLVED) ||
!_LCR_racingCarShapeOK())
{
printf("SASASASSASASASASASASSAS\n");
TPE_bodyStop(&LCR_racing.carBody);
for (int k = 0; k < 2 * TPE_RESHAPE_ITERATIONS; ++k)
TPE_bodyReshape(&LCR_racing.carBody,_LCR_racingEnvironmentFunction);
}
}
}