Skip to content

Guide: Map Porting

fed edited this page Jun 21, 2023 · 4 revisions

Map Porting

Map porting may seem like a lot of work but zonetool makes it very easy to do and it only requires a few steps.
Before starting make sure that the conversion from the game you want to port from and the game you want to port to is supported by checking the table below:

Conversion support

IW6 S1 H1 H2
IW6 ✔️ ❌ ✔️ ❌
S1 ❌ ✔️ ✔️ ✔️
H1 ❌ ❌ ✔️ ✔️
H2 ❌ ❌ ✔️ ✔️

Steps

  • Identity the name of the file map you want to port, to do this simply use the in-game console and type mapname this should show you the file name of the current map you are in.

  • Identify the code of the source (game to port from) & target game (game you want to port to).

  • In zonetool execute the follwing command:

    dumpmap <target game> <map name>
    
  • Once the process is completed you should find a folder called <map name> in the dump folder in the root directory of the game.
    Move this folder into a folder called zonetool (create it if it doesn't exist) in the target game.

  • On zonetool again (this time run it from the target game) type the following commands:

    generatecsv <map name>
    buildzone <map name>
    

    generatecsv: generates the csv for your map, this file will include all the required assets that zonetool will add. buildzone: builds the fastfile/zone from the csv.

    Once this command is done your map should be ready! Simply type map <map name> in the game's console and check if everything works fine.

    Extra steps

    • For the map to look correct you must also create a GSC file for your map, this will be a script that will be executed once the map starts. This script differs on multiplayer & singleplayer.
      • Multiplayer:

        main()
        {
            maps\createfx\mapname_fx::main();
            maps\mp\mapname_fx::main();
            maps\mp\_load::main();
            maps\mp\_compass::setupminimap("compass_map_mapname");
        }
      • Singleplayer:

        Here is a sample script (mapname should be replaced with the actual map's name).
        maps/mapname.gsc:

        main()
        {
            maps\createfx\mapname_fx::main(); // only if this script exists
            maps\mapname_fx::main(); // only if this script exists
            maps\_load::main();
            maps\_compass::setupminimap("compass_map_mapname");
        }

        As indicated by the comments the first two lines should be included only if those scripts actually exist, to check simply go to [game dir]/zonetool/mapname/maps and check if the files are there.
        Once you're done you can either leave the file on the disk ([game dir]/maps/mapname.gsc). Or include it in the map fastfile. To do this copy maps/mapname.gsc into [game dir]/zonetool/mapname/, and add it to the map's csv, which you will find in [game dir]/zone_source/mapname.csv:

        rawfile,maps/mapname.gsc
        

        Finally rebuild the map as stated in the previous steps.

Troubleshooting

  • There might be cases in which you are missing some assets that are required by the map, zonetool will include this in its log but it is also noticeable in-game:

    • Red images: this means you are missing images, you should dump the source game's common fastfile (most of the time it is called common_mp for multiplayer and common for singleplayer), example:

      dumpzone <target game> common_mp
      

      Note that a "patch" version of the common fastfile always exists (ex. patch_common_mp), so the assets could also be there.

      You should then move this folder from dump/ into a folder called zonetool_paths in your target game's root directory. Zonetool will look for assets in any folder inside zonetool_paths. Alternatively you can copy the contents of the dumped folder into the map's zonetool folder, but this is not advised as it will take a long time.

    • "REF" red models: this means you are missing models, the fix is the same as with images

  • All the map's textures are black/gray/white/red: this probably means that zonetool failed to dump the streamed images, to check if this is the case see if the streamed_images folder contains and .pixels files, if not then something went wrong. Most likely zonetool was unable to find the source game's image files. This should not happen.

  • Error: "Vertex type %i doesn't have the information used by shader %s in material %s\n":
    This most likely indicates you are missing that particular material, the same fix as issue #1 should apply.

  • Error: "Bad weaponinfo "%s" specified for turret. It likely needs to be precached in script.":
    This indicates that the original map includes a turret, you can either:

    • Simply remove the turret entirely (this is advised unless you really want the turret): to do this open the mapname.d3dbsp.ents file you will find in zonetool/mapname/maps/mp or zonetool/mapname/maps/, search for "weaponinfo" and remove the entire section that includes it, example:

      [...]
      {
      "bottomarc" "70"
      "rightarc" "40"
      "leftarc" "40"
      "targetname" "minigun_turret_2"
      "spawnflags" "0"
      "toparc" "10"
      "classname" "misc_turret"
      "export" "1"
      "model" "npc_minigun_turret"
      "weaponinfo" "turret_minigun_mp"
      "origin" "1004.5 -80 865"
      "angles" "0 180 0"
      }
      [...]
      

      Everything from and including the opening bracket to the closing bracket should be removed. Repeat this for every case of "weaponinfo" in the file.

    • Add the required assets (usually just the weapon): repeat the same process as for removing it but don't actually remove it and simply save every instance of the value of "weaponinfo", (example: "weaponinfo" "turret_minigun_mp" <- this is the value). Add this weapon to the map's csv (refer to issue #1) (replace turret_minigun_mp with whatever the value actually is):

      weapon,turret_minigun_mp
      
  • Error: "animation '%s' not defined in anim tree '{animtree name}'":
    This means the map is using an animation tree that is not defined on the target game, to fix this you must dump the {animtree name}.atr of the source game, this file is usually found in the common fastfile (refer to issue #1), copy the file (including its folder: animtrees/{animtree name}.atr) into a folder called override (create it if it doesn't exist) inside [target game]/zonetool/mapname/, then include it in the csv (refer to issue #1):

    rawfile,override/animtrees/{animtree name}.atr
    
  • Other issues (like crashes or errors) may require more information to fix so it is advised that you ask for help in the h1-mod or h2-mod's discord servers, make sure to use the appropriate channels. Do not create github issues unless you think it is necessary.

Overview

Guides

Assets

Clone this wiki locally