Porting GoldSrc maps to Source: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(cleanup)
Line 1: Line 1:
{{cleanup}}
Any [[GoldSrc]] mapper looking to start working with Source has given thought to porting over their existing work. Generally the easy way to do this is to load the .RMF into the new [[Hammer]] and update the textures and entities. If that isn't available, this tutorial shows how to port a map from a decompile.


{{note|If the map you want to port is open-source, use the map file provided to load into Hammer. If an RMF file is provided, it has to be saved as a map file using the old Hammer.}}
==Tools==


This is what had the most amount of attention right after Source came out.  People wanted to port their old 1.3 maps to source, or, people wanted to "help" someone else by doing it for them.  To do this little hack you will need [[BSP2MAP]] or [[BSP Viewer]] and [[MapFool]], as well as all the wads that the map uses (texture packs).
Many tools exist for the purpose of decompilation and porting, but the ones we're looking at are called [[BSP2MAP|BSP2Map]] (decompile) and [[MapFool]] (update). Be sure all the [[WAD|WADs]] needed for the map are handy.
If you use [[BSP2MAP]] then go into the command prompt (Start->Run->type cmd) and navigating to the folder BSP2MAP is in.  Run the program with the argument being the filename of the map (including .bsp) you want to decompile.  If it succeeds, you're in.


The other option is to use [[BSP Viewer]].  Run the program and load the map you want.  Then goto File->Export->Map File, and the program will generate a map file for you.  This program will generate a map file for all maps, so you do not have to worry about a windows error like in [[BSP2MAP]], however, this program does not produce the best quality map files.  More solids are lost and even worse, it creates irregular spacing in the file that neither hammer nor [[MapFool]] can read.  Once you get the map file you will need to go into the file and replace all the spaces with nothing.  You can do this by opening notepad and replacing all <nowiki>"&nbsp;&nbsp;"</nowiki>(double space) with nothing.  Notepad does this really slow so you will probably want to do it overnight, or you can get a better program that does search and replace faster. 
==Decompilation==


So now that you have a brand new .map you can load it into hammer and look around. Pretty devastating isn't it? All those grey walls...  But this is where MapFool steps up to the plate.  Close hammer and open MapFool.  Load your map into the program and you are confronted by a big text box with all the raw data.  There is only one line in all this mess you should be worried about. Look just below '''mapversion''' and you will see '''wad''' and a list of wad files. Hopefully you know where all these are because now is when you need them. Click File->Options and hit the "Add" button to add your wad files.  After you think you got them all, go just below that list and enter the vtex path and the texture's folder path.
As BSP2Map is a command line utility, run it from the Command Prompt with the BSP in question as an argument (e.g. <code>bsp2map c1a0.bsp</code>).


Next you are going to want to use the Tools->Upgrade Obsolete Entities program to do just that, update all the func_walls and such that source does not use. 
[[Image:Ava d.jpg|thumb|250px|A decompiled copy of <code>dod_avalanche</code> without fixed textures]]


Now the fun part, go to Tools->Export Textures to TGA and export them to a folder with a bit of space and memerable <!--memerable: can't understand what this means!-->.  Next go to the item below that called "Make Materials..." in the text box labeled TGA files, navigate to the folder you just exported all those textures to and you should see a list of files appear in the list box below.  You'll notice some textures are red and have some text saying they are not powers of two.  This is because source requires all textures to have sides that are exactly 2, 4, 8, 16, 32, 64, 128, 256, 512, or 1024.  A bit annoying really because if you are lucky, about half of the textures you need are that size.
None of the textures will exist in the map, so you'll have to use MapFool to update their location. Load your map into MapFool and load the WADs and .map into it. After loading all the WADs, point MapFool towards the location of your copy of [[Vtex]] and where you want it to dump all your textures.


[[Image:Ava d.jpg|thumb|250px|A snap shot of ''avalanche'' from DoD 1.3, decompiled and loaded into Hammer]]
Using "Upgrade Obsolete Entities" from the Tools menu, change any obsolete or deprecated entities to their Source counterparts (<code>[[func_illusionary]]</code> turns into <code>[[func_brush]]</code> entities with the solidity turned off, for example).


If you want these textures to show up in hammer, just navigate to that folder containing all the TGAs and open the ones that are not powers of two in Photoshop.  Then its just a simple matter of making both sides a power of two.
==Porting textures==


Export all the textures in the WADs to TGA. Navigate to it and turn them into [[material|materials]] using Vtex. Some textures can't be converted right away because Source requires all textures to be in powers of two. Any irregularly sized textures will need to be resized in an image editor before recompilation. 


Assuming everything was put in its proper place, you should have an almost perfect replica of your favorite HL1 map.  Don't compile right off the bat, however. The way BSP2Map works is that, instead of creating one solid, it creates six very thin solids. This almost certainly will lead to broken solids and going way over [[VBSP|VBSP's]] compile limit.


After that's all cleared up go ahead and click proceed in the options box and watch as MapFool converts all the textures in the map to materials that will show up in hammer.
You'll have to fix all of this yourself, unfortunately. Half-Life 2 BSPs solve the problem by saving the original solids in the map, so it's simply a matter of extracting them.


If you open your map in Hammer now, (hopefully you exported those textures into a folder that Hammer will look in, i.e. in the source <code>cstrike\materials</code> folder), the map should look a bit more complete. If everything is still grey then you might have to go back into MapFool and use Tools->Texture Folder name->Prepend to prepend the character "/" onto each texture name.  What usually happens is Hammer looks for the textures in <gamedir>/materials and not <gamedir>/materials/ a small difference, but one that will come back to bite you. 
==External Links==
 
*[http://www.dodbits.com/dods/index.php/hl2-mapping/61-porting-old-half-life-1-maps Dodbits' tutorial on porting maps]
When all is said and done, you should have an almost perfect replica of your favorite HL1 map.  Do not try and compile it right off the bat, you might have gotten a warning message from Hammer saying it wasn't able to load a X amount of solids.  That is because BSP2MAP and BSP Viewer have to reconstruct all the brushes and no program can do that big of a task and not get something wrong.  The way these programs work is instead of creating real solids, it creates faces of solids.  A box in a HL1 map turns into 6 1 unit thick walls after being decompiled.  This causes a number of errors in Hammer, the major one being the max vertice count and max brush count.  As both of those are pretty much guaranteed to be exceeded. 
 
After you take a good look at this map, and you are still determined to port it, then you will have to go through and stretch all the 1 unit thick walls into their proper places as real solids.  That means for a box you will have to stretch one side of it and delete the other 5 walls.  Needless to say, this is the reason why there are only a few Half-Life 1 to Source ports.
 
To understand why this happens you need to understand the format of a map file, and how hammer and the HL1 engine reads maps, which is beyond the scope of this article. If you are terribly interested however, post something and there might be an article written later about it.
 
 
'''Link:''' Another way to Port Half-Life 1 maps. A Plan View image and Entities only: [http://www.dodbits.com/dods/index.php/hl2-mapping/61-porting-old-half-life-1-maps dodbits.com Porting a HL1 map to Source]

Revision as of 15:56, 19 December 2013

Any GoldSrc mapper looking to start working with Source has given thought to porting over their existing work. Generally the easy way to do this is to load the .RMF into the new Hammer and update the textures and entities. If that isn't available, this tutorial shows how to port a map from a decompile.

Tools

Many tools exist for the purpose of decompilation and porting, but the ones we're looking at are called BSP2Map (decompile) and MapFool (update). Be sure all the WADs needed for the map are handy.

Decompilation

As BSP2Map is a command line utility, run it from the Command Prompt with the BSP in question as an argument (e.g. bsp2map c1a0.bsp).

A decompiled copy of dod_avalanche without fixed textures

None of the textures will exist in the map, so you'll have to use MapFool to update their location. Load your map into MapFool and load the WADs and .map into it. After loading all the WADs, point MapFool towards the location of your copy of Vtex and where you want it to dump all your textures.

Using "Upgrade Obsolete Entities" from the Tools menu, change any obsolete or deprecated entities to their Source counterparts (func_illusionary turns into func_brush entities with the solidity turned off, for example).

Porting textures

Export all the textures in the WADs to TGA. Navigate to it and turn them into materials using Vtex. Some textures can't be converted right away because Source requires all textures to be in powers of two. Any irregularly sized textures will need to be resized in an image editor before recompilation.

Assuming everything was put in its proper place, you should have an almost perfect replica of your favorite HL1 map. Don't compile right off the bat, however. The way BSP2Map works is that, instead of creating one solid, it creates six very thin solids. This almost certainly will lead to broken solids and going way over VBSP's compile limit.

You'll have to fix all of this yourself, unfortunately. Half-Life 2 BSPs solve the problem by saving the original solids in the map, so it's simply a matter of extracting them.

External Links