User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mapping:cawe:leaks [2007-06-07 21:06]
Carsten Overall enhancement of the text
mapping:cawe:leaks [2015-05-18 22:09] (current)
Line 6: Line 6:
 ===== What is a Leak? ===== ===== What is a Leak? =====
  
-Maps created for the Ca3D-Engine ​are preprocessed by several compile tools (e.g. CaBSP, CaPVS, CaLight) for optimal performance. These compile tools assume that any map has an inside (where the player and monsters are), and an outside that nobody except for the mapper will ever see. The inside must be //sealed "​air-tight"​ or "​water-tight"//​ from the outside. ​+Maps created for the Cafu engine ​are preprocessed by several compile tools (e.g. CaBSP, CaPVS, CaLight) for optimal performance. These compile tools assume that any map has an inside (where the player and monsters are), and an outside that nobody except for the mapper will ever see. The inside must be //sealed "​air-tight"​ or "​water-tight"//​ from the outside.
  
 That is, if you imagine you flood-filled the map from the inside with water or pressurized air, at no point must the water or air be able to escape to the outside. Therefore, each place where that would be possible is called a //leak//. That is, if you imagine you flood-filled the map from the inside with water or pressurized air, at no point must the water or air be able to escape to the outside. Therefore, each place where that would be possible is called a //leak//.
Line 38: Line 38:
  
 {{ :​mapping:​cawe:​leak_example_terrains.png|Terrains don't seal the map, the caulk material must be employed.}} {{ :​mapping:​cawe:​leak_example_terrains.png|Terrains don't seal the map, the caulk material must be employed.}}
-==== Terrains ​and Bezier Patches ​don't seal the map ====+==== TerrainsBezier Patches ​and Entities ​====
  
 Terrain and Bezier Patch primites //never// seal the map, even if their material is solid. Terrain and Bezier Patch primites //never// seal the map, even if their material is solid.
 Therefore, if you dragged the terrain in this example to cover the entire floor, you still cannot expect it to prevent the map from leaking. Therefore, if you dragged the terrain in this example to cover the entire floor, you still cannot expect it to prevent the map from leaking.
  
-Insteadas shown in the image, the proper solution is to use the ''​Textures/​meta/​caulk''​ and other materials like walls and skies to make a "​room"​ around such primitives ​that completely contains them. The ''​Textures/​meta/​caulk''​ material is especially useful in such cases because it seals the map but doesn'​t render (is invisible) in the engine later.+The same is true for //brush entities//i.e. entities that are made from brushes. For example, if you make a ''​func_wall''​ or ''​func_door''​ entity and place it so that it appears to contribute to the outside wall, CaBSP will still report a leak, because only the global "​world"​ brushes are taken into account for the sealing hull. 
 + 
 +As shown in the image, the proper solution is to use the ''​Textures/​meta/​caulk''​ and other materials like walls and skies to make a "containing ​room" around such primitives ​and entities. The ''​Textures/​meta/​caulk''​ material is especially useful in such cases because it seals the map but doesn'​t render (is invisible) in the engine later.
  
 The [[mapping:​cawe:​editingtools:​newterrain|New Terrain tool]] assists you with constructing new terrains that have a proper containing room right from the start, and you may want to have a look at the ''​TechDemo.cmap''​ for a properly sealed terrain example. The [[mapping:​cawe:​editingtools:​newterrain|New Terrain tool]] assists you with constructing new terrains that have a proper containing room right from the start, and you may want to have a look at the ''​TechDemo.cmap''​ for a properly sealed terrain example.
Line 53: Line 55:
  
 Sometimes leaks can also be caused by bad brushes like the one shown in this example (click image to enlarge). Sometimes leaks can also be caused by bad brushes like the one shown in this example (click image to enlarge).
-Such leaks are the most problematic:​ They are very hard to see visually, and they can get CaBSP thoroughly confused((If you ever experience such a case and cannot get it fixed by remaking the offending brushes, ​send an email to Carsten Fuchs for support. Please include the related map as an attachment.)).+Such leaks are the most problematic:​ They are very hard to see visually, and they can get CaBSP thoroughly confused((If you ever experience such a case and cannot get it fixed by remaking the offending brushes, ​[[http://​forum.cafu.de|let us know]]. Please include the related map as an attachment.)).
 Even worse, usually not much helps but deleting the offending brush, and make it anew with the [[mapping:​cawe:​editingtools:​newbrush|New Brush]] and other tools. Even worse, usually not much helps but deleting the offending brush, and make it anew with the [[mapping:​cawe:​editingtools:​newbrush|New Brush]] and other tools.
  
Line 70: Line 72:
  
 A leak is a hole in the world, where the inside of it is exposed to the A leak is a hole in the world, where the inside of it is exposed to the
-(unwanted) outside region. Thus, I generated ​a leak pointfile. +(unwanted) outside region. Thus, a leak pointfile ​has been generated
-Load this file into CaWE, and find the beginning of the line.+Load this file into the world editor ​CaWE, and find the beginning of the line.
 Hint: The beginning is always near one of the "​info_player_start"​ entities. Hint: The beginning is always near one of the "​info_player_start"​ entities.
 Then find and fix the leak by tracing the line until you reach the outside. Then find and fix the leak by tracing the line until you reach the outside.
-(always ​take the shortest path, so this should be easy.)+(The line always ​takes the shortest path, so this should be easy.)
  
 Notes: Notes:
Line 80: Line 82:
 - Use the grid. The grid is useful to fix leaks + to avoid them from the start. - Use the grid. The grid is useful to fix leaks + to avoid them from the start.
 - Make sure that *all* "​info_player_start"​ entities are inside the world! - Make sure that *all* "​info_player_start"​ entities are inside the world!
 +- Be aware that both the clip hull and the draw hull must be sealed.
 - Please refer to the documentation for additional information. - Please refer to the documentation for additional information.
  
Line 85: Line 88:
  
 FATAL ERROR: Stopped by leak. FATAL ERROR: Stopped by leak.
-Program aborted. ​+Program aborted.
 </​code>​ </​code>​
  
-That means that with a leak in the map, you cannot run the map at all. As CaBSP doesn'​t write any output file in this case (except for the above mentioned pointfile), neither the subsequent compilers (CaPVS and CaLight), nor the Ca3D-Engine ​itself can run the map.+That means that with a leak in the map, you cannot run the map at all. As CaBSP doesn'​t write any output file in this case (except for the above mentioned pointfile), neither the subsequent compilers (CaPVS and CaLight), nor the Cafu engine ​itself can run the map.
  
-Future versions of CaBSP may reduce the severity level of the occurrence of a leak from an error to a mere warning. This will allow you to run your map with Ca3DE even if it has leaks, but nonetheless will leaks remain a problem that should be fixed. Leaks always indicate that the map could not be optimally processed, and thus imply higher polygon counts and lower performance.+Future versions of CaBSP may reduce the severity level of the occurrence of a leak from an error to a mere warning. This will allow you to run your map with Cafu even if it has leaks, but nonetheless will leaks remain a problem that should be fixed. Leaks always indicate that the map could not be optimally processed, and thus imply higher polygon counts and lower performance.
  
-The next section will tell you how to find and fix the leaks reported by CaBSP.+The next section will tell you how to find the leaks reported by CaBSP in the map.
  
  
-===== Finding and Fixing ​Leaks =====+===== Locating ​Leaks in the Map =====
  
 Finding leaks is very easy: When CaBSP reports that it found a leak (see example error message and description above), it also creates a corresponding //​pointfile//​. Finding leaks is very easy: When CaBSP reports that it found a leak (see example error message and description above), it also creates a corresponding //​pointfile//​.
 A pointfile is an auxiliary file that contains the description of a trail from one of the ''​info_player_start''​ entities to the outside. The leak is always located somewhere along that path. A pointfile is an auxiliary file that contains the description of a trail from one of the ''​info_player_start''​ entities to the outside. The leak is always located somewhere along that path.
  
-For loading the pointfile into CaWE, simply ​load the relevant map into CaWE if you haven'​t already, then select the **Map -> Load Pointfile** menu item. CaWE assumes that you'll want to load the recently created pointfile for the currently open map, and thus ask for confirmation:​ +For loading the pointfile into CaWE, simply ​open the relevant map in CaWE (**File -> Open...**, ​if you haven'​t already), then select the **Map -> Load Pointfile** menu item. CaWE assumes that you'll want to load the recently created pointfile for the currently open map, and thus asks for confirmation, e.g. like this: \\ 
-\\ FIXME Insert ​dialog ​image here.+{{:​mapping:​cawe:​leak_loaddefaultpointfile.png |Load the default pointfile?​}} Click "​Yes"​ ("​Ja"​) to open the suggested default pointfile, which is normally the desired action. Clicking "​No"​ ("​Nein"​) will open a file selection ​dialog ​where you can choose a different file or cancel<​clear>​
  
-Here are example screenshots of a pointfile that has been loaded into an unfinished map: \\ +Here are example screenshots of a pointfile that has been loaded into an (unfinishedmap: \\ 
-{{:​mapping:​cawe:​leak_pointfile1.png?​200}} {{:​mapping:​cawe:​leak_pointfile2.jpg?​197}} (Click on the images to enlarge them.)+{{:​mapping:​cawe:​leak_pointfile1.png?​300 |An example of a loaded pointfile.}} {{:​mapping:​cawe:​leak_pointfile2.jpg?​296 |An example of a loaded pointfile.}} (Click on the images to enlarge them.) ​<​clear>​ 
 + 
 +Use the 2D views and especially the 3D camera view (see [[mapping:​cawe:​views]] for details) to follow the trail from the starting point near one of the ''​info_player_start''​ entities to the place where the line leaves the inside of the map and escapes to the outside. Fix the so found leak however seems appropriate.
  
 You may notice that loading the pointfile can decrease the rendering performance in CaWE, especially if the trail is very long. Therefore, once you've found the leak, you can unload the pointfile again by selecting the **Map -> Unload Pointfile** menu item. You may notice that loading the pointfile can decrease the rendering performance in CaWE, especially if the trail is very long. Therefore, once you've found the leak, you can unload the pointfile again by selecting the **Map -> Unload Pointfile** menu item.
 +
 +Finally, restart the compilation (CaBSP) to check if the map is now completely sealed or if there are more leaks.
  
  
 ===== Preventing Leaks ===== ===== Preventing Leaks =====
  
-FIXME This section ​is currently under construction.+The best way to deal with leaks is to prevent them right from the start. 
 +Here is a list of suggestions and considerations in this regard:
  
-CaBSP has become very good in reliably detecting leaks, ​and when CaBSP aborts compiling ​and complains about leaks+  - Use the grid (**Map -> Show grid**) ​and turn on grid snapping (**Map -> Snap to grid**). \\ The grid and grid snapping are your most powerful allies ​when it comes to see and avoid leaks while you're constructing your map. 
-it makes pretty clear in its error message what's going on.+  - Run the **Map -> Check for Problems** menu item occassionally and before compiling your map. 
 +  - Avoid all tools that potentially introduce rounding errors and thus misaligned brushes. As a gross guideline, all tools that operate ​on the grid and that are supposed to //produce results on the grid// are usually safe, such as resizing rectangular blocks, shearing, vertex manipulation,​ mirroring, clipping and carving. The following operations are sometimes less safe: Arbitrary (any angle) rotation and clipping and carving when the result has vertices that are off-grid. \\ For less-safe operations it is often better to try to mimic the same effect with the safer operations. For example, when you want to carve an arched door into a wall, cutting and placing the wall brushes manually is often better than employing the (more convenient) **Tools -> Carve** tool.
  
-However, if this is your first leak, I'd much recommend to read the great explanation in the Hammer online help +Note that leaks are //**not**// :!: prevented or fixed by putting the //entire map// into a big boxeven if the strategy that has been suggested above for working properly with terrains might make you think so. Although putting everything into a big box will make CaBSP compile ​the map successfully and thus seemingly ​fix the leak, the problems associated with a leak (e.g. high polygon count and bad performance) will persistThis is not solution.
-in the Troubleshooting section: "How do I fix leaks in my level?"​. +
-It also teaches you what leaks are and how you can prevent them. +
-Here are few additional remarks that might be helpful:+
  
-  - Run **Check for Problems** from the CaWE **Map** menu. 
-  - Do never assume that translucent or detail entities seal your world. Sky brushes do. 
-  - Carefully look for misaligned brushes. In my experience, the "​Carve"​ tool, rotation and certain other operations easily cause rounding errors which in turn cause leaks. 
-  - The best you can do is to //prevent// leaks from the very beginning by using the grid and avoiding all tools that potentially introduce rounding errors. As a gross guideline, all operations that operate on the grid and that are guaranteed to produce //​vertices//​ on the grid are usually safe, such as resizing rectangular blocks, shearing, vertex manipulation (although that can introduce other errors, which can be identified with the **Check for Problems** item from the **Map** menu), mirroring, and clipping and carving, when the resulting vertices are on-grid. The following operations are usually less safe: Arbitrary rotation, and clipping and carving, when the result has vertices that are off-grid. \\ For less-safe operations it is usually better to try to mimic the same effect with the safer operations. For example, when you want an arched door in a wall, creating and placing the wall brushes manually is much preferred over carving an irregular hole into the wall! 
  
-Finally, let me mention a //very// rare situation in which CaBSP reports no leakbut a leak is present: +===== Conclusion ===== 
-The symptoms ​of such unreported ​leaks are a blank screen when you load the world in Ca3DE, + 
-only environmental background is displayedor you are falling through ​the floor and everything disappears after a few seconds+Being able to load the CaBSP-generated pointfiles directly into CaWE makes finding and fixing leaks relatively easy. Howeverone of the most important aspects about fixing ​leaks is to prevent them right from the start. 
-Such leaks occur sometimes when some old BSP decompile tools that are still available on the internet, + 
-produce world geometry that is so degenerate that not even CaBSPs rounding error control ​and validity tests can help it. +Working carefully and making sure that brushes ​are properly aligned (snapped) to the grid can help significantly with avoiding leaks even before they occur. The cleaner and more organized ​you build your geometry, ​the easier will it be for you to not build them accidently into your map in the first placeand when they still occur, the easier they are to locate ​and fix
-It is possible ​to remedy such cases automaticallybut I will write description for the process only should + 
-somebody actually ever experience this problem.+In generalit's also a good idea to occasionally test-compile your map while it is only partially complete ​and still a work-in-progressBesides that this will help you to fine-tune your geometryit will also point out leaks one at time, which makes finding and fixing a lot simpler and faster than later when your map is large and fully detailed. 
 + 
 + 
 +===== See Also ===== 
 + 
 +[[http://​www.cafu.de/​flash/​Dealing_with_Leaks.htm|{{:​starttutorial.png |Start Tutorial}}]] 
 + 
 +[[http://​www.cafu.de/​flash/​Dealing_with_Leaks.htm|Flash Tutorial]] -- A short flash tutorial that presents the essentials about dealing with leaks. 
 +<​clear>​
  
mapping/cawe/leaks.1181243167.txt.gz · Last modified: 2013-01-07 12:07 (external edit)