Optimize prediction steps, add slider for amount of steps
This commit is contained in:
parent
39053dae45
commit
2de0387d9c
@ -15,7 +15,6 @@
|
|||||||
<AutoVariable width="fill" target="debug.ve.smooth" label="VE smooth"/>
|
<AutoVariable width="fill" target="debug.ve.smooth" label="VE smooth"/>
|
||||||
<AutoVariable width="fill" target="debug.ve.window" label="VE window"/>
|
<AutoVariable width="fill" target="debug.ve.window" label="VE window"/>
|
||||||
<AutoVariable width="fill" target="aimbot.debug" label="Debug aimbot"/>
|
<AutoVariable width="fill" target="aimbot.debug" label="Debug aimbot"/>
|
||||||
<AutoVariable width="fill" target="aimbot.debug.engine-pp" label="Debug engine PP"/>
|
|
||||||
</List>
|
</List>
|
||||||
</Box>
|
</Box>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
<AutoVariable width="fill" target="debug.ve.smooth" label="VE smooth"/>
|
<AutoVariable width="fill" target="debug.ve.smooth" label="VE smooth"/>
|
||||||
<AutoVariable width="fill" target="debug.ve.window" label="VE window"/>
|
<AutoVariable width="fill" target="debug.ve.window" label="VE window"/>
|
||||||
<AutoVariable width="fill" target="aimbot.debug" label="Debug aimbot"/>
|
<AutoVariable width="fill" target="aimbot.debug" label="Debug aimbot"/>
|
||||||
<AutoVariable width="fill" target="aimbot.debug.engine-pp" label="Debug engine PP"/>
|
|
||||||
</List>
|
</List>
|
||||||
</Box>
|
</Box>
|
||||||
<Box height="content" width="content" padding="12 6 6 6" name="Cathook" x="215">
|
<Box height="content" width="content" padding="12 6 6 6" name="Cathook" x="215">
|
||||||
|
@ -25,7 +25,9 @@
|
|||||||
<Box padding="12 6 6 6" width="content" height="content" name="Projectile aimbot" y="210">
|
<Box padding="12 6 6 6" width="content" height="content" name="Projectile aimbot" y="210">
|
||||||
<List width="150">
|
<List width="150">
|
||||||
<AutoVariable width="fill" target="aimbot.projectile.enable" label="Enable projectile aimbot"/>
|
<AutoVariable width="fill" target="aimbot.projectile.enable" label="Enable projectile aimbot"/>
|
||||||
|
<AutoVariable width="fill" target="aimbot.debug.engine-pp" label="Engine prediction"/>
|
||||||
<AutoVariable width="fill" target="misc.auto-flip-viewmodel" label="Flip viewmodel" tooltip="Automatically flip the viewmodel for projectile weapons."/>
|
<AutoVariable width="fill" target="misc.auto-flip-viewmodel" label="Flip viewmodel" tooltip="Automatically flip the viewmodel for projectile weapons."/>
|
||||||
|
<AutoVariable width="fill" target="debug.pp-steps" label="Prediction steps" min="1" max="300"/>
|
||||||
<AutoVariable width="fill" target="aimbot.projectile.gravity" label="Gravity override"/>
|
<AutoVariable width="fill" target="aimbot.projectile.gravity" label="Gravity override"/>
|
||||||
<AutoVariable width="fill" target="aimbot.projectile.initial-velocity" label="Initial velocity"/>
|
<AutoVariable width="fill" target="aimbot.projectile.initial-velocity" label="Initial velocity"/>
|
||||||
<AutoVariable width="fill" target="aimbot.projectile.speed" label="Velocity override"/>
|
<AutoVariable width="fill" target="aimbot.projectile.speed" label="Velocity override"/>
|
||||||
|
@ -17,6 +17,7 @@ extern settings::Boolean engine_projpred;
|
|||||||
static settings::Boolean debug_pp_extrapolate{ "debug.pp-extrapolate", "false" };
|
static settings::Boolean debug_pp_extrapolate{ "debug.pp-extrapolate", "false" };
|
||||||
static settings::Boolean debug_pp_draw{ "debug.pp-draw", "false" };
|
static settings::Boolean debug_pp_draw{ "debug.pp-draw", "false" };
|
||||||
static settings::Boolean debug_pp_draw_engine{ "debug.pp-draw.engine", "false" };
|
static settings::Boolean debug_pp_draw_engine{ "debug.pp-draw.engine", "false" };
|
||||||
|
static settings::Int debug_pp_steps{ "debug.pp-steps", "66" };
|
||||||
// The higher the sample size, the more previous positions we will take into account to calculate the next position. Lower = Faster reaction Higher = Stability
|
// The higher the sample size, the more previous positions we will take into account to calculate the next position. Lower = Faster reaction Higher = Stability
|
||||||
static settings::Int sample_size("debug.strafepred.samplesize", "10");
|
static settings::Int sample_size("debug.strafepred.samplesize", "10");
|
||||||
// TODO there is a Vector() object created each call.
|
// TODO there is a Vector() object created each call.
|
||||||
@ -516,18 +517,16 @@ std::pair<Vector, Vector> ProjectilePrediction_Engine(CachedEntity *ent, int hb,
|
|||||||
if (speed == 0.0f || !sv_gravity)
|
if (speed == 0.0f || !sv_gravity)
|
||||||
return { Vector(), Vector() };
|
return { Vector(), Vector() };
|
||||||
|
|
||||||
// TODO ProjAim
|
float currenttime = g_pLocalPlayer->v_Eye.DistTo(hitbox) / speed - 1.5f;
|
||||||
float medianTime = g_pLocalPlayer->v_Eye.DistTo(hitbox) / speed;
|
|
||||||
float range = 1.5f;
|
|
||||||
float currenttime = medianTime - range;
|
|
||||||
if (currenttime <= 0.0f)
|
if (currenttime <= 0.0f)
|
||||||
currenttime = 0.01f;
|
currenttime = 0.01f;
|
||||||
|
|
||||||
float besttime = currenttime;
|
float besttime = currenttime;
|
||||||
float mindelta = 65536.0f;
|
float mindelta = 65536.0f;
|
||||||
Vector bestpos = origin;
|
Vector bestpos = origin;
|
||||||
Vector current = origin;
|
Vector current = origin;
|
||||||
Vector current_velocity = velocity;
|
Vector current_velocity = velocity;
|
||||||
int maxsteps = std::max(40.0f, 2.0f * range / g_GlobalVars->interval_per_tick);
|
int maxsteps = (int) debug_pp_steps;
|
||||||
float steplength = g_GlobalVars->interval_per_tick;
|
float steplength = g_GlobalVars->interval_per_tick;
|
||||||
|
|
||||||
Vector ent_mins = RAW_ENT(ent)->GetCollideable()->OBBMins();
|
Vector ent_mins = RAW_ENT(ent)->GetCollideable()->OBBMins();
|
||||||
@ -540,18 +539,19 @@ std::pair<Vector, Vector> ProjectilePrediction_Engine(CachedEntity *ent, int hb,
|
|||||||
CE_VECTOR(ent, 0x354) = current;
|
CE_VECTOR(ent, 0x354) = current;
|
||||||
current = EnginePrediction(ent, steplength, ¤t_velocity);
|
current = EnginePrediction(ent, steplength, ¤t_velocity);
|
||||||
|
|
||||||
// Apply velocity
|
// Apply velocity if not touching the ground
|
||||||
if (DistanceToGround(current, ent_mins, ent_maxs) > 0.0f)
|
if (!(CE_INT(ent, netvar.iFlags) & (1 << 0)))
|
||||||
current_velocity.z -= sv_gravity->GetFloat() * entgmod * steplength;
|
current_velocity.z -= sv_gravity->GetFloat() * entgmod * steplength;
|
||||||
|
|
||||||
float rockettime = g_pLocalPlayer->v_Eye.DistTo(current) / speed;
|
float rockettime = g_pLocalPlayer->v_Eye.DistTo(current) / speed;
|
||||||
// Compensate for ping
|
// Compensate for ping
|
||||||
rockettime += g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + cl_interp->GetFloat();
|
rockettime += g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + cl_interp->GetFloat();
|
||||||
if (fabs(rockettime - currenttime) < mindelta)
|
float timedelta = fabs(rockettime - currenttime);
|
||||||
|
if (timedelta < mindelta)
|
||||||
{
|
{
|
||||||
besttime = currenttime;
|
besttime = currenttime;
|
||||||
bestpos = current;
|
bestpos = current;
|
||||||
mindelta = fabs(rockettime - currenttime);
|
mindelta = timedelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// logging::Info("besttime: %f, currenttime: %f, old currenttime: %f", besttime, currenttime, currenttime - steplength * maxsteps);
|
// logging::Info("besttime: %f, currenttime: %f, old currenttime: %f", besttime, currenttime, currenttime - steplength * maxsteps);
|
||||||
@ -573,11 +573,6 @@ std::pair<Vector, Vector> BuildingPrediction(CachedEntity *building, Vector vec,
|
|||||||
if (!vec.z || CE_BAD(building))
|
if (!vec.z || CE_BAD(building))
|
||||||
return { Vector(), Vector() };
|
return { Vector(), Vector() };
|
||||||
Vector result = vec;
|
Vector result = vec;
|
||||||
// if (not debug_pp_extrapolate) {
|
|
||||||
//} else {
|
|
||||||
// result = SimpleLatencyPrediction(ent, hb);
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (!sv_gravity)
|
if (!sv_gravity)
|
||||||
sv_gravity = g_ICvar->FindVar("sv_gravity");
|
sv_gravity = g_ICvar->FindVar("sv_gravity");
|
||||||
@ -587,36 +582,16 @@ std::pair<Vector, Vector> BuildingPrediction(CachedEntity *building, Vector vec,
|
|||||||
|
|
||||||
trace::filter_no_player.SetSelf(RAW_ENT(building));
|
trace::filter_no_player.SetSelf(RAW_ENT(building));
|
||||||
|
|
||||||
// TODO ProjAim
|
// Buildings do not move. We don't need to do any steps here
|
||||||
float medianTime = g_pLocalPlayer->v_Eye.DistTo(result) / speed;
|
float time = g_pLocalPlayer->v_Eye.DistTo(result) / speed;
|
||||||
float range = 1.5f;
|
|
||||||
float currenttime = medianTime - range;
|
|
||||||
if (currenttime <= 0.0f)
|
|
||||||
currenttime = 0.01f;
|
|
||||||
float besttime = currenttime;
|
|
||||||
float mindelta = 65536.0f;
|
|
||||||
Vector bestpos = result;
|
|
||||||
int maxsteps = 300;
|
|
||||||
for (int steps = 0; steps < maxsteps; steps++, currenttime += ((float) (2 * range) / (float) maxsteps))
|
|
||||||
{
|
|
||||||
Vector curpos = result;
|
|
||||||
float rockettime = g_pLocalPlayer->v_Eye.DistTo(curpos) / speed;
|
|
||||||
// Compensate for ping
|
// Compensate for ping
|
||||||
rockettime += g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + cl_interp->GetFloat();
|
time += g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + cl_interp->GetFloat();
|
||||||
if (fabs(rockettime - currenttime) < mindelta)
|
|
||||||
{
|
result.z += (sv_gravity->GetFloat() / 2.0f * time * time * gravity);
|
||||||
besttime = currenttime;
|
Vector result_initialvel = result;
|
||||||
bestpos = curpos;
|
result_initialvel.z -= proj_startvelocity * time;
|
||||||
mindelta = fabs(rockettime - currenttime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Compensate for ping
|
|
||||||
besttime += g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + cl_interp->GetFloat();
|
|
||||||
bestpos.z += (sv_gravity->GetFloat() / 2.0f * besttime * besttime * gravity);
|
|
||||||
Vector bestpos_initialvel = bestpos;
|
|
||||||
bestpos_initialvel.z -= proj_startvelocity * besttime;
|
|
||||||
// S = at^2/2 ; t = sqrt(2S/a)*/
|
// S = at^2/2 ; t = sqrt(2S/a)*/
|
||||||
return { bestpos, bestpos_initialvel };
|
return { result, result_initialvel };
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<Vector, Vector> ProjectilePrediction(CachedEntity *ent, int hb, float speed, float gravitymod, float entgmod, float proj_startvelocity)
|
std::pair<Vector, Vector> ProjectilePrediction(CachedEntity *ent, int hb, float speed, float gravitymod, float entgmod, float proj_startvelocity)
|
||||||
@ -642,7 +617,7 @@ std::pair<Vector, Vector> ProjectilePrediction(CachedEntity *ent, int hb, float
|
|||||||
float mindelta = 65536.0f;
|
float mindelta = 65536.0f;
|
||||||
Vector bestpos = origin;
|
Vector bestpos = origin;
|
||||||
Vector current = origin;
|
Vector current = origin;
|
||||||
int maxsteps = 40;
|
int maxsteps = (int) debug_pp_steps;
|
||||||
bool onground = false;
|
bool onground = false;
|
||||||
if (ent->m_Type() == ENTITY_PLAYER)
|
if (ent->m_Type() == ENTITY_PLAYER)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user