Physics optimization: Difference between revisions
TomEdwards (talk | contribs) (→Spawnflags: non-functional) |
TomEdwards (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
It's a rare map that exists without any [[prop_physics|physically-simulated objects]]. How can we keep the performance costs of all these items under control? | It's a rare map that exists without any [[prop_physics|physically-simulated objects]]. How can we keep the performance costs of all these items under control? | ||
It's a particular issue when we consider that we can't remove objects based on the speed of the CPU: the computer with an eight year old laptop CPU has exactly as many objects to manage as the computer with a liquid-cooled quadcore chip from the year | It's a particular issue when we consider that we can't remove objects based on the speed of the CPU: the computer with an eight year old laptop CPU has exactly as many objects to manage as the computer with a liquid-cooled quadcore chip from the year 2010! | ||
== Spawnflags == | == Spawnflags == | ||
Line 11: | Line 11: | ||
:But of course you ''do'' want that settling to happen, or else objects will be suspended in the wrong position. You can escape this catch-22 with the <code>[[map_edit]]</code> command. | :But of course you ''do'' want that settling to happen, or else objects will be suspended in the wrong position. You can escape this catch-22 with the <code>[[map_edit]]</code> command. | ||
;Debris | ;Debris | ||
:Debris objects don't collide with anything but [[brush]]es, vastly reducing their [[cost]]. They can optionally be 'ploughed through' by the player with <code>[[cl_pushaway_force]]</code>. | :Debris objects don't collide with anything but [[brush]]es, vastly reducing their [[cost]]. They can optionally be 'ploughed through' by the local player with <code>[[cl_pushaway_force]]</code>. | ||
:{{tip|It can get fiddly to set lots of tiny items as debris. Perhaps a programmer could write some code to automatically do so for models under a certain side when the map spawns?}} | :{{tip|It can get fiddly to set lots of tiny items as debris. Perhaps a programmer could write some code to automatically do so for models under a certain side when the map spawns?}} | ||
;Motion Disabled | ;Motion Disabled | ||
Line 18: | Line 18: | ||
== phys_constraintsystem == | == phys_constraintsystem == | ||
[[phys_constraintsystem|This entity]] manages a group of interacting [[constraint]]s to reduce processing overhead and keep them more stable. Just link the entities to it and the engine will do the rest. | [[phys_constraintsystem|This entity]] manages a group of interacting physics [[constraint]]s to reduce processing overhead and keep them more stable. Just link the entities to it and the engine will do the rest. | ||
== Network performance == | == Network performance == | ||
Line 24: | Line 24: | ||
The amount of network data physics objects create can become an issue in multiplayer. To help with this, use <code>[[prop_physics_multiplayer]]</code>; it simplifies collision models for complex entities to reduce bandwidth, and makes everything a little bit bouncier to try and hide latency paradoxes. | The amount of network data physics objects create can become an issue in multiplayer. To help with this, use <code>[[prop_physics_multiplayer]]</code>; it simplifies collision models for complex entities to reduce bandwidth, and makes everything a little bit bouncier to try and hide latency paradoxes. | ||
It also automatically makes smaller objects client-side | It also automatically makes smaller objects client-side, which can be overridden with the 'Force server-side' spawnflag if needed. | ||
{{note|There have been reports of this entity behaving strangely - revert to prop_physics if you encounter | {{note|There have been reports of this entity behaving strangely - revert to prop_physics if you encounter problems.}} | ||
---- | ---- | ||
'''''[[Optimization (level design)|<< Return to Optimization (level design)]]''''' | '''''[[Optimization (level design)|<< Return to Optimization (level design)]]''''' |
Revision as of 02:32, 17 September 2008
It's a rare map that exists without any physically-simulated objects. How can we keep the performance costs of all these items under control?
It's a particular issue when we consider that we can't remove objects based on the speed of the CPU: the computer with an eight year old laptop CPU has exactly as many objects to manage as the computer with a liquid-cooled quadcore chip from the year 2010!
Spawnflags
These spawnflags apply to prop_physics
, and some to prop_ragdoll
.
- Start asleep
- Suspends all physics calculations until the entity has a force of some sort exerted on it. Its primary use is to avoid the first moments of a map being a slideshow as all of the objects in it 'settle'.
- But of course you do want that settling to happen, or else objects will be suspended in the wrong position. You can escape this catch-22 with the
map_edit
command. - Debris
- Debris objects don't collide with anything but brushes, vastly reducing their cost. They can optionally be 'ploughed through' by the local player with
cl_pushaway_force
. Tip:It can get fiddly to set lots of tiny items as debris. Perhaps a programmer could write some code to automatically do so for models under a certain side when the map spawns?
- Motion Disabled
- Does exactly what its name suggests. Unlike sleeping, it can be (and is only) affected with the
EnableMotion
andDisableMotion
inputs.
phys_constraintsystem
This entity manages a group of interacting physics constraints to reduce processing overhead and keep them more stable. Just link the entities to it and the engine will do the rest.
Network performance
The amount of network data physics objects create can become an issue in multiplayer. To help with this, use prop_physics_multiplayer
; it simplifies collision models for complex entities to reduce bandwidth, and makes everything a little bit bouncier to try and hide latency paradoxes.
It also automatically makes smaller objects client-side, which can be overridden with the 'Force server-side' spawnflag if needed.
