Warlords Under Siege

Warlords Under Siege

Not enough ratings
Modding Guide
By Komisarek
Hi guys. With the release of 1.0 we're releasing a small modding tool to help you create your own maps. It's not the easiest thing to work with (first time we've ever built such a tool) and there are some limitations, but I'm hoping you'll make some use out of it!

As of 1.0 the following things are currently moddable:
- New maps
- Editing basic unit stats (attack, speed, modifiers etc)
- Some basic scripting (giving the player resources, spawning cards, playing sounds etc.)

   
Award
Favorite
Favorited
Unfavorite
About modding WuS
Hi guys. With the release of 1.0 we're releasing a small modding tool to help you create your own maps. It's not the easiest thing to work with (first time we've ever built such a tool) and there are some limitations, but I'm hoping you'll make some use out of it!

As of 1.0 the following things are currently moddable:
- New maps
- Editing basic unit stats (attack, speed, modifiers etc)
- Some basic scripting (giving the player resources, spawning cards, playing sounds etc.)
Unity Editor and the Basics
In order to mod the game, you need to install Unity Editor: 2022.3.55f1. It's free and can be downloaded from the Unity download archive HERE[unity.com].

The editor is a unity project. You can download the editor HERE[drive.google.com]

This guide will not really guide you through how Unity Engine works, as there are tutorials aplenty out there. We decided not to build an internal editor for a few reasons:

  • It would take an enormous amount of time for very little gain
  • If you're skilled with it, you can do far more with Unity Editor than any internal editor would allow you to do
  • You can easily import and use any assets you like in your maps

The project contains an example map, ready to go.
Mod Structure
The game is able to recognise two types of mods: Local mods, which reside on your hard drive and Workshop mods, which are downloaded automatically. You can upload mods onto the workshop in the main menu (bottom right corner).

Local mods reside in: System Drive:\Users\YOUR USER\AppData\LocalLow\RedKar Limited\Warlords_ Under Siege\Mods.

The easiest way to navigate to AppData is by typing the following . You will need to go one directory up though.



Go ahead and download a sample mod from HERE[drive.google.com]. Extract the contents and place it in the mods folder. If the folder does not exist, simply create it. You'll be able to tell it's working if these two maps appear in your main menu:



Your local mod consists of several folders and files. Let's talk about them.

Images
Folder for advanced users. These images are loaded into the game, and can be used in scripting. PNG and JPG files are accepted.

Map1 and ModMap
Example mod for Map1 folder (Western Valley). All maps in WuS are indexed. These are as follows:
  • Map1 - Western Valley
  • Map2 - Passage of the Dead
  • Map3 - Iron Mountains Keep
  • Map4 - Oasis of the Lost
  • Map5 - Hill of Sorrow
  • Map6 - Merewood
  • Map8 - Under Siege
  • ModMap - Custom Map data

Map 7 is unused.

In one mod you can create more than one map or wave override. Maps other than ModMap can currently only be used to create wave overrides - mods which simply override the enemies you encounter on the map and their strength.

Sounds
Similar to the images folder, these sounds are loaded into the game and can be played through a script. For example you're able to play a war horn, or an intro dialogue by putting in files here and calling them with a script

Units
This folder contains unit data override. You can place text files here. They're recognised by the game as long as they have an existing unit's id as their name. In our case, we have Armored_Zombies_enemy.json file, which makes them very fast and durable. From now on all your armoured zombies will run around like crazy.

Folders inside map folders
These contain actual map data. In case of KeepMap in ModMap folder, you'll have a bunch of files we'll talk about next.
Map Files
In your KeepMap folder, you'll find a bunch of files. You can generate the content for most of these in Unity Editor's interface. Let's talk about the files themselves:

MissionImage.png
The file called "MissionImage" is the image displayed in main menu when your mission is selected.

MissionName.txt
This is the name of your mission.

CustomCameraSetup.json
Defines the camera bounds of your level. This way you can make sure the player will not go beyond the edge you don't want them to see.

EndlessWaves.json
Contains the definition of endless waves. If exists the game should recognise it and enable the endless button in main menu.

level and level.manifest
Actual map data generated by the editor.

MapScript.cs
C# script which uses our modding api. It's optional. You can do a bunch of stuff with it that we'll discuss in another section. You can safely remove it.

MissionDescription.txt
Description of your mission in main menu. Might be a good idea to put in information here - how many waves your players will be facing etc.

Waves.json
Waves definition file. This decides what enemies spawn and how many points they have.

Weather.json
Weather file. You can create your own weather patterns here. For example you can have maps that have constant sandstorms, or others that have varied weather.

World.json
This file has definitions of all your building placements.
Sample map in Unity
Open the Unity project. You should find ExampleScene. It will look like this:



In the hierarchy you'll find the Hierarchy Prefab, Helpers and two planes. The Hierarchy Prefab is the level data that gets exported into your map along with the manifest file.

Take one of the slots and move them somewhere else. For example like so:

Now you need to make sure the changes you've made are saved to the prefab. You can override it by clicking on these buttons:



Once you're done, press CTRL+S to save your scene. Then, build your Hierarchy asset bundle as shown on the screenshot below.



The editor will now generate your level and level manifest file. Copy them into your map's folder.



Launch the map and observe the changed position. NOTE: you do not need to restart the game. Your files are read at runtime.



Now, in the editor copy one of the slots, and repeat the build process. Remember to override the hierarchy prefab. When you launch the map now, you should see something like this:



This is because the game doesn't recognise this object as a placement slot. In order to make things easier, we've prepared slot prefabs for you, but you still need to update your definitions file.

Once everything is re-exported, your map should look like this and be functional again.



Navmesh

Anything that has "GroundTerrain" layer can be walked on by our and enemy units alike. When the map is loaded, the game will scan for any objects with this layer, and mark them as walkable. It's important that these objects have a collider on them.

As this map has some little hills and edges, I decided to create my own, more advanced navmesh. This was achieved by using probuilder. There are exensive tutorials on this online, and the tool is not very difficult to use. It's in built into the project. You can find it under Tools > Pro Builder. This is mostly for advanced users. A more advanced nav mesh looks like this:



If your map is quite simple or flat, you can simply create a plane, switch off it's render mesh, and mark it as a GroundTerrain.





Go ahead and delete the nav mesh objects, create and position the plane. Mark it as GroundTerrain and rebuild the bundle (remember to override the prefab!). Try your map now. Your units will most likely spawn on top of the terrain, but almost immediately go underground, and will follow the navmesh.



My advice would be to create flat maps first and simply use a plane as your navmesh if you're just getting started. Otherwise Probuilder is the way. You could also just build it out of quads, but that's quite painful to do :)

Camera Setup
Open the Helpers, "Setup" object. There we have a script that will generate you the contents of CustomCameraSetup.json file. You can play around with the values, and generate the new file. They're unity's native position, which means you can spawn a cube, move it to the place you want to be your edge, and simply use its position.

Weather Definition
Open the helpers, "WeatherDefinition" object. You can set up available weather profiles for the map here. They'll be playing randomly.

Enemies
Open the "Enemies" helper. Here you can create definitions of waves that will spawn. We've prepared unit objects you can drag and drop or select from the list. Defeating
each wave will grant the user a card. Points is the amount of points available to the wave. Enemies will be calculated randomly from the available list.

You can force a minimum and maximum number of "flags" (squads). For example, if you wanted just one Giant, simply assign the Giant unit object, and set Min and Max number of Flags to 1. Also tick "Override Flag Numbers" checkbox.

Audio clips is special audio you can play when the wave starts. These are the names of files (without the extension) from the Sounds folder.

After you're done, generate the file by right clicking on the script and selecting "Serialize". Copy the result into your wave folder.

Map Script
Advanced and work in progress. For an idea of some of the things you can do open the MapScript file. Otherwise remove it.

Content
There are some files available in _Prefabs folder for you to play with. They were generously provided by Charttyp who sells his assets on the Unity Asset Store.
Posting your workshop content
In the main menu, you can upload your mods by clicking on the paper icon. You can also change your load order (important when dealing with mods that change the same units for example).

If your mod is local, it will allow you to upload it.



Please don't make moderation a challenge :)