Difference between revisions of "Instance"

From Valve Developer Community
Jump to: navigation, search
m
(Instances can be enabled in unsupported games by adding a GameData key to gameinfo.txt)
Line 8: Line 8:
 
An '''instance''' is a [[VMF|map (.vmf) file]] referenced inside another map through a [[func_instance]], possibly aided by a [[func_instance_parms]] and/or [[func_instance_io_proxy]].
 
An '''instance''' is a [[VMF|map (.vmf) file]] referenced inside another map through a [[func_instance]], possibly aided by a [[func_instance_parms]] and/or [[func_instance_io_proxy]].
  
{{note|While working inside [[Hammer]] for all Source games, instances are currently only supported by the map compilers for {{l4d2}}[[Left 4 Dead 2]], {{as}}[[Alien Swarm]], {{portal2}}[[Portal 2]], {{tf2}}[[Team Fortress 2]], {{csgo}}[[Counter-Strike: Global Offensive]], and Source 2013, and therefore will not work for any other games. To use them in unsupported games, see below.}}
+
{{note|In order for instances to be compiled into maps, a <code>GameData</code> key must be present in [[gameinfo.txt]] pointing to the game's [[FGD]] file. Only {{l4d2}}[[Left 4 Dead 2]], {{as}}[[Alien Swarm]], {{portal2}}[[Portal 2]], {{tf2}}[[Team Fortress 2]], {{csgo}}[[Counter-Strike: Global Offensive]], and Source 2013 include this by default. Instances can be enabled in other games by adding it, or using a pre-compiler as described below. {{todo|Only tested in {{portal}}Portal, see if this works elsewhere}}}}
  
{{note|In {{tf2}}[[Team Fortress 2]] and Source 2013, instances have some broken or missing functionality: instance I/O system is unsupported, instances cannot be nested, displacements within an instance may not compile properly and any env_cubemaps inside of an instance will not be compiled into the final map.}}
+
{{note|In pre-{{l4d2}}[[Left 4 Dead 2]] branches, instances have some broken or missing functionality: instance I/O system is unsupported, instances cannot be nested, displacements within an instance may not compile properly and any env_cubemaps inside of an instance will not be compiled into the final map.}}
  
 
Instances are helpful in many ways:
 
Instances are helpful in many ways:

Revision as of 22:01, 17 February 2019

Русский

An instance is a map (.vmf) file referenced inside another map through a func_instance, possibly aided by a func_instance_parms and/or func_instance_io_proxy.

Note.png Note: In order for instances to be compiled into maps, a GameData key must be present in gameinfo.txt pointing to the game's FGD file. Only <Left 4 Dead 2>Left 4 Dead 2, <Alien Swarm>Alien Swarm, [Portal 2]Portal 2, <Team Fortress 2>Team Fortress 2, <Counter-Strike: Global Offensive>Counter-Strike: Global Offensive, and Source 2013 include this by default. Instances can be enabled in other games by adding it, or using a pre-compiler as described below. To do: Only tested in [Portal]Portal, see if this works elsewhere
Note.png Note: In pre-<Left 4 Dead 2>Left 4 Dead 2 branches, instances have some broken or missing functionality: instance I/O system is unsupported, instances cannot be nested, displacements within an instance may not compile properly and any env_cubemaps inside of an instance will not be compiled into the final map.

Instances are helpful in many ways:

  • They provide a more dynamic alternative to prefabs, as any changes to the instanced map will be reflected in all instances of it.
  • They provide an alternative to visgroups, as they can be used to divide a large, unwieldy map into several smaller, manageable ones (that can even be worked on by multiple authors simultaneously).
  • They provide a simple way to edit portions of a map that needs to be at a non-orthogonal angle. (Build the map on-grid inside a separate map, and then instance it into another map through a func_instance rotated at the correct angle.
  • They provide a way for maps to work on multiple platforms, such as Left 4 Dead and Left 4 Dead 2 versions of the same map.

How to

In Portal 2 to give input to an entity within a instance use this:

My Output Target Entity Target Input Parameter Delay Only Once
Io11.png <Output> <Instance> instance:<entity>;<input> <none> 0.00 No

Or, alternatively, you can do this:

My Output Target Entity Target Input Parameter Delay Only Once
Io11.png <Output> <Instance>-<entity> <input> <none> 0.00 No

Manifests

To do

Workaround for any Source game

To use instances in unsupported Engine versions, Metapyziks wrote a program that merges used instances with the main VMF.

Also see

External links