Page 1 of 1

Modding Support

Posted: Sun May 29, 2016 7:42 pm
by LypyL
Interkarma has asked me to write a quick overview about the upcoming modding feature that will be in version 0.3 that I’ve been working on.

Currently mods need to be built into a Daggerfall Unity project to work, which is an obvious limitation. Interkarma has gone out of his way to support a bunch of different mods, even including them into Daggerfall Unity releases, but this takes up a lot of his time and has always been a temporary solution.

The new modding system takes advantage of Unity’s asset bundles, and allows mod creators to export the assets that make up their mods (textures, models, c# scripts, prefabs and so on) from Unity to a single file which is then loaded at runtime.

Exporting to a mod file is easy and done with a simple window inside the Unity editor:

Image

The mod files are detected and loaded during the Startup Scene:

http://www.dfworkshop.net/wp-content/up ... odlist.png

This means that going forward, modders will no longer have to rely on their mods being part of Daggerfall Unity to work. Modders will be able to create, share, and release updates for their mods all on their own. And using mods will require little more than the player placing the mod file in a directory.

We’ll be providing more details on how it works, including examples and tutorials in the near future. Stay tuned!

Re: Modding Support

Posted: Mon May 30, 2016 7:54 am
by Nystul
I got some questions:
  • is it possible for a mod to query for installed/activated (other) mods
  • can script execution order of mods be specified/enforced (can a mod require/enforce its execution before or after certain other mods)
  • can a mod hijack other mods resources?

Re: Modding Support

Posted: Mon May 30, 2016 5:29 pm
by LypyL
is it possible for a mod to query for installed/activated (other) mods
Yes, it is possible to query for installed mods...currently, this returns a Mod object, I'll add a method just to check if a Mod is loaded.
can script execution order of mods be specified/enforced (can a mod require/enforce its execution before or after certain other mods)
Currently there is no way to force the load order, but I'm working on this. My plan is to have it work like it does in modern ES games - the UI at the startup screen will allow you to set the load order, and decide which mods are enabled / disabled. Eventually, these settings will be saved to a file so the settings will be remembered.
can a mod hijack other mods resources?
I'm not sure I understand what you mean by "hijack" :) - a mod can pretty much do anything it can now, as modders can use c#.

Re: Modding Support

Posted: Tue May 31, 2016 10:09 am
by Nystul
LypyL wrote:
is it possible for a mod to query for installed/activated (other) mods
Yes, it is possible to query for installed mods...currently, this returns a Mod object, I'll add a method just to check if a Mod is loaded.
uh that's nice
LypyL wrote:
can script execution order of mods be specified/enforced (can a mod require/enforce its execution before or after certain other mods)
Currently there is no way to force the load order, but I'm working on this. My plan is to have it work like it does in modern ES games - the UI at the startup screen will allow you to set the load order, and decide which mods are enabled / disabled. Eventually, these settings will be saved to a file so the settings will be remembered.
cool this is how I would love to see it implemented
LypyL wrote:
can a mod hijack other mods resources?
I'm not sure I understand what you mean by "hijack" :) - a mod can pretty much do anything it can now, as modders can use c#.
I mean several things.
- Get instances to mod resources by script, e.g. GameObject.Find - as far as I understood your last comment this should work...
- create instances of classes defined in scripts of the mod, e.g. can I do a x = new OtherModNamespace.AClass(); in a different mod (create a instance of a class defined in the other mod and use its member variables, functions, etc.)
- inherit from classes defined in other mods
- get handles to public class members of other mods and change them or replace them completely by different objects of the correct type/class

Re: Modding Support

Posted: Wed Jun 01, 2016 9:13 am
by LypyL
- Get instances to mod resources by script, e.g. GameObject.Find - as far as I understood your last comment this should work...
Yeah, you can still use GameObject.Find / GetComponent and so on. To clarify my comment above, I more meant you can accomplish the same things (though sometimes it might require a different approach).
- create instances of classes defined in scripts of the mod, e.g. can I do a x = new OtherModNamespace.AClass(); in a different mod (create a instance of a class defined in the other mod and use its member variables, functions, etc.)

- inherit from classes defined in other mods

- get handles to public class members of other mods and change them or replace them completely by different objects of the correct type/class
These are all be possible afaik. The key is that the mod with the classes you're trying to inherit from, be compiled first. That way when your mod is compiled, it will have a reference to its assembly.

Re: Modding Support

Posted: Wed Jun 01, 2016 7:10 pm
by Arl
This sounds very nice, will this allow texture replacements? or am I assuming further than things actually are?

Re: Modding Support

Posted: Wed Jun 01, 2016 11:51 pm
by Interkarma
Phobos Anomaly wrote:This sounds very nice, will this allow texture replacements? or am I assuming further than things actually are?
Lypyl's modding framework is about on par with the flexibility of Skyrim or Cities Skylines. It would allow for pretty much anything to be added externally, although some support will be needed in the core to open up "hooks" for mods to accomplish more.

I feel this is so important that I've decided to make it the key feature of release 0.3. It will allow a true modding community to start growing around Daggerfall Unity in the next few months.

My personal focus will remain on adding gameplay features as per mission statement, but it seems the enhancement stage is coming a little sooner than expected. :)

Re: Modding Support

Posted: Thu Jun 02, 2016 6:08 am
by LypyL
Image

I started in on the mod loader UI....it's coming along :)

Re: Modding Support

Posted: Thu Jun 02, 2016 6:48 am
by Arl
This is so exciting for me, I think I should revisit some of my work.

Finally I will be able to see it in-game!, I can't be more thankful.

Re: Modding Support

Posted: Thu Jun 02, 2016 7:06 pm
by Uncanny_Valley
This is really cool! :D Great work!