# Tutorials

Instructions on how to efficiently use idStudio.

# How Do I Create idStudio Mods?

<p class="callout info">See the official website for more in-depth guides: [https://idstudio.idsoftware.com/](https://idstudio.idsoftware.com/)</p>

The mod file locations idStudio reads &amp; writes is not always what you package.  
All editors are located in the "Windows" tab located on idStudio's top bar.

#### decl mod

- Edit or create a new decl in the Asset Browser
- Decls are located in your `base/declTree` folder

#### texture mod

- Edit textures with the Material Editor &amp; Material Painter
- Added textures should be in a standard .tga format  
     - Use GIMP or Paint.net to export textures into .tga
- Create a folder for your newly-added textures manually in File Explorer if you haven't already done so  
     - Not applicable if textures are being replaced, not added
- Menu &amp; Custom textures are located in your `base/art` folder
- Character textures are located in your `base/models` folder
- GUI textures are located in you `base/textures` folder

#### static / animated model mod

- Edit models with Blender (not in idStudio)
- Export models as .fbx
- Import the .fbx model in the Static Model Editor or Animated Model Editor
- Create a folder for your newly-added models &amp; animations manually in File Explorer if you haven't already done so  
     - Not applicable if models &amp; animations are being replaced, not added
- Static models are located in your `base/art` folder
- Animated models &amp; animations are located in your `base/md6` folder

#### string mod

- Edit strings with the String Editor
- Language -&gt; English
- Be sure to save BOTH the String Contents then the String Table
- Strings are located in your `base/strings` folder

#### sound effect / voice over mod

- Convert sfx/vo with Wwise as **PCM Auto Detect High** ([not in idStudio](https://wiki.eternalmods.com/books/2-how-to-create-mods/page/creating-audio-mods))
- Export sfx/vo as .wem
- Manually place them in `base/sound/soundbanks/pc`
- Rename each file to ONLY contain the sfx ID (ex: 123456789.wem)

#### music mod

- Convert music with Wwise as **Ogg Vorbis Quality High** ([not in idStudio](https://wiki.eternalmods.com/books/2-how-to-create-mods/page/creating-audio-mods))
- Export music as .wem
- Manually place them in `base/sound/soundbanks/pc`
- Rename each file to ONLY contain the music ID (ex: 123456789.wem)

#### entities mod

- Import zipped mod with the Legacy Mod Importer tool
- Entities are located in the `base/maps` folder

#### map mod

- Save As in the World Editor
- Be sure to add brushes for geo, some light points for visibility, &amp; a playerStart entity
- Do a Slowmap build for quick testing
- Execute a slowmap command in the Engine window to load into the map
- Do a Full Map bake &amp; Collision + Nav build before packaging your map
- Maps are located in the `base/maps` folder

##### map mod (how to load)

- To load into a custom map, the `devmenuoption/devmenuoption/new_campaign.decl` file should be modified. 
    - This will ensure that creating a new save for the base Campaign will load the player into the custom map.
- Set the `devMenuMapName` to the path of a custom map.
- Set the `devMenuInventoryLoadout` to the path of a `devInvLoadout` decl.

**`devmenuoption/devmenuoption/new_campaign.decl`**

```
declType( devMenuOption ) {
	edit = {
		devMenuList = {
			num = 1;
			item[0] = {
				devMenuDisplayName = "Custom Map";
				devMenuMapName = "maps/custom_map_name.map";
				devMenuInventoryLoadout = "devinvloadout/dlc/e4m1_rig";
			}
		}
	}
}
```

# What Files Should I Package For My idStudio Mod?

When developing a mod, many files will be generated in your idStudio base folder.  
It is crucial that you ONLY package what is NECESSARY for your mod to avoid conflicts with other mods.

<p class="callout warning">**You may need to check "Show Binary + Raw Files" to view and package uncommon mod files in the Package Mod window.**</p>

<p class="callout danger">**Never package anything inside an "editors" folder.**</p>

#### decl mod (.decl)

- Check `generated/decls/.../decl_name.decl`
- Only check the decls you've added or modified
- Do not package your declTree folder

<p class="callout warning">**Periodically delete everything in "generated/decls" so unused decl files can be removed and not accidentally packaged.**</p>

#### texture mod (.bimage)

- Check `generated/image/art/.../texture_name.bimage`
- Only check the textures you've added or modified
- Do not package anything in "editors"

#### static model mod (.bmodel)

- Check `generated/model/art/.../model_name.bmodel`
- Do not package anything in "editors"

#### animated model mod (.bmodel) (.bmd6anim)

- Check `generated/model/art/.../model_name.bmodel`
- Check `generated/anim/md6/.../animation_name.bmd6anim`
- Do not package anything in "editors"

#### string mod (.blang)

- Check `strings/english.blang`
- Check other language .blang files if they exist
- Do not package .lang files

<p class="callout warning">**Delete all vanilla strings in the string editor if you haven't already done so.**</p>

#### audio mod (.wem)

- Check `sound/soundbanks/pc/sound_id.wem`  
     - A sound\_id will look something like 123456789.wem
- Do not package anything in sound/ModWavs
- Applies to sound effect, voice over, &amp; music mods.

<p class="callout info">Check "Show Binary + Raw Files" to view and package WEM files in the Package Mod window.</p>

#### map mod (.map)

- Check `maps/.../map_name.map`
- Do not package entities or other file types from the maps folder
- Clear your generated/decls folder after packaging a .map because it will be flooded with vanilla decls

<p class="callout danger">**When you package a .map with decls, be sure to ONLY CHECK each individual decl class folder, not all of "generated/decls" as that would package many vanilla decl files into your mod.**</p>

#### entities mod (.entities.cbfile)

- Check `generated/compfile/maps/.../map_name.entities.cbfile`
- Check `packagemapspec.json` (if assetsInfo was used)
- This is for legacy mods only
- Do not package .entities files for custom maps built inside idStudo's World Editor

# How Do I Upload Mods To The Mod Portal?

- For most mods, the only file you need to upload the `base.pk5` file. The exception being custom maps.
- Don't upload anything else.

#### What About Custom Maps?

- Custom maps have extra files in addition to the base.pk5 file.
- Package the entire contents of your ActiveMods (not idStudio) folder that was created when you selected "Test" directly after packaging your mod. This includes... 
    - Everything in `dvdpc`
    - The **lightdb** file in `virtualtextures`
        - Do not package the large **rawdb** file. It is not utilized.
    - `base.pk5`
- Note that your mod will likely be around 700 MB in size, per unique map.

<p class="callout success">The Mod Portal will automatically fill in the relevant files for your mod so you may not need to worry about this.</p>

#### Some models are invisible and the HUD "fuzzy"

This is an issue with the packagemapspec file. Here is how you can fix it as either the mod author or player who downloaded the mod from the DOOM Eternal Launcher.

- Open File Explorer
- Go to your "ActiveMods" folder for DE -&gt; Open the folder with the mod ID
- Open `dvdpc\base\packagemapspec.json`
- Add the following within the "MapFileRefs" field (after ⁨⁨⁨⁨⁨⁨`file 6, map 3`⁩⁩⁩⁩⁩⁩ before ⁨⁨⁨⁨⁨⁨`file 8, map 4`⁩⁩⁩⁩⁩⁩⁩⁩⁩⁩⁩⁩⁩⁩)  
    ⁨⁨⁨⁨⁨⁨

```
      {
         "file" : 8,
         "map" : 3,
         "source" : 0
      },
```

- Launch the game with mods

##### If you are the Mod Author

- Package your map as normal in idStudio
- Before selecting to "Test Your Mod", add the ⁨⁨⁨⁨⁨⁨`file 8, map 3`⁩⁩⁩⁩⁩⁩ "MapFileRefs" field from above to the same location `dvdpc\base\packagemapspec.json`, but in your "idStudioMods" folder 
    - This will apply the same change to your ⁨⁨⁨⁨⁨⁨`packagemapspec.json`⁩⁩⁩⁩⁩⁩ file in the "ActiveMods" folder
    - If you skip this step, that is fine - you can always manually add the "MapFileRefs" field to the ⁨⁨⁨⁨⁨⁨`packagemapspec.json`⁩⁩⁩⁩⁩⁩⁩ file in your "ActiveMods" &amp; "idStudioMods" folders
- Upload the mod like normal in the DOOM Eternal Launcher

#### Miscellaneous

If your mod has 2 maps, insert the following into the "MapFileRefs" field in the "packagemapspec.json" file.

```
      {
         "file" : 10,
         "map" : 3,
         "source" : 0
      },
      {
         "file" : 10,
         "map" : 4,
         "source" : 0
      },
```

If your mod has 3 maps, insert the following.

```
      {
         "file" : 12,
         "map" : 3,
         "source" : 0
      },
      {
         "file" : 12,
         "map" : 4,
         "source" : 0
      },
      {
         "file" : 12,
         "map" : 5,
         "source" : 0
      },
```

<p class="callout info">Follow the patterns above if your mod has more than 3 maps.</p>

# Known Fixable Issues

### Some decls are Inaccurate when Testing in the Sandbox

##### The Sandbox uses the packaged .decl files from the `base\generated\decls` folder. Older decls that were previously removed from the `base\declTree` folder may still be present in the packaged mod. Here is how you can clean up your decls.

- Delete ALL files under the `base\generated\decls` folder. 
    - New decls will automatically be generated before you package your mod.
    - If your mod has a custom map, DO NOT delete the other folders in your `base\generated` folder because they are needed to package your map. If they were accidentally deleted, be sure to do a Slow Map, Full Map, &amp; Collision/Nav build before packaging your mod.

### Custom Maps have unusually-large File Sizes

##### Fully-baked custom maps can have very large file sizes. Here is how you can reduce it.

- DO NOT package the `virtualtextures\maps\...\custom_map_name.rawdb` file. 
    - This is a very large file that is not utilized on the Doom Eternal Sandbox.
    - Delete the .rawdb file for the mod in your "ActiveMods" folder to conserve file space. Keep the file in your "idStudio" folder because idStudio reads it.
- For more information on what files you should package for your mod, see guide: [https://wiki.eternalmods.com/books/0-idstudio/page/what-files-should-i-package-for-my-idstudio-mod](https://wiki.eternalmods.com/books/0-idstudio/page/what-files-should-i-package-for-my-idstudio-mod)

### Most Geo are Invisible when Testing in the Sandbox

##### Geo are mostly invisible or flickering in the Sandbox due to an issue with the `dvdpc\base\packagemapspec.json` file. Here is how to fix it.

- See guide (scroll down to the "Some models are invisible..." header): [https://wiki.eternalmods.com/books/0-idstudio/page/how-do-i-upload-mods-to-the-mod-portal](https://wiki.eternalmods.com/books/0-idstudio/page/how-do-i-upload-mods-to-the-mod-portal)
- If geo are invisible after loading an existing save or checkpoint, see the "Loading a Custom Map may crash at 80%" guide below.

### Loading a Custom Map may crash at 80%

##### Loading an existing save for a custom map may crash at 80%. If the game does not crash, then all geo on a custom layer will be invisible unless a checkpoint is loaded. The 80% crash stems from the use of custom visibility layer. Here is how to fix it.

- If custom layers were used, replace them all with vanilla layers. Repurposing vanilla layers will not impact the levels they are associated with.
- Replacing layers on entities can be done quickly by opening a .refmap file in `base\maps\...\custom_map_name\refmap_name.refmap` with a raw text editor and issuing a mass find/replace command to find the full custom layer name and replace it with the full repurposed vanilla layer name.
- Be sure that the repurposed vanilla layer decl only has its layerParent set to "world" and each custom layer should be repurposed to a different vanilla layer.

For example, change the custom layer:

```
	layers {
		"game/custom_map_name/visibility/vis_visibility_layer"
	}
```

To:

```
	layers {
		"game/sp/e1m1_intro/visibility/vis_barge"
	}
```

- Any other custom layers that are not for visibility (main\_level, master\_level, etc) should be activated in a **target/change\_layer** entity or **devMenuOption** decl.

Here is what activating a layer in a **devMenuOption** decl looks like:

```
declType( devMenuOption ) {
	edit = {
		devMenuList = {
			num = 1;
			item[0] = {
				devMenuDisplayName = "Custom Map - Master Level";
				devMenuMapName = "maps/custom_map_name.map";
				devMenuInventoryLoadout = "devinvloadout/dlc/e4m1_rig";
				devMenuActiveLayers = {
					num = 1;
					item[0] = "game/custom_map_name/master_level";
				}
			}
		}
	}
}
```

- For more information on how to create idStudio mods, see guide: [https://wiki.eternalmods.com/books/0-idstudio/page/how-do-i-create-idstudio-mods](https://wiki.eternalmods.com/books/0-idstudio/page/how-do-i-create-idstudio-mods)

### Custom SFX &amp; Music prevent Vanilla Audio from Playing

##### There are issues with both the `mods.pck` &amp; `music_mods.pck` files that is generated when a new idStudio mod is created. Here is how to fix them.

- See guide: [https://wiki.eternalmods.com/books/0-idstudio/page/fixing-custom-audio-idstudio](https://wiki.eternalmods.com/books/0-idstudio/page/fixing-custom-audio-idstudio)