Modding Tutorials
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: Modding Tutorials
Seems a very reasonable policy, I didn't mean to imply everything should be easily moddable. However it would still be nice to be able to extend core classes to add new behaviours. Is that possible with the c# scripting facility for mods? Can you at least implement an interface from the DFU codebase?
Basically I'm trying to think how modders could add new guilds. I will need to write the hooks/events etc, that's fine as long as the guild behaviour class can be implemented by modders either by abstract class extension or interface implementation.
This may be a stupid question due to c# runtime assemblies or that kind of thing since I know almost nothing about them. (remember I'm a Java guy )
Basically I'm trying to think how modders could add new guilds. I will need to write the hooks/events etc, that's fine as long as the guild behaviour class can be implemented by modders either by abstract class extension or interface implementation.
This may be a stupid question due to c# runtime assemblies or that kind of thing since I know almost nothing about them. (remember I'm a Java guy )
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- Interkarma
- Posts: 7253
- Joined: Sun Mar 22, 2015 1:51 am
Re: Modding Tutorials
I believe it should be possible for the MCS compiler to inherit from an abstract class and plug itself in if given a way to register itself. Nystul's enhanced terrain does something just like this by implementing and registering its own TerrainSampler as part of the mod. The core DaggerfallUnity class allows for a plug-in replacement TerrainSampler to be injected by an event. Load order of mods will determine which new TerrainSampler "wins" as only one can be active in this case.
Adding new guilds this way is a really intriguing concept!
One of biggest limitations is compiling new enums with the runtime C# compiler. Provided modder can just override and plug-in like the TerrainSampler model, they should be able to get a lot done.
Adding new guilds this way is a really intriguing concept!
One of biggest limitations is compiling new enums with the runtime C# compiler. Provided modder can just override and plug-in like the TerrainSampler model, they should be able to get a lot done.
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: Modding Tutorials
Great, I'm off to peruse Nystul's distant terrain mod code then...
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- Nystul
- Posts: 1501
- Joined: Mon Mar 23, 2015 8:31 am
Re: Modding Tutorials
here is the code: https://github.com/Nystul-the-Magician/dfunity-mods
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: Modding Tutorials
I tried to create a mod with a json file in it (Assets/StreamingAssets/WorldData/RESIAM10.RMB-543-building10.json) to test I can include world data override json files in a mod. Unfortunately I get this error "Unrecognized assets cannot be included in AssetBundles" and I have no idea what I can do about it. One possibility is simply have these files as loose files that need installing along with the dfmod file.
Any advice modding experts?
Any advice modding experts?
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- Interkarma
- Posts: 7253
- Joined: Sun Mar 22, 2015 1:51 am
Re: Modding Tutorials
Probably need to make it a .json.txt file and that should allow it in the asset bundle. Or just a straight .txt file should do the trick too.
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: Modding Tutorials
This page implies to me that json extension should be supported. https://docs.unity3d.com/560/Documentat ... Asset.html
I'll try changing to .txt tonight in case it does work.
I'll try changing to .txt tonight in case it does work.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
-
- Posts: 14
- Joined: Fri Mar 02, 2018 9:06 pm
Re: Modding Tutorials
Is there any way to make a list of all assets and calculate how many times each one is used? It could help to decide what stuff to remake in the first place. Because who wants to spend time on stuff that is rarely seen in the game?
-
- Posts: 177
- Joined: Sun Mar 22, 2015 9:52 am
Re: Modding Tutorials
PerfectionistsSkipper wrote:Is there any way to make a list of all assets and calculate how many times each one is used? It could help to decide what stuff to remake in the first place. Because who wants to spend time on stuff that is rarely seen in the game?
But what you say makes sense, anyway.
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: Modding Tutorials
No idea if this is somewhere later in the thread, but we really need to update this list of known issues with this one:LypyL wrote: Known Issues
enums - scripts with enum types defined will fail to compile. You can still use any of the enum types already in the project. This is an issue with the mcs compiler.
generic functions / classes - similar to the above, due to an issue with the compiler scripts that try to define generic functions will not compile.
Unity Versions - mods created in newer versions of unity might not be compatible with older versions of unity. This is noticeable if the mod is in the mod directory, but doesn't show up in the list of mods.
Type.GetType() - You can't get the type of a class added in a mod from a class outside the mod i.e. DFU core. You have to register the type from the mod code and use that Type instance.
I spent ages trying to figure out why code would work in debug but not when packaged into a modfile.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods