Foundry

From Valve Developer Community
Jump to: navigation, search


Overview

Foundry Foundry is an engine tool that allows two-way communication between Hammer and the engine. You can sync your Hammer and game viewports, remove/add point and brush entities in real time from both the engine and Hammer sides, have a limited degree of brush editing preview, and more.

When Foundry is loaded, it will load both Hammer (tied to the engine process) and the Foundry toolset.

Foundry in action on the Source Filmmaker engine branch.


History

Foundry originally operated off of the tool module foundry.dll. This was mistakenly released during the 2007 Team Fortress 2 beta, though nobody seems to have got this version working before the whole tools system was deactivated and it is incompatible with the current build of the engine. Foundry.dll is also present in Black Mesa, but is just a placeholder dummy module.

Facepunch user Narry discovered that in the L4D2 engine branch and its descendants, the Foundry code was merged into Hammer's own DLL, hammer_dll.dll. By placing this DLL in the tools folder of the game, you can load Foundry using "toolload hammer_dll" in console, as long as you launch with -foundrymode and -tools.


Loading Foundry

Foundry can be used by running with -foundrymode and -tools in the command line. You must then run "toolload hammer_dll" in console.
Note:You must make sure to copy hammer_dll.dll from the bin folder to the bin/tools folder first!


Engine Commands (some of these are only defined when Foundry is loaded)

"cl_foundry_ShowEntityHighlights" = "1" client                                  
"foundry_auto_pause" = "2"                                                       - If 1, Foundry pauses the game when the engine window loses focus. If 2, Foundry 
"foundry_draw_hammer_entities" = "1"                                            
"foundry_draw_hammer_models" = "0"                                              
"foundry_engine_get_mouse_control"  game                                         - Give the engine control of the mouse.
"foundry_engine_release_mouse_control"  game                                     - Give the control of the mouse back to Hammer.
"foundry_move_focus_to_engine"                                                   - Send focus to the engine.
"foundry_remove_selected"                                                        - Remove selected entities.
"foundry_select_entity"  game                                                    - Select the entity under the crosshair or select entities with the specified name
"foundry_send_ents_to_engine"                                                    - Send selected entities in Hammer into the engine.
"foundry_spawn_visgroup"                                                         - Spawn all the entities in the specified visgroup.
"foundry_sync_engine_view"                                                       - Move engine's 3D view to the same position as Hammer's 3D view.
"foundry_sync_hammer_view"  game                                                 - Move Hammer's 3D view to the same position as the engine's 3D view.
"foundry_update_entity"  game                                                    - Updates the entity's position/angles when in edit mode
*foundry_engine_release_mouse_control
*foundry_select_entity
*foundry_sync_hammer_view
*foundry_update_entity

Confirmed Working Games

  • Source Filmmaker Source Filmmaker (Unstable. Engine->Hammer communication seems to have issues? Hammer->Engine works fine.)

Broken Games

  • [Portal 2] Portal 2 (Semi-working, the module loads but loading a map crashes. Object Properties is broken.)
  • <Alien Swarm> Alien Swarm (Semi-working, the module loads but loading a map crashes. Object Properties is broken.)
  • <Counter-Strike: Global Offensive> Counter-Strike: Global Offensive (Semi-working, the module loads but it is ASSUMED that loading a map crashes based on similar behavior to Portal 2)