Play with Mods
Daggerfall Unity includes modding support. A mod for Daggerfall Unity has .dfmod extension and it can contain different kinds of assets, including C# scripts. Mods can interact directly with the core game and affects many aspects of the game, as well as add new features on top of Unity and Daggerfall Tools for Unity.
Mods benefit of an integrated replacement framework which provide artists a code-free platform for graphic improvements of the original Daggerfall; this avoid any incompatibility and make use of the load order to smoothly handle duplicates. Certain assets, such as textures, sounds and music and even new quest files, can also be imported directly from folders on disk as loose files.
Finally, several mods created for the dos game are still functional with Daggerfall Unity since the original assets are accessed; other mods may be not compatible or are simply made obsolete.
Our stance on security is the same as Cities Skylines:
The code in Mods for Cities: Skylines is not executed in a sandbox.
While we trust the gaming community to know how to behave and not upload malicious mods that will intentionally cause damage to users, what is uploaded on the Workshop cannot be controlled.
Like with any files acquired from the internet, caution is recommended when something looks very suspicious.
There is a button named Extract Text in game, available from the load order window, which can export C# scripts to disk as text files for review. Overall, we suggest to take the same precautions with mods as any other download from the Internet. If you prefer, you can always disable mod support from settings, or simply not downloads any mods in the first place.
Mods can be placed inside StreamingAssets/Mods or any subfolder inside this one. Loose files are placed inside other specific folders inside StreamingAssets; always refers to ReadMe and developers for any additional indication.
StreamingAssets folder is located inside DaggerfallUnity_Data on Windows and Linux, while on Mac is found by right-clicking the player and selecting “show package contents”; the folder is inside Contents\Resources\Data.
On Windows, mods can also be installed with Vortex Mod Manager from NexusMods if provided in a suitable format.
The load order defines the orders in which mods are executed; if two (or more) mods contain the same asset, the one in the lower position will be used. If multiple mods provides the same features, the load order may help to prevent incompatibilities but you should always referes to mod developers.
More advanced mods may provide support for user settings, as well as presets with predefined values for all or some options. Settings are configurable from an in game UI; additionally new presets can be automatically created from current settings to be shared with the community or simply to store and retrieve a configuration locally.
Note: when upgrading, local settings are reverted to default values if incompatible with the new version.
The presets creator window has a button labelled Export. When you click on it the selected preset is exported to %PersistentDataPath%/Mods/ExportedPresets/%ModFileName% (i.e. C:/Users/ExampleUserName/AppData/Local/Daggerfall Workshop/Daggerfall Unity/Mods/ExportedPresets/ExampleModName/ExamplePresetName.json).
Presets can be imported from StreamingAssets/Presets/%ModFileName%/ (or %ModRoot%/Assets/Presets/%ModFileName%/ from a mod). For example StreamingAssets/Presets/ExampleMod/ExamplePreset.json.
Develop new Mods
Daggerfall Unity supports real-time injection of C# code; this allow modders to develop scripts for the Unity Engine and benefit of all the possibilities offered by this combination. A mod can change the game behaviour and create endless possible gameplay revisions and enhancement, as well as importing new assets to create something entirely new.
A mod for Daggerfall Unity consists of a package with .dfmod extension. This is a Unity AssetBundle with C# text files, compiled when the game starts, and game assets which can be retrieved at run time. The typical mod behaviour is to subscribe to some of the many events provided to add new features to the game, or alter it with the implementation of interfaces and callbacks. A standard integration with settings and saves is provided, while a message layer can be used to locate and communicate with other mods and implement compatibility patches only when required.
It is suggested to start reading Mod features and attempt to run the proposed tutorial examples to learn the basics of modding for Daggerfall Unity. Then the API Documentation can be used to retrieve more advanced informations and examples for specific features.
When mods aim to swap meshes, textures and other resources, a common issue is that asset usage is often a core part of the game which is not or should not be accessible to mods; additionally multiple mods with similar purposes can create a variety of incompatibilities. The Asset-Injection framework answers with a single implementation within the core game, while mods are given the role of providers. Specifically there are two ways for a mod to provide asset contributions:
- Asset Bundle: a single optimized package created with the Unity Editor; allows improved optimization and customization and can be added or removed individually with a load order.
- Loose Files: raw assets imported directly from disk with default format; easier for the mod developer at the cost of missing features, but also harder to manage for the user.
Note: An asset bundle is not a simple compressed archive, but rather a container for text and binary assets processed to a suitable format for target platform, so is not possible to extract source assets as loose files. In some cases, it is however possible to override a specific assets by placing a replacement in a lower position of the load order.
Additional resources usable in game can also be provided via loose files.
Quests for Daggerfall Unity are written in a simple scripting language, based on Donald Tipton’s TEMPLATE v1.11, which is compiled Just In Time and so can be written and tested even while the game is running. A quest debugger is also available to test the script and immediately find the target locations.
- TEMPLATE v1.11 Documentation
- Quest Writing Tutorial
- Modding Tutorials: World Data, Quest Packs & New Guilds
Most of the text used for the UI is drawn directly on background images, which can be replaced with the framework presented above. Other strings that were hardcoded in classic Daggerfall are being gradually moved to csv files, which is also how mods can be provided in different languages. At this time support for localization is not complete and will be improved after the stable release.
Daggerfall Unity modding system can be used to create frameworks that can expose to mod developers more features in addition to the core mod support. This is a list of some of the most intriguing tools created by the community.
Once your mod is ready, you can release it to the public. Most mods are hosted on Nexus Mods. If you want to support Vortex mod manager, pack your compressed archive so it can be extracted directly inside StreamingAssets folder; as a readme, put a text file with the same name of your mod inside Docs folder.