Garry's Mod Wiki

Revision Difference

Mapping_Resources#565539

<cat>Dev.Map</cat> <title>Mapping Resources</title> Since this wiki focuses on Garry's Mod-specific content and mapping is a more general topic, we have compiled a list of useful and relevant resources for up-and-coming mappers to dig into since much of this knowledge has become rather obscure due to its old age. Some of the information you will encounter on this page dates back to the Quake era of the Source engine. As you may know, the Source engine - and by extension, Garry's Mod - traces its roots, directly or indirectly, to the Quake engine. As such, the following conceptual information can still be useful for those trying to understand modern-day Source engine. Some of the information you will encounter on this page dates back to the Quake era of the Source engine. As you may know, the Source engine - and by extension, Garry's Mod - traces its roots, directly or indirectly, to the Quake engine. As such, the following conceptual information can still be useful for those trying to understand the modern-day Source engine. All of the following links lead to external sites. Use caution. # Mapping Articles ## Will2k Collection Will2k is an older mapper who doesn't appear to be active anymore but has left behind some invaluable documentation on just about everything about the source engine through his journey to optimize the source engine. You can find his own roadmap of what to follow here: Will2k is an older mapper who doesn't appear to be active anymore, but has left behind some invaluable documentation on just about everything about the Source engine through his journey to optimize it. You can find his own roadmap of what to follow here: - [Will2k Source Engine Optimization Roadmap](https://www.mapcore.org/topic/20087-source-engine-optimization-roadmap/) ⤶ some links link to a gamebanana page which have a pdf download at the bottom. ⤶ ---⤶ Some links lead to Gamebanana pages which have a .pdf download at the bottom. ⤶ ⤶ ---⤶ ## Binary Space Partitioning (BSP) Binary Space Partitioning is what the source engine uses to describe information about the level. During a map compile the compiler will recursively subdivide a space into sets of convex shapes (called leaves) which will either be entirely solid or entirely empty and then stores these subdivision's in memory as a tree. Every plane that splits an area will create 2 new nodes in this tree representing the front and backside of the split area. The backside of this area will be the first node and the front side will be the second. This subdivision is done recursively until every area is solid or empty. ⤶ This is most notably important for two areas of the source engine. PVS and collision. Binary Space Partitioning is what the Source engine uses to describe information about levels. During a map compile, one of the compilers will recursively subdivide a space into sets of convex shapes (called leaves), which will either be entirely solid or entirely empty, and then stores these subdivisions in memory as a tree. Every plane that splits an area will create 2 new nodes in this tree, one representing the front and the other representing backside of the split area. The backside of this area will be the first node and the front side will be the second. This subdivision is done recursively until every area is solid or empty. ⤶ BSP is most notably important for two areas of the Source engine: PVS and collision. ### Relevant Resources - [Matt Ramblings: BSP Trees: The Magic Behind Collision Detection in Quake](https://www.youtube.com/watch?v=wLHXn8IlAiA) - [Will2k Man vs Engine](https://gamebanana.com/tuts/11178) - [Valve Developer Wiki BSP Page](https://developer.valvesoftware.com/wiki/BSP_(Source)) - [Valve Developer Community page on Binary Space Partitioning](https://developer.valvesoftware.com/wiki/Binary_space_partitioning) - [Valve Developer Community page on the .bsp file format](https://developer.valvesoftware.com/wiki/BSP_(Source))⤶ - [Flipcode Quake 2 BSP File Format](https://www.flipcode.com/archives/Quake_2_BSP_File_Format.shtml) *This covers how BSP is implemented in code but could potentially be useful to some* --- ## Potentially Visible Set (PVS) As mentioned above, The source engine uses BSP data to calculate its visuality. Each time the area is subdivided into a convex shape this shape is now called a "leaf". Each leaf then has a set of triangles associated with it which will render if that leaf can be seen. This is determined by the "Precomputed Visibility List" for the players current leaf. During compile times each leaf uses an algorithm to trace what it can see through "portals" (where each of these leaves touch) to other leaf's and then associates them with that leaf into the "Potentially Visible Set". This means that as the player moves from leaf to leaf the engine only needs to worry about rendering what's in the PVS and leave the rest unrendered saving on performance. As mentioned above, the Source engine uses BSP data to calculate its visibility. Each time the area is subdivided into a convex shape this shape is now called a "leaf". Each leaf then has a set of triangles associated with it, which will render if that leaf can be seen. This is determined by the "Precomputed Visibility List" for the players current leaf. During compilation, each leaf uses an algorithm to trace what it can see through "portals" (where each of these leaves touch) to other leaves and then associates them with that leaf into the "Potentially Visible Set". This means that as the player moves from leaf to leaf, the engine only needs to worry about rendering what's in the PVS and leave the rest unrendered, thus saving on performance. ### Relevant Resources - [Matt Ramblings: Quake's PVS: A hidden gem of rendering optimization](https://www.youtube.com/watch?v=IfCRHSIg6zo&t=288s) - [Will2k: Demystifying Source Engine Visleaves](https://gamebanana.com/articles/71) - [Will2k: Source Engine PVS - A Closer Look](https://gamebanana.com/articles/72) - [Valve Developer Community page on PVS](https://developer.valvesoftware.com/wiki/PVS)⤶ --- ## Optimizing Source Levels The techniques used for optimizing source maps includes a few different practices. First and foremost there is level layout and design, which should occur before launching hammer. Source is best at rending indoors environments, large open areas where there is limited things blocking visibility in where source really starts showing its age. However that does not mean such levels are impossible, with modern hardware these large open environments can be run well enough now that computers are faster. The techniques used for optimizing Source maps include a few different practices. First and foremost, there is level layout and design, which should occur before launching Hammer. Source is best at rendering indoor environments, whereas in large open areas that don't have many things blocking visibility Source really starts showing its age. However, that does not mean such levels are impossible, as with modern hardware these large open environments can be ran well enough. Many of the below resources target multiple areas of optimization. Links listed under "layout" for example can include good tips for placing hint brushes as-well. Many of the below resources target multiple areas of optimization. Links listed under "layout" for example can as well include good tips for placing hint brushes. #### Relevant Resources: Layout - [Will2k: Optimizing An Open Map in Source Engine](https://www.mapcore.org/articles/development/optimizing-an-open-map-in-source-engine-r88/) - [Rick_D: Making Agency, the popular CS:GO map](https://www.mapcore.org/articles/development/making-agency-the-popular-csgo-map-r62/) - [FMPONE: Making a Map: CS_Museum](https://www.mapcore.org/articles/development/making-a-map-cs_museum-r25/) #### Relevant Resources: Hint Brushes - [Will2k: Hints about Hints - Practical guide on hint brushes placement](https://gamebanana.com/articles/59) - [MangyCarface: Optimization in Source: A Practical Demonstration](https://nodraw.net/2009/12/optimization-in-source-a-practical-demonstration/) - [Valve Developer Community page on hint brushes](https://developer.valvesoftware.com/wiki/Hint_brush)⤶ #### Relevant Resources: Area Portals - [Will2k: Practical guide on areaportals placement](https://gamebanana.com/articles/64) - [Valve Developer Community page on areaportals](https://developer.valvesoftware.com/wiki/Areaportal)⤶ #### Relevant Resources: Occluders - [Will2k: Practical Guide on Occluders Placement](https://gamebanana.com/articles/65) - [Valve Developer Community page on occluders](https://developer.valvesoftware.com/wiki/Occluder)⤶ #### Relevant Resources: Visclusters - - [Valve Developer Community page on func_viscluster](http://developer.valvesoftware.com/wiki/Viscluster) #### Relevant Resources: Lighting - [leplubodeslapin: Source Lighting Technical Analysis: Part One](https://www.mapcore.org/articles/development/source-lighting-technical-analysis-part-one-r65/) - [leplubodeslapin: Source Lighting Technical Analysis: Part Two](https://www.mapcore.org/articles/development/source-lighting-technical-analysis-part-two-r66/) - [Matt Ramblings: Shedding light on Quake I and II lightmapping](https://www.youtube.com/watch?v=bxientPsqRg) - source lighting is based on this technology until Source SDK 2018 - Source lighting is based on this technology until Source SDK 2018 #### Relevant Resources: Optimizations - [Will2k: Comparative fps study in Source Engine Optimization System](https://gamebanana.com/articles/69) - [Will2k: Displacement Vs. Func_detail - A comparative fps study](https://www.mapcore.org/articles/development/displacement-vs-func_detail-a-comparative-fps-study-r73/) - [Will2k: Source FPS Cost of Cheap and Expensive Assets](https://www.mapcore.org/articles/development/source-fps-cost-of-cheap-and-expensive-assets-r76/) - [Will2k: Common Misconceptions in Source Engine Optimization](https://gamebanana.com/articles/68) - [Valve Developer Community article on visibility optimization](https://developer.valvesoftware.com/wiki/Visibility_optimization)⤶ # Resource Banks This section Directs you to the homepage of other mapping centric communities. - [Interlopers.net](https://www.interlopers.net/forum/viewforum.php?f=11) - Links to the tutorials form section of the webpage where still many old useful articles can be found This section directs you to the homepages of other mapping-centered communities. - [Interlopers.net](https://www.interlopers.net/forum/viewforum.php?f=11) - Links to the tutorials form section of the webpage where many old useful articles can still be found - [MapCore Level Design Help Files](https://www.mapcore.org/topic/3598-level-design-help-files/) - Mapcore as a whole is a good mapping community, however I wanted to link directly to this post as itself links to MANY very useful mapping articles - [PHILIPK.NET](https://www.philipk.net/tutorials.html) - Very old website in near pure HTML, Navigate through the images, Still has useful information about the creation of materials and modular sets. - [Nodraw.net](https://nodraw.net/category/articles/) - Tutorials are from 2010 but listed due to having niche articles that arnt covered in other places - [PHILIPK.NET](https://www.philipk.net/tutorials.html) - Very old website in near pure HTML. Navigate using the images. This website has useful information about the creation of materials and modular sets. - [Nodraw.net](https://nodraw.net/category/articles/) - The tutorials are from 2010, but the website is listed due to having articles on niche topics that aren't covered elsewhere.⤶ ⤶ - [Valve Developer Community](developer.valvesoftware.com/wiki/) - Valve's official developer wiki that covers pretty much everything from GoldSrc to Source 2. There are lots of tutorials available there, but their quality and age may vary.