Source 2/Docs/Level Design/Import Tool Documentation: Difference between revisions
No edit summary |
SirYodaJedi (talk | contribs) m (Put name note in note) |
||
Line 3: | Line 3: | ||
As part of {{cs2|1|nt=0}}’s Workshop Tools, we have included a {{Python|3.1}} script for helping content creators to quickly port maps and assets over to {{source2|3.1}}. Before getting started there is some preparation work which must be done. | As part of {{cs2|1|nt=0}}’s Workshop Tools, we have included a {{Python|3.1}} script for helping content creators to quickly port maps and assets over to {{source2|3.1}}. Before getting started there is some preparation work which must be done. | ||
{{note|This guide originally pointed to {{Path|Steam\steamapps\common\counterstrike source 15\csgo}}, which seems to be an internal name for {{Path|Steam\steamapps\common\Counter-Strike Global Offensive\csgo}}<br>All paths in the guide have been modified to reflect what most users have in their file system.}} | |||
<br> | |||
<br | |||
=== Prerequisites === | === Prerequisites === | ||
==== Precompiled Content ==== | ==== Precompiled Content ==== | ||
Line 17: | Line 15: | ||
{{Note|Any custom content archived in a [[.bsp]] will need to be extracted into the appropriate folders before importing. The import tool also requires a [[.vmf|vmf]], so if you only have a [[.bsp|bsp]] for your map, you will need to decompile it to a [[.vmf|vmf]]. Finally, '''do not copy [[.vmf]] files to the above folder''' as it will confuse the import tool.}} | {{Note|Any custom content archived in a [[.bsp]] will need to be extracted into the appropriate folders before importing. The import tool also requires a [[.vmf|vmf]], so if you only have a [[.bsp|bsp]] for your map, you will need to decompile it to a [[.vmf|vmf]]. Finally, '''do not copy [[.vmf]] files to the above folder''' as it will confuse the import tool.}} | ||
<br | <br> | ||
==== Source Map Files ==== | ==== Source Map Files ==== | ||
Your map files ([[.vmf|vmf]]s) can live anywhere outside of {{Path|Counter-Strike Global Offensive}} as long as they are in a {{Path|maps}} folder. Any prefab or instance [[.vmf|vmf]]s referenced by your map must be in whatever subfolder structure is expected by the map. For example: | Your map files ([[.vmf|vmf]]s) can live anywhere outside of {{Path|Counter-Strike Global Offensive}} as long as they are in a {{Path|maps}} folder. Any prefab or instance [[.vmf|vmf]]s referenced by your map must be in whatever subfolder structure is expected by the map. For example: | ||
Line 25: | Line 23: | ||
* {{Path|c:\mymapfolder\maps\instances\mymapinsstance|vmf}} | * {{Path|c:\mymapfolder\maps\instances\mymapinsstance|vmf}} | ||
<br | <br> | ||
==== Source Texture Files ==== | ==== Source Texture Files ==== | ||
If you have uncompressed source files for textures, ([[.tga|tga]], [[wp:Photoshop Document|psd]], etc.) the import tool will try to use those when importing materials, otherwise it will fall back to converting and recompressing [[.vtf|vtf]] files (which can decrease texture quality). For this to be successful, make sure your source files are in a mirrored location of the [[.vtf|vtf]]s in {{Path|\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\materials}}. For example: | If you have uncompressed source files for textures, ([[.tga|tga]], [[wp:Photoshop Document|psd]], etc.) the import tool will try to use those when importing materials, otherwise it will fall back to converting and recompressing [[.vtf|vtf]] files (which can decrease texture quality). For this to be successful, make sure your source files are in a mirrored location of the [[.vtf|vtf]]s in {{Path|\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\materials}}. For example: | ||
Line 32: | Line 30: | ||
* {{Path|C:\mymapfolder\materials\mymaterial\mytexture|tga}} | * {{Path|C:\mymapfolder\materials\mymaterial\mytexture|tga}} | ||
<br | <br> | ||
== Getting Started == | == Getting Started == | ||
=== 1. Installing Python 2.7.14 === | === 1. Installing Python 2.7.14 === | ||
To run the import script you will need to install {{Python|3.1}} '''2.7.14''' which you can grab here: https://www.python.org/downloads/release/python-2714. | To run the import script you will need to install {{Python|3.1}} '''2.7.14''' which you can grab here: https://www.python.org/downloads/release/python-2714. | ||
<br | <br> | ||
=== 2. Setting Environment Variables === | === 2. Setting Environment Variables === | ||
Next you will need to set two environment path variables so that Windows knows where your {{Python|3.1|nt=0}} installation lives and other import libraries in the {{Path|Steam\steamapps\common\Counter-Strike Global Offensive\game\csgo\bin\win64}} folder: | Next you will need to set two environment path variables so that Windows knows where your {{Python|3.1|nt=0}} installation lives and other import libraries in the {{Path|Steam\steamapps\common\Counter-Strike Global Offensive\game\csgo\bin\win64}} folder: | ||
Line 54: | Line 52: | ||
{{Note|To be sure that the Path variables are applied properly, it may be necessary to restart your computer.}} | {{Note|To be sure that the Path variables are applied properly, it may be necessary to restart your computer.}} | ||
<br | <br> | ||
=== 3. Installing the Colorama Extension === | === 3. Installing the Colorama Extension === | ||
Next you will need a {{Python|3.1}} extension called colorama. To install this, simply open up a command prompt (search for cmd in Windows Start Menu) and type | Next you will need a {{Python|3.1}} extension called colorama. To install this, simply open up a command prompt (search for cmd in Windows Start Menu) and type | ||
Line 62: | Line 60: | ||
[[File:Maps colorama ext.png]] | [[File:Maps colorama ext.png]] | ||
<br | <br> | ||
=== 4. Creating a new Addon with the Workshop Tools === | === 4. Creating a new Addon with the Workshop Tools === | ||
Before running an import, you will need to create a Workshop Tools addon so that the imported content has a valid destination. To make a new addon, simply launch the game with Workshop Tools, and from the UI click "Create New Addon" and take note of the name for later. | Before running an import, you will need to create a Workshop Tools addon so that the imported content has a valid destination. To make a new addon, simply launch the game with Workshop Tools, and from the UI click "Create New Addon" and take note of the name for later. | ||
Line 68: | Line 66: | ||
[[File:Maps create addon.png]] | [[File:Maps create addon.png]] | ||
<br | <br> | ||
=== 5. Locating the Import Script === | === 5. Locating the Import Script === | ||
First up is locating the {{Python|3.1|nt=0}} import script, which can be found in the following folder: | First up is locating the {{Python|3.1|nt=0}} import script, which can be found in the following folder: | ||
Line 81: | Line 79: | ||
{{Note|There is also an experimental GUI called {{File|import_map_community_gui|exe}} more info on this can be found at the end of this document.}} | {{Note|There is also an experimental GUI called {{File|import_map_community_gui|exe}} more info on this can be found at the end of this document.}} | ||
<br | <br> | ||
=== 6. Running the Script + Parameters === | === 6. Running the Script + Parameters === | ||
Now you are ready to run the script by entering the following: | Now you are ready to run the script by entering the following: | ||
Line 87: | Line 85: | ||
{{CodeBlock|python import_map_community.py <s1gameinfopath> <s1contentpath> <s2gameinfopath> <s2addon> <mapname> -usebsp}} | {{CodeBlock|python import_map_community.py <s1gameinfopath> <s1contentpath> <s2gameinfopath> <s2addon> <mapname> -usebsp}} | ||
<br | <br> | ||
==== Script Parameters ==== | ==== Script Parameters ==== | ||
<br | <br> | ||
: '''<s1gameinfopath>''' | : '''<s1gameinfopath>''' | ||
: Path to folder containing [[Counter-Strike: Global Offensive|CS:GO]]'s [[gameinfo.txt]], this MUST be the path that contains the compiled [[Counter-Strike: Global Offensive|CS:GO]] model and material content you want to import (e.g. [[.mdl]], [[.vmt]]). | : Path to folder containing [[Counter-Strike: Global Offensive|CS:GO]]'s [[gameinfo.txt]], this MUST be the path that contains the compiled [[Counter-Strike: Global Offensive|CS:GO]] model and material content you want to import (e.g. [[.mdl]], [[.vmt]]). | ||
<br | <br> | ||
: '''<s1contentpath>''' | : '''<s1contentpath>''' | ||
: Path to folder containing source content, ([[.vmf]] [[wp:Photoshop Document|.psd]] [[.tga]] etc.). As mentioned above, for the importer to successfully find and use source texture files, make sure they are in a mirrored location to that of the [[.vtf]]s (see example above) | : Path to folder containing source content, ([[.vmf]] [[wp:Photoshop Document|.psd]] [[.tga]] etc.). As mentioned above, for the importer to successfully find and use source texture files, make sure they are in a mirrored location to that of the [[.vtf]]s (see example above) | ||
<br | <br> | ||
: '''<s2gameinfopath>''' | : '''<s2gameinfopath>''' | ||
: Path to folder containing {{cs2|1|nt=0}}'s gameinfo.gi | : Path to folder containing {{cs2|1|nt=0}}'s gameinfo.gi | ||
<br | <br> | ||
: '''<s2addon>''' | : '''<s2addon>''' | ||
: The name of {{cs2|1|nt=0}} Workshop addon that you created earlier. This is where your assets will be imported to. | : The name of {{cs2|1|nt=0}} Workshop addon that you created earlier. This is where your assets will be imported to. | ||
<br | <br> | ||
: '''<mapname>''' | : '''<mapname>''' | ||
: This is the map name ([[.vmf]]) without extension, e.g. de_examplemap that you wish to import. If your map sits under a subdirectory of the {{Path|maps}} folder in {{Code|<nowiki><s1contentpath></nowiki>}}. Be sure to add this path before your map name. For example: {{Path|my_maps/de_examplemap}} | : This is the map name ([[.vmf]]) without extension, e.g. de_examplemap that you wish to import. If your map sits under a subdirectory of the {{Path|maps}} folder in {{Code|<nowiki><s1contentpath></nowiki>}}. Be sure to add this path before your map name. For example: {{Path|my_maps/de_examplemap}} | ||
<br | <br> | ||
: '''-usebsp''' | : '''-usebsp''' | ||
: This runs the map through a special vbsp process to generate clean map geometry from brushes, removing hidden faces and stitching up edges, making the {{cs2|1|nt=0}} version easier to work with in {{Hammer|3.1}}. It preserves world (vis) brushes and {{Ent|func_detail}} brushes for compatibility with {{Source 2|3.1}}. This parameter will also merge all {{Ent|func_instance|alt = func_instances}} in your map. Note that the final geometry will be triangulated, but cleaning it up is a fairly simple process, which will be explained in another guide. | : This runs the map through a special vbsp process to generate clean map geometry from brushes, removing hidden faces and stitching up edges, making the {{cs2|1|nt=0}} version easier to work with in {{Hammer|3.1}}. It preserves world (vis) brushes and {{Ent|func_detail}} brushes for compatibility with {{Source 2|3.1}}. This parameter will also merge all {{Ent|func_instance|alt = func_instances}} in your map. Note that the final geometry will be triangulated, but cleaning it up is a fairly simple process, which will be explained in another guide. | ||
<br | <br> | ||
: '''-usebsp_nomergeinstances''' | : '''-usebsp_nomergeinstances''' | ||
: Use this instead of {{Code|-usebsp}} if you wish to both generate clean geo and also preserve {{Ent|func_instance|alt = func_instances}}. Note that this takes a little longer as it has to run through the import process twice. The final geometry will also be triangulated. | : Use this instead of {{Code|-usebsp}} if you wish to both generate clean geo and also preserve {{Ent|func_instance|alt = func_instances}}. Note that this takes a little longer as it has to run through the import process twice. The final geometry will also be triangulated. | ||
<br | <br> | ||
: '''-skipdeps''' | : '''-skipdeps''' | ||
: Optional: skips importing all dependencies/content and only generates the vmap file(s). This provides a 'quick' import when iterating entities for example. Do not run with this if you are importing for the first time. | : Optional: skips importing all dependencies/content and only generates the vmap file(s). This provides a 'quick' import when iterating entities for example. Do not run with this if you are importing for the first time. | ||
<br | <br> | ||
'''Example:''' | '''Example:''' | ||
{{CodeBlock|<nowiki>python import_map_community.py "C:\Steam\steamapps\common\Counter-Strike Global Offensive\csgo" "c:\map_sources\" "C:\Steam\steamapps\common\Counter-Strike Global Offensive\game\csgo" de_example_cs2 de_examplemap -usebsp</nowiki>}} | {{CodeBlock|<nowiki>python import_map_community.py "C:\Steam\steamapps\common\Counter-Strike Global Offensive\csgo" "c:\map_sources\" "C:\Steam\steamapps\common\Counter-Strike Global Offensive\game\csgo" de_example_cs2 de_examplemap -usebsp</nowiki>}} | ||
<br | <br> | ||
=== Experimental GUI === | === Experimental GUI === |
Revision as of 15:00, 12 June 2023
Import Tool Documentation
As part of CS2’s Workshop Tools, we have included a Python script for helping content creators to quickly port maps and assets over to Source 2. Before getting started there is some preparation work which must be done.


Steam\steamapps\common\counterstrike source 15\csgo
, which seems to be an internal name for 
Steam\steamapps\common\Counter-Strike Global Offensive\csgo
All paths in the guide have been modified to reflect what most users have in their file system.
Prerequisites
Precompiled Content
Precompiled content (such as any custom vmt, vtf, mdl, etc.) must be located in the Steam\steamapps\common\Counter-Strike Global Offensive\csgo
folder. For example:
Steam\steamapps\common\Counter-Strike Global Offensive\csgo\materials
Steam\steamapps\common\Counter-Strike Global Offensive\csgo\models

Source Map Files
Your map files (vmfs) can live anywhere outside of Counter-Strike Global Offensive
as long as they are in a maps
folder. Any prefab or instance vmfs referenced by your map must be in whatever subfolder structure is expected by the map. For example:
c:\mymapfolder\maps\mymap.vmf
c:\mymapfolder\maps\prefabs\mymapprefab.vmf
c:\mymapfolder\maps\instances\mymapinsstance.vmf
Source Texture Files
If you have uncompressed source files for textures, (tga, psd, etc.) the import tool will try to use those when importing materials, otherwise it will fall back to converting and recompressing vtf files (which can decrease texture quality). For this to be successful, make sure your source files are in a mirrored location of the vtfs in \Steam\steamapps\common\Counter-Strike Global Offensive\csgo\materials
. For example:
C:\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\materials\mymaterial\mytexture.vtf
C:\mymapfolder\materials\mymaterial\mytexture.tga
Getting Started
1. Installing Python 2.7.14
To run the import script you will need to install Python 2.7.14 which you can grab here: https://www.python.org/downloads/release/python-2714.
2. Setting Environment Variables
Next you will need to set two environment path variables so that Windows knows where your python installation lives and other import libraries in the Steam\steamapps\common\Counter-Strike Global Offensive\game\csgo\bin\win64
folder:
Press the ⊞ Win+X to access the Power User Task Menu.
- In the Power User Task Menu, select the System option.
- In the System window, scroll to the bottom and click the About option.
- In the System > About window, click the Advanced system settings link at the bottom of the Device specifications section.
- In the System Properties window, click the Advanced tab, then click the Environment Variables button near the bottom of that tab.
- In the Environment Variables window (pictured below), highlight the Path variable in the System variables section and/or click the New button.
- Add a path variable with the Value being the path to where you installed Python, and the path to your
Counter-Strike Global Offensive\game\bin\win64
folder , separated by a semicolon. e.g.C:\python27
;C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\game\bin\win64
- Do this for both User Variables and System Variables:

3. Installing the Colorama Extension
Next you will need a Python extension called colorama. To install this, simply open up a command prompt (search for cmd in Windows Start Menu) and type
4. Creating a new Addon with the Workshop Tools
Before running an import, you will need to create a Workshop Tools addon so that the imported content has a valid destination. To make a new addon, simply launch the game with Workshop Tools, and from the UI click "Create New Addon" and take note of the name for later.
5. Locating the Import Script
First up is locating the python import script, which can be found in the following folder:
(YourSteamInstallFolder)\Steam\steamapps\common\Counter-Strike Global Offensive\game\csgo\import_scripts
Once you have located the folder, you will want to open up a command prompt here. This can be done by simply typing "cmd" in Windows Explorer address bar and hitting enter:


import_map_community_gui.exe
more info on this can be found at the end of this document.
6. Running the Script + Parameters
Now you are ready to run the script by entering the following:
Script Parameters
- <s1gameinfopath>
- Path to folder containing CS:GO's gameinfo.txt, this MUST be the path that contains the compiled CS:GO model and material content you want to import (e.g. .mdl, .vmt).
- <s1contentpath>
- Path to folder containing source content, (.vmf .psd .tga etc.). As mentioned above, for the importer to successfully find and use source texture files, make sure they are in a mirrored location to that of the .vtfs (see example above)
- <s2gameinfopath>
- Path to folder containing CS2's gameinfo.gi
- <s2addon>
- The name of CS2 Workshop addon that you created earlier. This is where your assets will be imported to.
- <mapname>
- This is the map name (.vmf) without extension, e.g. de_examplemap that you wish to import. If your map sits under a subdirectory of the
maps
folder in <s1contentpath>. Be sure to add this path before your map name. For example:my_maps/de_examplemap
- -usebsp
- This runs the map through a special vbsp process to generate clean map geometry from brushes, removing hidden faces and stitching up edges, making the CS2 version easier to work with in Hammer. It preserves world (vis) brushes and func_detail brushes for compatibility with Source 2. This parameter will also merge all func_instances in your map. Note that the final geometry will be triangulated, but cleaning it up is a fairly simple process, which will be explained in another guide.
- -usebsp_nomergeinstances
- Use this instead of -usebsp if you wish to both generate clean geo and also preserve func_instances. Note that this takes a little longer as it has to run through the import process twice. The final geometry will also be triangulated.
- -skipdeps
- Optional: skips importing all dependencies/content and only generates the vmap file(s). This provides a 'quick' import when iterating entities for example. Do not run with this if you are importing for the first time.
Example:
Experimental GUI
In (YourSteamInstallFolder)\Steam\steamapps\common\Counter-Strike Global Offensive\game\csgo\import_scripts
we have included an experimental GUI for the map importer which might help streamline the import process somewhat called import_map_community_gui.exe
This GUI has the advantage of useful tooltips, easily selectable import options and it will also remember your settings between sessions. Note that you will still need to complete the prerequisites and steps 1-4 above for this to work correctly. We have also included the source python scripts for the community to customize as they see fit.