Skip to content

Commit 8682462

Browse files
committed
feat: sar_trace_vphys_record option
in INFRA (120 tickrate) this can heavily lag the game when recording a trace, so here's an option to disable it. you may also want to disable bbox ent record. and games without portals now don't try to record the portals
1 parent ca983b2 commit 8682462

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

docs/cvars.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@
665665
|sar_trace_teleport_at|cmd|sar_trace_teleport_at \<tick> [player slot] [trace name] - teleports the player at the given trace tick on the given trace ID (defaults to hovered one or the first one ever made) in the given slot (defaults to 0).|
666666
|sar_trace_teleport_eye|cmd|sar_trace_teleport_eye \<tick> [player slot] [trace name] - teleports the player to the eye position at the given trace tick on the given trace (defaults to hovered one or the first one ever made) in the given slot (defaults to 0).|
667667
|sar_trace_use_shot_eyeoffset|1|Uses eye offset and angles accurate for portal shooting.|
668+
|sar_trace_vphys_record|1|Record vphysics locations of dynamic entities for analysis.|
668669
|sar_transition_timer|0|Output how slow your dialogue fade was.|
669670
|sar_twitch_chat_channel||The Twitch channel to connect to.|
670671
|sar_twitch_chat_color|255 255 255|The color of the Twitch chat messages.|

src/Features/PlayerTrace.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Variable sar_trace_draw_time("sar_trace_draw_time", "3", 0, 3,
3737
);
3838
Variable sar_trace_font_size("sar_trace_font_size", "3.0", 0.1, "The size of text overlaid on recorded traces.\n");
3939

40+
Variable sar_trace_vphys_record("sar_trace_vphys_record", "1", 0, 1, "Record vphysics locations of dynamic entities for analysis.\n");
41+
4042
Variable sar_trace_bbox_at("sar_trace_bbox_at", "-1", -1, "Display a player-sized bbox at the given tick.\n");
4143
Variable sar_trace_bbox_use_hover("sar_trace_bbox_use_hover", "0", 0, 1, "Move trace bbox to hovered trace point tick on given trace.\n");
4244
Variable sar_trace_bbox_ent_record("sar_trace_bbox_ent_record", "1", "Record hitboxes of nearby entities in the trace. You may want to disable this if memory consumption gets too high.\n");
@@ -665,6 +667,7 @@ HitboxList PlayerTrace::ConstructHitboxList(Vector center) const {
665667
}
666668

667669
VphysLocationList PlayerTrace::ConstructVphysLocationList() const {
670+
if (!sar_trace_vphys_record.GetBool()) return VphysLocationList{};
668671
VphysLocationList locationList;
669672

670673
for (int i = 0; i < Offsets::NUM_ENT_ENTRIES; ++i) {
@@ -709,6 +712,11 @@ VphysLocationList PlayerTrace::ConstructVphysLocationList() const {
709712

710713
PortalLocations PlayerTrace::ConstructPortalLocations() const {
711714
if (!sar_trace_portal_record.GetBool()) return PortalLocations{};
715+
if (sar.game->Is(SourceGame_BeginnersGuide | SourceGame_StanleyParable | SourceGame_INFRA)) {
716+
// Portals are not present in these games
717+
// Let's not loop through every single entity every tick
718+
return PortalLocations{};
719+
}
712720

713721
PortalLocations portals;
714722

0 commit comments

Comments
 (0)