Difference between revisions of "S PreserveEnts"

From Valve Developer Community
Jump to: navigation, search
(stub-ed it)
m ({{l4d}} Left 4 Dead: removed confusing note)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{stub}}
 
{{stub}}
 
{{DISPLAYTITLE:s_PreserveEnts}}
 
{{DISPLAYTITLE:s_PreserveEnts}}
In multiplayer Source games, when a round is reset in some way, all entities are deleted and then respawned to quickly reset the map. However, a list of entities to ''not'' reset exists. Usually these entities have special code to handle the resetting process. The {{ent|player}} entity for example, should not ever be erased unless the client disconnects from the server.
+
In multiplayer Source games, during a round reset, all entities are resetted to their defaults by being deleted then respawned, unless their current classnames matches an entry in the whitelist '''s_PreserveEnts'''. Whitelisted entities either has special code to handle the resetting process, and isn't ideal to be deleted.
  
Some entities in this list however, do not have any code for handling round resets, so when the reset occurs, those entities will behave in unwanted ways as they have carried over all their properties (including position) from the last round.
+
Some whitelist entities however don't account round resets properly with their new behavior, so when a round reset occurs, their properties are carried over from the last round, like their [[origin]]s.
  
{{todo|Attempt to finish this table. Some games might not have any way to reset the round (even through mp_forcewin or mp_restartgame).}}
+
{{todo|Attempt to finish this table. Some games might not have any way to reset the round (even through<code>mp_forcewin</code>or<code>mp_restartgame</code>commands).}}
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! !{{pergame}}
+
! Games
 +
!{{as}}
 +
!{{csgo}}
 +
!{{css}}
 +
!{{dods}}
 +
!{{hl2}}
 +
!{{hl2dm}}
 +
!{{ep1}}
 +
!{{ep2}}
 +
!{{l4d}}
 +
!{{l4d2}}
 +
!{{portal}}
 +
!{{portal2}}
 +
!{{tf2}}
 
|-
 
|-
|Affects:
+
|'''Has Whitelist'''
 +
||{{style|color:green|Yes}}
 
||{{style|color:green|Yes}}
 
||{{style|color:green|Yes}}
||{{style|color:yellow|Unsure}}
 
 
||{{style|color:green|Yes}}
 
||{{style|color:green|Yes}}
 
||{{style|color:green|Yes}}
 
||{{style|color:green|Yes}}
||N/A
+
||{{style|color:yellowgreen|No}}
 
||{{style|color:green|Yes}}
 
||{{style|color:green|Yes}}
||N/A
+
||{{style|color:yellowgreen|No}}
||N/A
+
||{{style|color:yellowgreen|No}}
||{{style|color:yellow|Unsure}}
+
||{{style|color:orange|From code dump}}
||{{style|color:yellow|Unsure}}
+
||{{style|color:orange|From code dump}}
 
||{{style|color:green|Yes}}
 
||{{style|color:green|Yes}}
 
||{{style|color:yellow|Unsure}}
 
||{{style|color:yellow|Unsure}}
Line 26: Line 39:
 
|}
 
|}
  
=={{hl2}}hl2mp/hl2mp_gamerules.cpp==
+
== Source Code ==
<pre>
+
==={{hl2}}hl2mp/hl2mp_gamerules.cpp===
 +
{{ExpandBox|
 +
<syntaxhighlight lang="cpp">
 
static const char *s_PreserveEnts[] =
 
static const char *s_PreserveEnts[] =
 
{
 
{
Line 70: Line 85:
 
"", // END Marker
 
"", // END Marker
 
};
 
};
</pre>
+
</syntaxhighlight>
 +
}}
  
=={{portal}}portal/portal_mp_gamerules.cpp==
+
==={{portal}}portal/portal_mp_gamerules.cpp===
<pre>
+
{{ExpandBox|
 +
<syntaxhighlight lang="cpp">
 
static const char *s_PreserveEnts[] =
 
static const char *s_PreserveEnts[] =
 
{
 
{
Line 116: Line 133:
 
"", // END Marker
 
"", // END Marker
 
};
 
};
</pre>
+
</syntaxhighlight>
 +
}}
  
=={{tf2}}tf/tf_gamerules.cpp==
+
==={{tf2}}tf/tf_gamerules.cpp===
<pre>
+
{{ExpandBox|
 +
<syntaxhighlight lang="cpp">
 
static const char *s_PreserveEnts[] =
 
static const char *s_PreserveEnts[] =
 
{
 
{
 +
"player",
 +
"viewmodel",
 +
"worldspawn",
 +
"soundent",
 +
"ai_network",
 +
"ai_hint",
 +
"env_soundscape",
 +
"env_soundscape_proxy",
 +
"env_soundscape_triggerable",
 +
"env_sprite",
 +
"env_sun",
 +
"env_wind",
 +
"env_fog_controller",
 +
"func_wall",
 +
"func_illusionary",
 +
"info_node",
 +
"info_target",
 +
"info_node_hint",
 +
"point_commentary_node",
 +
"point_viewcontrol",
 +
"func_precipitation",
 +
"func_team_wall",
 +
"shadow_control",
 +
"sky_camera",
 +
"scene_manager",
 +
"trigger_soundscape",
 +
"commentary_auto",
 +
"point_commentary_node",
 +
"point_commentary_viewpoint",
 +
"bot_roster",
 +
"info_populator",
 
"tf_gamerules",
 
"tf_gamerules",
 
"tf_team_manager",
 
"tf_team_manager",
Line 129: Line 179:
 
"keyframe_rope",
 
"keyframe_rope",
 
"move_rope",
 
"move_rope",
"tf_",
+
"tf_viewmodel",
        "tf_logic_training",
+
"tf_logic_training",
 
"tf_logic_training_mode",
 
"tf_logic_training_mode",
        "tf_powerup_bottle",
+
"tf_logic_raid",
 +
"tf_powerup_bottle",
 
"tf_mann_vs_machine_stats",
 
"tf_mann_vs_machine_stats",
        "tf_viewmodel"
+
"tf_wearable",
        "tf_wearable",
 
 
"tf_wearable_demoshield",
 
"tf_wearable_demoshield",
        "tf_wearable_robot_arm",
+
"tf_wearable_robot_arm",
 
"tf_wearable_vm",
 
"tf_wearable_vm",
        "tf_logic_bonusround",
+
"tf_logic_bonusround",
 
"vote_controller",
 
"vote_controller",
        "monster_resource",
+
"monster_resource",
 
"tf_logic_medieval",
 
"tf_logic_medieval",
        "tf_logic_cp_timer",
+
"tf_logic_cp_timer",
 
"tf_logic_tower_defense",
 
"tf_logic_tower_defense",
        "func_upgradestation",
+
"tf_logic_mann_vs_machine",
 +
"func_upgradestation",
 
"entity_rocket",
 
"entity_rocket",
        "entity_carrier",
+
"entity_carrier",
 
"entity_sign",
 
"entity_sign",
        "entity_saucer",
+
"entity_saucer",
        "tf_halloween_gift_pickup",
+
"tf_halloween_gift_pickup",
        "tf_logic_competitive",
+
"tf_logic_competitive",
        "tf_wearable_razorback",
+
"", // END Marker
 
};
 
};
</pre>
+
</syntaxhighlight>
 +
}}
  
=={{css}}cstrike/cs_gamerules.cpp==
+
==={{css}}cstrike/cs_gamerules.cpp===
<pre>
+
{{ExpandBox|
 +
<syntaxhighlight lang="cpp">
 
static const char *s_PreserveEnts[] =
 
static const char *s_PreserveEnts[] =
 
{
 
{
Line 201: Line 254:
 
"", // END Marker
 
"", // END Marker
 
};
 
};
</pre>
+
</syntaxhighlight>
 +
}}
  
=={{dods}}dod/dod_gamerules.cpp==
+
==={{csgo}}cstrike15/cs_gamerules.cpp===
<pre>
+
{{ExpandBox|
 +
<syntaxhighlight lang="cpp">
 +
static const char *s_PreserveEnts[] =
 +
{
 +
"ai_network",
 +
"ai_hint",
 +
"cs_gamerules",
 +
"cs_team_manager",
 +
"cs_player_manager",
 +
"env_soundscape",
 +
"env_soundscape_proxy",
 +
"env_soundscape_triggerable",
 +
"env_sun",
 +
"env_wind",
 +
"env_fog_controller",
 +
"env_tonemap_controller",
 +
"env_cascade_light",
 +
"func_brush",
 +
"func_wall",
 +
"func_buyzone",
 +
"func_illusionary",
 +
"func_hostage_rescue",
 +
"func_bomb_target",
 +
"infodecal",
 +
"info_projecteddecal",
 +
"info_node",
 +
"info_target",
 +
"info_node_hint",
 +
"info_player_counterterrorist",
 +
"info_player_terrorist",
 +
"info_enemy_terrorist_spawn",
 +
"info_deathmatch_spawn",
 +
"info_armsrace_counterterrorist",
 +
"info_armsrace_terrorist",
 +
"info_map_parameters",
 +
"keyframe_rope",
 +
"move_rope",
 +
"info_ladder",
 +
"player",
 +
"point_viewcontrol",
 +
"point_viewcontrol_multiplayer",
 +
"scene_manager",
 +
"shadow_control",
 +
"sky_camera",
 +
"soundent",
 +
"trigger_soundscape",
 +
"viewmodel",
 +
"predicted_viewmodel",
 +
"worldspawn",
 +
"point_devshot_camera",
 +
"logic_choreographed_scene",
 +
"cfe_player_decal",
 +
"info_bomb_target_hint_A",
 +
"info_bomb_target_hint_B",
 +
"info_hostage_rescue_zone_hint",
 +
"generic_actor",
 +
"vote_controller",
 +
"wearable_item",
 +
"point_hiding_spot",
 +
"game_coopmission_manager",
 +
"chicken",
 +
"", // END Marker
 +
};
 +
</syntaxhighlight>
 +
}}
 +
 
 +
==={{dods}}dod/dod_gamerules.cpp===
 +
{{ExpandBox|
 +
<syntaxhighlight lang="cpp">
 
static const char *s_PreserveEnts[] =
 
static const char *s_PreserveEnts[] =
 
{
 
{
Line 246: Line 368:
 
"", // END Marker
 
"", // END Marker
 
};
 
};
</pre>
+
</syntaxhighlight>
 +
}}
  
=={{as}}swarm/asw_gamerules.cpp==
+
==={{as}}swarm/asw_gamerules.cpp===
<pre>
+
{{ExpandBox|
 +
<syntaxhighlight lang="cpp">
 
CAlienSwarm::CAlienSwarm()
 
CAlienSwarm::CAlienSwarm()
 
{
 
{
Line 265: Line 389:
 
m_MapResetFilter.AddKeepEntity("ai_network");
 
m_MapResetFilter.AddKeepEntity("ai_network");
 
}
 
}
</pre>
+
</syntaxhighlight>
 +
}}
 +
 
 +
== Code Dumps ==
 +
=== {{l4d}} Left 4 Dead ===
 +
22/07/2021 - Steps: [IDA]<br>
 +
1. Search for the<code>ai_network</code>string reference.<br>
 +
2. Bring up the XREFs of the reference.<br>
 +
3. Find the list that has both<code>survivor_bot</code>and<code>logic_versus_random</code>in it.
 +
{{ExpandBox|
 +
<syntaxhighlight lang="cpp">
 +
; "ai_network",
 +
; "ai_hint",
 +
; "cs_team_manager",
 +
; "terror_gamerules",
 +
; "terror_player_manager",
 +
; "survivor_bot",
 +
; "env_tonemap_controller",
 +
; "env_tonemap_controller_infected",
 +
; "env_tonemap_controller_ghost",
 +
; "vote_controller",
 +
; "env_soundscape",
 +
; "env_soundscape_proxy",
 +
; "env_soundscape_triggerable",
 +
; "env_sun",
 +
; "env_wind",
 +
; "env_fog_controller",
 +
; "func_wall",
 +
; "func_buyzone",
 +
; "func_illusionary",
 +
; "func_hostage_rescue",
 +
; "func_bomb_target",
 +
; "infodecal",
 +
; "info_projecteddecal",
 +
; "info_node",
 +
; "info_target",
 +
; "info_node_hint",
 +
; "info_player_counterterrorist",
 +
; "info_player_terrorist",
 +
; "info_map_parameters",
 +
; "info_map_parameters_versus",
 +
; "info_ladder",
 +
; "func_simpleladder",
 +
; "player",
 +
; "point_viewcontrol",
 +
; "scene_manager",
 +
; "shadow_control",
 +
; "sky_camera",
 +
; "soundent",
 +
; "trigger_soundscape",
 +
; "viewmodel",
 +
; "predicted_viewmodel",
 +
; "worldspawn",
 +
; "point_devshot_camera",
 +
; "info_survivor_position",
 +
; "logic_versus_random",
 +
</syntaxhighlight>
 +
}}
 +
 
 +
=== {{l4d2}} Left 4 Dead 2 ===
 +
22/07/2021 - Steps: [IDA]<br>
 +
1. Search for the<code>ai_network</code>string reference.<br>
 +
2. Bring up the XREFs of the reference.<br>
 +
3. Find the list that has both<code>survivor_bot</code>and<code>logic_versus_random</code>in it.
 +
{{ExpandBox|
 +
<syntaxhighlight lang="cpp">
 +
; "ai_network",
 +
; "ai_hint",
 +
; "cs_team_manager",
 +
; "terror_gamerules",
 +
; "terror_player_manager",
 +
; "survivor_bot",
 +
; "env_tonemap_controller",
 +
; "env_tonemap_controller_infected",
 +
; "env_tonemap_controller_ghost",
 +
; "vote_controller",
 +
; "env_soundscape",
 +
; "env_soundscape_proxy",
 +
; "env_soundscape_triggerable",
 +
; "env_sun",
 +
; "env_wind",
 +
; "env_fog_controller",
 +
; "func_wall",
 +
; "infodecal",
 +
; "info_projecteddecal",
 +
; "info_node",
 +
; "info_node_hint",
 +
; "info_map_parameters",
 +
; "info_map_parameters_versus",
 +
; "info_ladder",
 +
; "func_simpleladder",
 +
; "player",
 +
; "point_viewcontrol",
 +
; "scene_manager",
 +
; "shadow_control",
 +
; "sky_camera",
 +
; "soundent",
 +
; "trigger_soundscape",
 +
; "viewmodel",
 +
; "predicted_viewmodel",
 +
; "worldspawn",
 +
; "point_devshot_camera",
 +
; "weapon_scavenge_item_spawn",
 +
; "logic_versus_random",
 +
</syntaxhighlight>
 +
}}

Latest revision as of 01:35, 15 August 2021

In multiplayer Source games, during a round reset, all entities are resetted to their defaults by being deleted then respawned, unless their current classnames matches an entry in the whitelist s_PreserveEnts. Whitelisted entities either has special code to handle the resetting process, and isn't ideal to be deleted.

Some whitelist entities however don't account round resets properly with their new behavior, so when a round reset occurs, their properties are carried over from the last round, like their origins.

To do: Attempt to finish this table. Some games might not have any way to reset the round (even throughmp_forcewinormp_restartgamecommands).

Games Alien Swarm Counter-Strike: Global Offensive Counter-Strike: Source Day of Defeat: Source Half-Life 2 Half-Life 2: DeathmatchHalf-Life 2: Deathmatch Half-Life 2: Episode OneHalf-Life 2: Episode One Half-Life 2: Episode TwoHalf-Life 2: Episode Two Left 4 Dead Left 4 Dead 2 Portal Portal 2 Team Fortress 2
Has Whitelist Yes Yes Yes Yes No Yes No No From code dump From code dump Yes Unsure Yes

Source Code

Half-Life 2hl2mp/hl2mp_gamerules.cpp



Portalportal/portal_mp_gamerules.cpp



Team Fortress 2tf/tf_gamerules.cpp



Counter-Strike: Sourcecstrike/cs_gamerules.cpp



Counter-Strike: Global Offensivecstrike15/cs_gamerules.cpp



Day of Defeat: Sourcedod/dod_gamerules.cpp



Alien Swarmswarm/asw_gamerules.cpp



Code Dumps

Left 4 Dead Left 4 Dead

22/07/2021 - Steps: [IDA]
1. Search for theai_networkstring reference.
2. Bring up the XREFs of the reference.
3. Find the list that has bothsurvivor_botandlogic_versus_randomin it.



Left 4 Dead 2 Left 4 Dead 2

22/07/2021 - Steps: [IDA]
1. Search for theai_networkstring reference.
2. Bring up the XREFs of the reference.
3. Find the list that has bothsurvivor_botandlogic_versus_randomin it.