Map edit

From Valve Developer Community
Revision as of 03:29, 21 July 2005 by JeffLane (talk | contribs) (initial work on map_edit)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This article is a work in progress. Info on node editing will be added.


The map_edit and wc_update_entity console commands can be used to update entity data while running a map in the engine, then sending the changes to Hammer to commit the changes to the .VMF file. It is commonly used to change node positions or to update physics props after they have done their initial settling.

The map_edit <mapname> command is used to load a .BSP for editing. This command creates a connection between the engine and the Hammer editor so that data can be transferred. Before using map_edit, you must compile the map with the current version of the associated .VMF, then load the map in Hammer. The map versions of the .BSP and the .VMF must match exactly. If they do not match, no editing is possible.

Once a map is loaded with map_edit, the wc_update_entity <entity name> command is used to send the updated position and angles for the named entities back to the Hammer editor. When using wc_update_entity, you can uses the targetname of a single entity to update, or use an entity classname (i.e. prop_physics) to update all entities in the map of that type. Every time wc_update_entity is invoked, the position and angle of the entities is sent to the editor.

Note: Only the position and angle of point entities can be updated in this way. Solid entities and other brushes cannot be modified using wc_update_entity. See Introduction to Editing for a description of entity types.

Editing node graphs

Settling physics props

You can use the map_edit command to update your .VMF with the positions of physics props after they've been settled into their final position by the game's physics system. This saves valuable CPU cycles at the start of the map, as well as preventing props from visually "dropping" into place when the map is loaded or a new round begins (in a multiplayer game).

To use map_edit to update the position of prop_physics_multiplayer entities:

  1. Do a full compile of the map you wish to edit.
  2. Load the map in Hammer. *Do not make any changes or save the map, or the edit will fail!*
  3. Minimize Hammer.
  4. Start the game (windowed mode works best).
  5. At the console, type map_edit <map name> and the map will load.
  6. After the map loads, wait a few moments for the physics props to settle.
  7. Open the console and type wc_update_entity prop_physics_multiplayer
  8. Type quit to exit the game.
  9. Switch back over to Hammer. The locations of the physics props should be updated.
  10. Check the results, then save your changes to the map.
  11. Recompile the map, and the physics props will start in the "settled" positions.

You should now be able to safely mark many of the props as "Start Asleep". This will provide additional performance savings because no physics calculation will occur for the prop until it is acted upon by a physics force that would move it.

Other uses of map_edit

  • Follow the same process to update other entity types, such as prop_physics. Simply use the syntax wc_update_entity <entity name> for each entity you wish to update in the map. Only the position and angle of point entities can be updated.
  • Using map_edit to place debris models

See Also

Hammer Editor Documentation