Class WorldLoader
Namespace: ValveResourceFormat.Renderer.World
Assembly: Renderer.dll
Loads and manages Source 2 world data including entities, lighting, and geometry.
public class WorldLoaderInheritance
object ← WorldLoader
Constructors
WorldLoader(World, Scene, EntitySystem, Matrix4x4?)
Initializes a new WorldLoader for the given world resource. Call WorldLoader.Load(ResourceExtRefList?) to begin loading world components into the scene.
public WorldLoader(World world, Scene scene, EntitySystem entitySystem, Matrix4x4? rootTransform = null)Parameters
world World
The world data block to load.
scene Scene
The scene to load the world into.
entitySystem EntitySystem
The entity world this map's entities spawn into.
rootTransform Matrix4x4?
Transform applied to the whole map, identity when null.
Properties
BombDamage
Baked bomb damage data for CS2, null if it doesn't exist. Populated by WorldLoader.LoadBombDamageData().
public BombDamage? BombDamage { get; set; }Property Value
CameraMatrices
Transform matrices corresponding to each entry in WorldLoader.CameraNames.
public List<Matrix4x4> CameraMatrices { get; }Property Value
CameraNames
Names of info_camera_link entities found in the world.
public List<string> CameraNames { get; }Property Value
List<string>
DefaultEnabledLayers
Layers that should be visible by default, populated during loading.
public HashSet<WorldLayer> DefaultEnabledLayers { get; }Property Value
Entities
All entities parsed from the world's entity lumps, including the ones a point_template spawns only when told to.
public List<EntityLump.Entity> Entities { get; }Property Value
LoadingProgress
Loading screen hints.
public IProgress<string>? LoadingProgress { get; set; }Property Value
IProgress<string>?
MainWorldNode
The first world node encountered during loading.
public WorldNode? MainWorldNode { get; }Property Value
MapName
The directory path of the map, e.g. maps/de_dust2.
public string MapName { get; }Property Value
string
NavFlowMap
The loaded navigation flow map, null if it doesn't exist. Populated by WorldLoader.LoadNavigationFlowMap().
public NavFlowMapFile? NavFlowMap { get; set; }Property Value
NavMesh
The loaded navigation mesh, populated by WorldLoader.LoadNavigationMesh().
public NavMeshFile? NavMesh { get; set; }Property Value
NavSpace
The loaded navigation space, null if it doesn't exist. Populated by WorldLoader.LoadNavigationSpace().
public NavSpaceFile? NavSpace { get; set; }Property Value
NavigationHullNames
The names of the navigation hulls in hull index order, populated by WorldLoader.LoadNavigationMesh().
public string[] NavigationHullNames { get; set; }Property Value
string[]
SpawnCameraMatrix
Camera transform for the best spawn marker entity found, per WorldLoader.SpawnCameraClasses priority, with eye height already applied to ground markers.
public Matrix4x4? SpawnCameraMatrix { get; }Property Value
World
The world resource being loaded.
public World World { get; }Property Value
WorldNodeBounds
Gets the bounds of the objects loaded from the world nodes, or an empty box when there are none.
public AABB WorldNodeBounds { get; }Property Value
Methods
GetSpawnGroupMapName(string)
Converts a targetmapname keyvalue to a map path without extension, e.g. prefabs/misc/team_select to maps/prefabs/misc/team_select.
public static string GetSpawnGroupMapName(string targetMapName)Parameters
targetMapName string
Returns
string
GetWorldNameFromMap(string)
Returns the path to the world resource (.vwrld) for a given map name.
public static string GetWorldNameFromMap(string mapName)Parameters
mapName string
Path to the map, with or without the compiled file suffix.
Returns
string
Load(ResourceExtRefList?)
Loads all world components and spawns the map's entities as its spawn group. See WorldLoader.LoadEntities().
public void Load(ResourceExtRefList? mapResourceReferences = null)Parameters
mapResourceReferences ResourceExtRefList?
Optional external reference list from the map resource, used to preload assets in parallel.
LoadBombDamageData()
Loads CS2 baked bomb damage data for this world. Populates WorldLoader.BombDamage. Skips loading if WorldLoader.BombDamage is already set.
public void LoadBombDamageData()LoadEntities()
Spawns the map's entities from its entity lumps, as a spawn group that becomes the active one when there is none. Called again once the entities it spawned have been removed, they spawn as they did when the map loaded: the 3D sky and the other maps they place load again, reusing the geometry of the prefabs that is still in the scene.
public void LoadEntities()LoadMap(string, Scene, EntitySystem, Matrix4x4?)
Loads a map by name, performing a full load of all world components, then spawns its entities.
public static WorldLoader LoadMap(string mapResourceName, Scene scene, EntitySystem entitySystem, Matrix4x4? rootTransform = null)Parameters
mapResourceName string
Path to the .vmap or .vmap_c resource.
scene Scene
The scene to load the world into.
entitySystem EntitySystem
The entity world this map's entities spawn into.
rootTransform Matrix4x4?
Transform applied to the whole map, identity when null.
Returns
LoadNavigationFlowMap()
Loads the navigation flow map for this world. Populates WorldLoader.NavFlowMap. Skips loading if WorldLoader.NavFlowMap is already set.
public void LoadNavigationFlowMap()LoadNavigationMesh()
Loads the navigation mesh for this world. Populates WorldLoader.NavMesh. Skips loading if WorldLoader.NavMesh is already set.
public void LoadNavigationMesh()LoadNavigationSpace()
Loads the navigation space for this world. Populates WorldLoader.NavSpace. Skips loading if WorldLoader.NavSpace is already set.
public void LoadNavigationSpace()LoadWorldLightingInfo()
Loads lightmap and lighting information from the world into the scene.
public void LoadWorldLightingInfo()LoadWorldNodes()
Loads all world nodes (.vwnod_c) referenced by the world into the scene.
public void LoadWorldNodes()LoadWorldPhysics()
Loads world physics collision geometry into the scene.
public void LoadWorldPhysics()LoadWorldVisibility()
Loads world voxel visibility (.vvis_c) into the scene.
public void LoadWorldVisibility()ParallelPreloadResources(ResourceExtRefList?)
Preloads referenced resources in parallel using the map's external reference list. This is called automatically by WorldLoader.Load(ResourceExtRefList?) and does not need to be called manually.
public void ParallelPreloadResources(ResourceExtRefList? mapResourceReferences = null)Parameters
mapResourceReferences ResourceExtRefList?
External reference list from the map resource, used to preload models and entity icons.

