Worldspawn: Difference between revisions
Jump to navigation
Jump to search
Note:Attempting to kill worldspawn or create a second worldspawn while the game is running will crash the server.
Tip:Access these properties in Hammer with Main menu > Map > Map properties...
All
Bug:Crashes the game when enabled if the game tries to draw the title but does not include title_half and title_life entries in 
Half-Life: Source is one of the games that does have them, for example.
Confirm:Which other games have them, or don't use this method in the first place? [todo tested in ?]
Fix:Add title_half and title_life entries to hud_textures.txt.
Valve games
Non-Valve games
m (linked the german translation) |
|||
(89 intermediate revisions by 36 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LanguageBar}} | ||
{{TabsBar}} | |||
}} | |||
{{toc-right}} | {{toc-right}} | ||
{{CD|CWorld|file1=world.cpp}} | |||
{{Preserved entity|all}} | |||
{{This is a|semi-internal=1|entity|name=worldspawn}} It (or just "the world") is the single entity that stores the noninteractive parts of a map, alongside some global configuration options. In other words: | |||
* [[Brush]]es (except those used by [[Brush entity|entities]]) | * [[Brush]]es (except those used by [[Brush entity|entities]]) | ||
* [[prop_static|Static props]] | * [[prop_static|Static props]] | ||
* [[func_detail]], and in some games [[func_ladder]] | |||
* Map name, [[skybox]], [[context]]s... | * Map name, [[skybox]], [[context]]s... | ||
Some other notes: | Some other notes: | ||
*[[Wikipedia:Highlander (film)|There can be only one.]] (Since Hammer doesn't allow worldspawn to be created directly it's very difficult for this rule to be broken.) | *[[Wikipedia:Highlander (film)|There can be only one.]] (Since Hammer doesn't allow worldspawn to be created directly, it's very difficult for this rule to be broken.) | ||
:{{bug|Related to this, do not clone any part of your world after selecting it via map properties. This will duplicate worldspawn, causing crashes. Deselecting after this however and cloning after deselecting will behave as normal. {{fixed|{{hammer++}}}} }} | |||
*Damage from the environment and suicide is ordinarily attributed to the world. | *Damage from the environment and suicide is ordinarily attributed to the world. | ||
*[[Constraint]]s can be assigned to worldspawn by not specifying a name for their subject/target. | *[[Constraint]]s can be assigned to worldspawn by not specifying a name for their subject/target. | ||
{{note|Attempting to [[kill]] worldspawn or create a second worldspawn while the game is running will crash the server.}} | |||
== Keyvalues == | == Keyvalues == | ||
{{tip|Access these properties in Hammer with ''Main menu > Map > Map properties...''}} | {{tip|Access these properties in Hammer with ''Main menu > Map > Map properties...''}} | ||
=== All | === All {{src|4}} Games === | ||
{{KV|Map Description / Title | {{KV|Targetname|intn=targetname|target_source|Name which other entities use to send [[#Inputs|inputs]] to this entity.}} | ||
{{KV| | {{KV|Map Description / Title|intn=message|string|deprecated=1|Leftover from {{quake|2|nt=0}}. Typically used for author credits.}} | ||
{{KV|Chapter Title Message|string|Chapter Title that appears | {{KV|Skybox Name|intn=skyname|sky|[[Skybox]] material, relative to {{code|materials/skybox/}}. See [[Sky List]].}} | ||
{{KV|Level Fade In|boolean| | {{KV|Chapter Title Message|intn=chaptertitle|string|Chapter Title that appears on-screen when this level starts.}} | ||
{{KV|Display Game Title|boolean|Should the game's title appear on-screen when the map starts?}} | {{KV|Level Fade In|intn=startdark|boolean|Fade in when the map loads. {{bug|The fade is carried out every time the map loads, including when loading from a saved game. Use [[env_fade]] instead.}}}} | ||
{{KV|New Level Unit| | {{KV|Display Game Title|intn=gametitle|boolean|Should the game's title appear on-screen when the map starts?}} | ||
{{bug|offset=1|Crashes the game when enabled if the game tries to draw the title but does not include {{code|title_half}} and {{code|title_life}} entries in {{path|<nowiki>/scripts/hud_textures</nowiki>|txt}}.<br>'''[[Half-Life: Source]]''' is one of the games that does have them, for example. {{confirm|Which other games have them, or don't use this method in the first place?}} }} | |||
{{Fix|offset=1|Add {{code|title_half}} and {{code|title_life}} entries to {{code|hud_textures.txt}}. | |||
{{ExpandBox|title=Example from '''HL:S'''| | |||
<source> | |||
"title_half" | |||
{ | |||
"file" "sprites/640hud4" | |||
"x" "0" | |||
"y" "226" | |||
"width" "256" | |||
"height" "30" | |||
} | |||
"title_life" | |||
{ | |||
"file" "sprites/640hud5" | |||
"x" "0" | |||
"y" "226" | |||
"width" "220" | |||
"height" "30" | |||
} | |||
</source> | |||
}} | |||
A proper fix in the code for your mod would be to edit {{path|<nowiki>/game/client/message</nowiki>|cpp}}'s {{code|Paint()}} function, to check {{code|m_iconTitleHalf}} and {{code|m_iconTitleLife}} not being {{w|icon=0|Null pointer|NULL}}. | |||
}} | |||
{{KV|New Level Unit|intn=newunit|boolean|Used to clear out savegame data of previous levels to keep the savegame size as small as possible. Only set it to Yes if the player cannot return to any previous levels.{{note|{{portal2|4}} forces this to be enabled in code, so two-way transitions will not work correctly (one-way HL2 style transitions work fine though.)}} <!-- this is not fixed in p2ce -->}} | |||
:* 0 : No, keep current | :* 0 : No, keep current | ||
:* 1 : Yes, clear previous levels | :* 1 : Yes, clear previous levels | ||
{{KV|Max occludee area|float| | {{KV|Max occludee area|intn=maxoccludeearea|float|}} | ||
{{KV|Min occluder area|float| | {{KV|Min occluder area|intn=minoccludeearea|float|Prevents occlusion testing for entities that take up more or less than X% of the screen, respectively.}} | ||
{{KV|Max occludee area (Xbox)|float| | {{KV|Max occludee area (Xbox)|intn=maxoccludeearea_x360|float|}} | ||
{{KV|Min occluder area (Xbox)|float| | {{KV|Min occluder area (Xbox)|intn=minoccludeearea_x360|float|Same as above, but for {{Xbox360|2}}.}} | ||
{{KV|Start Fade Pixels|float|Number of pixels wide at which all props in the level start to fade (<0 {{=}} use fademaxdist). This number is ignored if the prop has a specific fade distance specified.}} | {{KV|Start Fade Pixels|intn=maxpropscreenwidth|float|Number of pixels wide at which all props in the level start to fade (<0 {{=}} use fademaxdist). This number is ignored if the prop has a specific fade distance specified.}} | ||
{{KV|End Fade Pixels|float|Minimum number of pixels wide at which the prop is visible (0 {{=}} don't fade out). This number is ignored if the prop has a specific fade distance specified.}} | {{KV|End Fade Pixels|intn=minpropscreenwidth|float|Minimum number of pixels wide at which the prop is visible (0 {{=}} don't fade out). This number is ignored if the prop has a specific fade distance specified.}} | ||
{{KV|Detail.vbsp file| | {{KV|Detail.vbsp file|intn=detailvbsp|file|Detail.vbsp file to use for emitting [[detail props]] (relative to the mod's root directory)}} | ||
{{KV|Detail material file| | {{KV|Detail material file|intn=detailmaterial|material|Material for [[detail sprite]]s to use for drawing detail props}} | ||
{{KV|World is cold|boolean|If set, | {{KV|World is cold|intn=coldworld|boolean|If set, {{dods|2}} player models will emit clientside breath particles from their {{mono|head}} [[attachment]]s. No effect elsewhere. | ||
:{{idea|Set this properly even if unused in the given game. If VScript is available then vscript mods may potentially use the information and implement similar functionality to {{dods}}.}} | |||
}} | |||
{{KV|Minimum light level|intn=_minlight|float|nofgd=1|The minimum level of ambient light that hits the world. It does not affect any entities, including props!}} | |||
{{KV|World MinS|intn=world_mins|vec3|nofgd=1|Autofilled by VBSP.}} | |||
{{KV|World MaxS|intn=world_maxs|vec3|nofgd=1|Autofilled by VBSP.}} | |||
{{KV|Map revision|intn=mapversion|int|nofgd=1|Updated by Hammer each time the [[VMF]] is saved.}} | |||
{{KV ResponseContext}} | {{KV ResponseContext}} | ||
=== {{ | === Specific games === | ||
{{KV|Time of day|choices| | ====Valve games {{l4d2}}{{portal2}}==== | ||
{{Expand| | |||
; {{l4d2|4}} | |||
{{KV|Time of day|intn=timeofday|integer choices|Common infected will aggro from a further distance if set to "Dawn" through "Dusk" and will sit or lie down if set to "Midnight" or "Evening". Witches will wander if set to "Afternoon". {{note|Doesn't influence lighting or environment in any way. You still need to configure the {{ent|light_environment}} so the sun/moon has the appropriate light color and brightness.}}}} | |||
:* 0 : Midnight | :* 0 : Midnight | ||
:* 1 : Dawn | :* 1 : Dawn | ||
Line 73: | Line 84: | ||
:* 4 : Dusk | :* 4 : Dusk | ||
:* 5 : Evening | :* 5 : Evening | ||
{{KV|Start Music Type| | {{KV|Start Music Type|intn=startmusictype|boolean|Music type of the safe room.}} | ||
:* 0 : Mission Start | :* 0 : Mission Start | ||
:* 1 : Check Point | :* 1 : Check Point | ||
{{KV|Music Post-Fix String|string|The musical theme of the map.}} | {{KV|Music Post-Fix String|intn=musicpostfix|string|The [[List of L4D2 Campaign Music|musical theme]] of the map.}} | ||
; {{Portal2|4}} | |||
{{KV|[[Paint in map]]|boolean|intn=paintinmap|Allow paint to cover surfaces? Set to No for better [[Optimization/Level Design|optimization of levels]] without it.}} | |||
{{KV|[[Max number of blobs]]|integer|intn=maxblobcount|Maximum number of [[paint_sphere|paint blobs]]. Should NOT exceed 250.}} | |||
{{note|These two parameters might not appear if you have [[propper]].[[fgd]] in Hammer.}}<!---This probably affects other games, too. Not certain.---> | |||
}} | |||
=== {{ | ==== Non-Valve games {{bms}}{{strata}}{{sineps}}==== | ||
{{KV| | {{Expand| | ||
{{KV| | ; {{bms|4}} | ||
{{KV|Under Water Particles|intn=underwaterparticle|string choices}} | |||
:* underwater_default : Rubbish | |||
:* underwater_ion : Blue ions | |||
:* underwater_tentacle_water : Tentacle feces water | |||
; {{strata|4}} | |||
{{KV|Maximum Projected Textures|intn=maxprojectedtextures|integer|Maximum number of env_projectedtexture entities that can be enabled at once. Default 8; set lower to improve performance if necessary.{{warning|While this can be set higher than 8, doing so can be detrimental to performance.}}}} | |||
; {{sineps|4}} | |||
{{KV|Arena Mode Time Limit|intn=arenaTimeLimit|integer|The number of seconds an arena mode map should last. (default: 900s (15 min))}} | |||
}} | |||
== Inputs == | == Inputs == | ||
{{I|param=string|SetChapterTitle|Change the Chapter Title|only={{mapbase}}}} | |||
{{I ResponseContext}} | {{I ResponseContext}} | ||
== See also == | |||
* [[Void]] | |||
* [[Skybox]] | |||
[[Category:Entities]] | [[Category:Entities]] |
Latest revision as of 18:02, 29 July 2025
![]() |
---|
CWorld |
![]() |

This is a preserved entity.
If the game has round restart mechanics this entity may not behave as expected.
If the game has round restart mechanics this entity may not behave as expected.
worldspawn
is a semi-internal entity available in all Source games. It (or just "the world") is the single entity that stores the noninteractive parts of a map, alongside some global configuration options. In other words:
- Brushes (except those used by entities)
- Static props
- func_detail, and in some games func_ladder
- Map name, skybox, contexts...
Some other notes:
- There can be only one. (Since Hammer doesn't allow worldspawn to be created directly, it's very difficult for this rule to be broken.)
Bug:Related to this, do not clone any part of your world after selecting it via map properties. This will duplicate worldspawn, causing crashes. Deselecting after this however and cloning after deselecting will behave as normal. (fixed in
) [todo tested in ?]
- Damage from the environment and suicide is ordinarily attributed to the world.
- Constraints can be assigned to worldspawn by not specifying a name for their subject/target.

Keyvalues

All
Source Games
Map Description / Title (message) <string>- Deprecated.
Leftover fromQuake I. Typically used for author credits.
- Chapter Title Message (chaptertitle) <string>
- Chapter Title that appears on-screen when this level starts.
- Level Fade In (startdark) <boolean>
- Fade in when the map loads.
- Display Game Title (gametitle) <boolean>
- Should the game's title appear on-screen when the map starts?


/scripts/hud_textures.txt
.Half-Life: Source is one of the games that does have them, for example.


Example from HL:S
"title_half"
{
"file" "sprites/640hud4"
"x" "0"
"y" "226"
"width" "256"
"height" "30"
}
"title_life"
{
"file" "sprites/640hud5"
"x" "0"
"y" "226"
"width" "220"
"height" "30"
}
A proper fix in the code for your mod would be to edit /game/client/message.cpp
's Paint() function, to check m_iconTitleHalf and m_iconTitleLife not being NULL.
- New Level Unit (newunit) <boolean>
- Used to clear out savegame data of previous levels to keep the savegame size as small as possible. Only set it to Yes if the player cannot return to any previous levels.
Note:
Portal 2 forces this to be enabled in code, so two-way transitions will not work correctly (one-way HL2 style transitions work fine though.)
- 0 : No, keep current
- 1 : Yes, clear previous levels
- Max occludee area (maxoccludeearea) <float>
- Min occluder area (minoccludeearea) <float>
- Prevents occlusion testing for entities that take up more or less than X% of the screen, respectively.
- Max occludee area (Xbox) (maxoccludeearea_x360) <float>
- Start Fade Pixels (maxpropscreenwidth) <float>
- Number of pixels wide at which all props in the level start to fade (<0 = use fademaxdist). This number is ignored if the prop has a specific fade distance specified.
- End Fade Pixels (minpropscreenwidth) <float>
- Minimum number of pixels wide at which the prop is visible (0 = don't fade out). This number is ignored if the prop has a specific fade distance specified.
- Detail.vbsp file (detailvbsp) <file path>
- Detail.vbsp file to use for emitting detail props (relative to the mod's root directory)
- Detail material file (detailmaterial) <material>
- Material for detail sprites to use for drawing detail props
- World is cold (coldworld) <boolean>
- If set,
Day of Defeat: Source player models will emit clientside breath particles from their head attachments. No effect elsewhere.
- Minimum light level (_minlight) <float> !FGD
- The minimum level of ambient light that hits the world. It does not affect any entities, including props!
ResponseContext:
- Response Contexts (ResponseContext) <string>
- Pre-defined response system context{s} for this entity. Format is
key:value,key:value,...
When this entity speaks, the list of keys & values will be passed to the response rules system.
Specific games
Valve games 

|
Non-Valve games 


|
Inputs
- SetChapterTitle <string > (only in
)
- Change the Chapter Title
ResponseContext:
- AddContext <string >
- Adds to the entity's list of response contexts. Format is
<key>:<value>
.
- RemoveContext <string >
- Remove a context from this entity's list. The name should match the key of an existing context.
- ClearContext
- Removes all contexts from this entity's list.