The pod can drive a scripted lap
RP412INPUTSCRIPT names a timeline file - one row per change, throttle, stick X and Y, pedals, held until the next row's time - and the pod drives it instead of listening to the controls. Times are SIMULATION seconds from the green light, evaluated per step in the one place every mapper funnels through (VTVControlsMapper::InterpretControls), so the same script is the same lap at any frame rate. Rows hold rather than interpolate on purpose: interpolation would sample differently at different physics rates, and nothing on this path is allowed to. The script shares the green-light anchor with RP412PHYSTRACE - its clock starts at the instant the vehicle is stopped dead - because a timeline that starts when the loader happens to finish is a different lap every run. A race is only deterministic if somebody DRIVES it, and a human cannot drive the same lap twice. The first scripted lap - full throttle, a steer, a crash at speed - earned the harness immediately: - The drive, the crash, the death and the respawn teleport were all BIT-EXACT between identical runs, through t=13.5. Collisions with world geometry and the damage path are step-deterministic, which is better news than the code reading suggested. - The first divergence is the step AFTER the respawn: the DropZoneReply that stands a dead pod back up is posted at wall-clock Now()+1.0 (RPPLAYER.cpp), so the reset lands on a different sim step every run and everything after is time-shifted. The crash is deterministic; the RECOVERY is not. That is the next fix, and it is now a measurement, not a theory. Values are clamped at load, once and visibly, so a script asking for throttle 2.0 cannot trip the mapper's own range Verifies. Off unless the environment names a file; it would be a cheat in a real race. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "vtvpwr.h"
|
||||
#include "..\munga\icom.h"
|
||||
#include "..\munga\app.h"
|
||||
#include "..\munga\inputscript.h"
|
||||
#include "rpplayer.h"
|
||||
#include "vtv.h"
|
||||
|
||||
@@ -414,6 +415,36 @@ void
|
||||
VTVPower *power_system =
|
||||
Cast_Object(VTVPower*, vtv->GetSubsystem(VTV::PowerSubsystem));
|
||||
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
// RP412INPUTSCRIPT: scripted driving, on this subsystem's own step
|
||||
// clock.
|
||||
//
|
||||
// This is the one place every mapper - RIO, Thrustmaster, pad -
|
||||
// funnels through, and it runs per SIMULATION STEP, so a scripted
|
||||
// value lands on the same step of every run whatever the frame
|
||||
// rate. Overriding at the RIO or the controls manager would key
|
||||
// the timeline to the frame loop, which is wall clock, which is
|
||||
// the thing the whole harness exists to keep out of the physics.
|
||||
//
|
||||
// Only the player's own vehicle: replicants get their state from
|
||||
// the network, and the mapper does not run for them anyway.
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
if (RPInputScript_Active())
|
||||
{
|
||||
float script_throttle, script_x, script_y, script_pedals;
|
||||
|
||||
if (RPInputScript_Sample(GetLastPerformance(),
|
||||
&script_throttle, &script_x, &script_y, &script_pedals))
|
||||
{
|
||||
throttlePosition = script_throttle;
|
||||
stickPosition.x = script_x;
|
||||
stickPosition.y = script_y;
|
||||
pedalsPosition = script_pedals;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//----------------------------------------------
|
||||
// Make sure the control inputs are within range
|
||||
|
||||
Reference in New Issue
Block a user