Physics Mayhem: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
{{orphan}}{{stub}}
{{orphan}}{{stub}}


[[Physics Mayhem]] is a physics engine bug present in all Source branches using [[Havok]].  
[[Physics Mayhem]] is a physics engine bug present in all Source branches using [[Havok]] except {{csgo}}.  


If an entity's solidity type or collision group is changed manually (for example, by using <code>addoutput solid 2</code> with I/O or <code>NetProps.SetPropInt(entity, "m_CollisionGroup"</code> in [[VScript]]), internal cached physics information will not be updated. Eventually, Havok can implode attempting to run the simulation with the stale information when this entity comes in contact with other objects. Effects range from unpredictable, bouncy prop behavior to all [[VPhysics]]-simulated objects falling through all geometry. This bug is global and once it occurs, it is unrecoverable. The only fix is a full server restart.
If an entity's solidity type or collision group is changed manually (for example, by using <code>addoutput solid 2</code> with I/O or <code>NetProps.SetPropInt(entity, "m_CollisionGroup"</code> in [[VScript]]), internal cached physics information will not be updated. Eventually, Havok can implode attempting to run the simulation with the stale information when this entity comes in contact with other objects. Effects range from unpredictable, bouncy prop behavior to all [[VPhysics]]-simulated objects falling through all geometry. This bug is global and once it occurs, it is unrecoverable. The only fix is a full server restart.


To avoid this bug, do not set the solid or collision group fields manually. Instead, use the game's native routines to handle this. In [[VScript]], this is <code>SetSolid</code> and <code>SetCollisionGroup</code>. In [[SourceMod]], use <code>CollisionRulesChanged</code>.
To avoid this bug, do not set the solid or collision group fields manually. Instead, use the game's native routines to handle this. In [[VScript]], this is <code>SetSolid</code> and <code>SetCollisionGroup</code>. In [[SourceMod]], use <code>CollisionRulesChanged</code>.
The technical reason for this bug is a hack introduced for E3 2003 involving unused collisions. A global boolean variable is set to true when a specific edge case happens, intended to defer collision code later temporarily. Unfortunately, the boolean is never set back to false, and this causes all collisions to permanently fail.
{{todo|Add offset for the global variable into <code>vphysics.dll</code> for monitoring or patching purposes}}


{{note|It is possible to recover from this at runtime by reloading the physics engine with the [https://github.com/ficool2/PhysSwapper PhysSwapper] plugin.}}
{{note|It is possible to recover from this at runtime by reloading the physics engine with the [https://github.com/ficool2/PhysSwapper PhysSwapper] plugin.}}

Revision as of 03:02, 31 July 2024

Stub

This article or section is a stub. You can help by expanding it.

Physics Mayhem is a physics engine bug present in all Source branches using Havok except Counter-Strike: Global Offensive.

If an entity's solidity type or collision group is changed manually (for example, by using addoutput solid 2 with I/O or NetProps.SetPropInt(entity, "m_CollisionGroup" in VScript), internal cached physics information will not be updated. Eventually, Havok can implode attempting to run the simulation with the stale information when this entity comes in contact with other objects. Effects range from unpredictable, bouncy prop behavior to all VPhysics-simulated objects falling through all geometry. This bug is global and once it occurs, it is unrecoverable. The only fix is a full server restart.

To avoid this bug, do not set the solid or collision group fields manually. Instead, use the game's native routines to handle this. In VScript, this is SetSolid and SetCollisionGroup. In SourceMod, use CollisionRulesChanged.

The technical reason for this bug is a hack introduced for E3 2003 involving unused collisions. A global boolean variable is set to true when a specific edge case happens, intended to defer collision code later temporarily. Unfortunately, the boolean is never set back to false, and this causes all collisions to permanently fail.

Todo: Add offset for the global variable into vphysics.dll for monitoring or patching purposes
Note.pngNote:It is possible to recover from this at runtime by reloading the physics engine with the PhysSwapper plugin.

External Links