# Hot Reloading

How to use Atlan Mod Loader and Kaibz Mod to reload modded entities files without restarting the game.

<p class="callout warning">This is an experimental feature. It may or may not be broken on Linux. If you attempt this procedure, please report whether it's successful or not.</p>

The biggest problem with editing level mods is iteration time. Each time you want to test new changes, you must re-install the mod and restart the game. It's a time-consuming process that grinds down development. But with the power of Kaibz Mod and Atlan Mod Loader, this inconvenience can be eliminated!

#### Install Kaibz Mod

You must install [Kaibz Mod](https://www.nexusmods.com/doomthedarkages/mods/27?tab=description) to perform hot reloading! It is recommended you enable it's Mod Interface while developing level mods. See [Connecting EntitySlayer to Kaibz Mod](https://wiki.eternalmods.com/books/dark-ages-modding/page/essential-tools) to learn how to enable the mod interface.

#### Before Launching the Game

Atlan Mod Loader will engage "Hot Reload Mode" when an **unzipped and unpackaged** .mapentities file gets loaded. Let's say you want to edit the mission *Hebeth*. Your mods folder might look like this.

```
- Steam/steamapps/common/DOOMTheDarkAges/
   - mods/
      - my_hebeth_mod/
         - mapentities@maps@game@sp@m2_hebeth@m2_hebeth.mapentities
         - darkagesmod.txt
```

Once this is setup, run Atlan Mod Loader and launch the game.

<p class="callout warning">While hot reloading, you can have other mod files installed besides the mapentities you're editing. However, you must NOT edit any of these files. You must NOT remove any of these files, or add any new files. If you want to do any of these things, you must shutdown the game then re-run the mod loader. Otherwise, hot reloading will break, and your game will most likely crash.</p>

#### Reloading the File

Let's say you've made some changes to the Hebeth mapentities file and you're ready to reload it. Run the console command `k_hotReload` to reload the map!

Notes:

1. This may alt-tab you out of the game for several seconds. The alt-tabbing is most severe when running the game in `Full Screen` mode. If it gets annoying, try changing to `Borderless Windowed` mode.
2. You may notice a command prompt briefly pop up and close. This is Atlan Mod Loader running due to Kaibz Mod.

#### Quick Test

The first time you attempt hot reloading, you should do something simple to verify it works on your system. The following code snippet will place a floating text entity at the start of Hebeth.

1. Paste this into Hebeth's mapentities file. **Make sure you paste it somewhere AFTER submap 0's world entity.**
2. Edit the entity's `edit/headerText/text` property.
3. Trigger a hot reloading using the above procedure.
4. Verify that the text you see in-game has changed to reflect your edits.

```
entity 0 {
	entityDef hot_reload_test {
		inherit = "entityDef/gui/text";
		expandInheritance = false;
		editorVars = {
			placeable = false;
		}
		systemVars = {
			entityType = "idGuiEntity_Text";
		}
		edit = {
			headerText = {
				text = "Hot Reload Test!";
			}
			canvasFile = "ui/shapes/worldgui_text";
			useSWFTransform = true;
			swfScale = 0.016667;
			spawnPosition = {
				x = -1245.702881;
				y = -1230.202271;
				z = -77.942009;
			}
			spawnOrientation = {
				mat = {
					mat[0] = {
						x = -0.000000;
						y = -1.000000;
					}
					mat[1] = {
						x = 1.000000;
						y = -0.000000;
					}
				}
			}
			flags = {
				noknockback = false;
			}
			renderModelInfo = {
				model = "editors/models/gui_text.lwo";
				scale = {
					y = 15.000000;
				}
			}
			clipModelInfo = {
				type = "CLIPMODEL_NONE";
			}
		}
	}
}
```

#### Reloading the File (Without Kaibz Mod)

<p class="callout warning">Hot Reloading without Kaibz Mod is NOT RECOMMENDED! This section is here purely for documentation purposes! Please use the above method instead of this one!</p>

To Hot Reload without using Kaibz Mod, perform the following steps:

1. Alt-Tab out of the game.
2. Run Atlan Mod Loader and wait for it to complete
3. Quit out to main menu, then load back into Hebeth using Mission Select.
4. The changes you've made to the file should be reflected in-game.