Play with Mods
A mod for Daggerfall Unity has .dfmod extension and it can include different varieties of assets, including scripts. This make them a powerful tool as mods can interact directly with the core game and affects game behaviour, as well as add new features on top of the solid base provided by Unity and DTFU.
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 simply obsolete.
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;
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 support 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.
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.
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.