Modding Tutorials: Asset-Injection

Discuss modding questions and implementation details.
User avatar
TheLacus
Posts: 879
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: Modding Tutorials: Asset-Injection

Post by TheLacus » Wed Mar 06, 2019 10:00 pm

King of Worms wrote:
Wed Mar 06, 2019 11:57 am
Im experimenting with the map replacement. The main files work nicely!

But Ive found some minor images which do not work yet (the size is not right - way too big after upscale)

TRAV0I03.IMG - Find/Im at button

TRAVAI05.IMG - DOWN arrow
TRAVBI05.IMG - UP arrow
TRAVCI05.IMG - RIGHT arrow
TRAVDI05.IMG - LEFT arrow

Rest is working nicely, main map and region maps and other buttons, great job!!
Fixed in next build.
King of Worms wrote:
Wed Mar 06, 2019 11:57 am
Rest is working nicely, main map and region maps and other buttons, great job!!

Only thing Im not happy with now is that the red flashing regions which show where you are located, are still 320*200 and it looks bad. Is it possible to have any access to the file which is responsible for this?
Its described here in a last post, with a screenshot. THANK YOU!!

viewtopic.php?f=22&t=1804&start=30
I'm aware but i need to think about how to best expose this feature to mod creators. :)
If you are interested in creating mods for Daggerfall Unity you can find the documentation here.

User avatar
King of Worms
Posts: 2025
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Modding Tutorials: Asset-Injection

Post by King of Worms » Wed Mar 06, 2019 10:03 pm

Perfect, thanks a lot!

User avatar
TheLacus
Posts: 879
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: Modding Tutorials: Asset-Injection

Post by TheLacus » Wed May 15, 2019 8:38 pm

@Nystul and texture mod authors

Terrain textures are currently merged into a texture array at runtime. I've been experimenting with the process of creating arrays from the editor and build them as assets, which would bring these benefits:
  • Somewhat faster loading time: in my tests, creating a texture array takes around 400 ms while loading a serialized one takes less than 200 ms. They are cached so this improvement is only for the first time.
  • No work for the garbage collector: individual textures doesn't exist at run time and they never use memory or need to be disposed.
  • Failures due to different size, format etc. are detected in editor and not at run time.
While these are the cons:
  • This is an additional step for mod authors. They need to process textures with a tool like the basic one i wrote for tests (ignore the example textures)
    Image

    or something more advanced like this one.
  • When bundled in a mod the texture array asset takes the same space as the sum of individual textures, but is an additional file on disk for mod authors.
    2019.05.15-22.07.png
    2019.05.15-22.07.png (669.89 KiB) Viewed 566 times
All things considered, I think this is a worth addition. My idea is to make it optional and look for both Archive-TexArray and Archive-0-0 without breaking load order, but i want to check if there is any objection or feedback first.
If you are interested in creating mods for Daggerfall Unity you can find the documentation here.

User avatar
King of Worms
Posts: 2025
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Modding Tutorials: Asset-Injection

Post by King of Worms » Wed May 15, 2019 10:20 pm

Saw this on git few days back and got scared :D
But Im ofc for a optimalization.

Thing is, I honestly have no idea how much work would it be to for example convert whole DREAM mod so it can use the arrays.

One time 200ms saving is not much, but everything counts.
"No work for the garbage collector: individual textures doesn't exist at run time and they never use memory or need to be disposed." - what kind of savings does this bring please?
3rd point is no issue for me, but might help others...
HDD space is not a issue for me, I can live with that.

Making it optional is always a nice approach, but I think I will use this.

User avatar
Jaiysaun
Posts: 40
Joined: Tue May 28, 2019 3:08 pm

Re: Modding Tutorials: Asset-Injection

Post by Jaiysaun » Fri Jul 19, 2019 6:59 am

Sorry if this is a dumb question or already answered somewhere I didn't look, but on replacing armor textures:

"Custom texture should be provided with an additional tag to identify which variation they are meant to replace; the full name is Archive_Record-Frame for Chain(no tint) and Archive_Record-Frame_DyeColor for all other dyes."

What about leather though? I don't see it on the list. Treated like chain?

User avatar
TheLacus
Posts: 879
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: Modding Tutorials: Asset-Injection

Post by TheLacus » Fri Jul 19, 2019 9:20 pm

Jaiysaun wrote:
Fri Jul 19, 2019 6:59 am
Sorry if this is a dumb question or already answered somewhere I didn't look, but on replacing armor textures:

"Custom texture should be provided with an additional tag to identify which variation they are meant to replace; the full name is Archive_Record-Frame for Chain(no tint) and Archive_Record-Frame_DyeColor for all other dyes."

What about leather though? I don't see it on the list. Treated like chain?
I believe leather doesn't have an associated dye color, so it appears with standard texture. I'll update documentation to avoid confusion, thank you for bringing this up :)
If you are interested in creating mods for Daggerfall Unity you can find the documentation here.

User avatar
TheLacus
Posts: 879
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: Modding Tutorials: Asset-Injection

Post by TheLacus » Sat Jul 20, 2019 3:03 pm

King of Worms wrote:
Wed May 15, 2019 10:20 pm
Saw this on git few days back and got scared :D
But Im ofc for a optimalization.

Thing is, I honestly have no idea how much work would it be to for example convert whole DREAM mod so it can use the arrays.

One time 200ms saving is not much, but everything counts.
"No work for the garbage collector: individual textures doesn't exist at run time and they never use memory or need to be disposed." - what kind of savings does this bring please?
3rd point is no issue for me, but might help others...
HDD space is not a issue for me, I can live with that.

Making it optional is always a nice approach, but I think I will use this.
When a texture array is created, content of individual source textures is copied to new destination, somewhat like merging multiple images in a single atlas. This takes about 200 ms on modern hardware, and even more on old platforms where a fallback technique is used. Additionally, the latter also requires Read/Write flag with the associated increased memory usage.

By doing this in the editor we save some initialization time during terrain creation, which is a very critical step. I don't expect a big improvement but it would add up to the recent enhancements to terrain system, and i think this is good enough for an optional feature reserved to experienced modders. I don't intend to remove the ability to only provide textures and do everything behind the scene at run time.
If you are interested in creating mods for Daggerfall Unity you can find the documentation here.

User avatar
King of Worms
Posts: 2025
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Modding Tutorials: Asset-Injection

Post by King of Worms » Sat Jul 20, 2019 3:13 pm

Lets try it .)

PS: Saw it on git, looking forward, I hope I will be able to do that, but I think I will

Siwone
Posts: 3
Joined: Thu Aug 08, 2019 6:33 am

Re: Modding Tutorials: Asset-Injection

Post by Siwone » Thu Aug 08, 2019 7:19 am

Out of pure curiosity I decided to try replacing an NPC sprite with a 3d model and the process was quite easy using the Flats and Models part of the tutorial for reference. Even adding an idle animation was no problem. However I am unable to get the replaced NPC to function as the original did. It is my limited understanding that StaticNPC script is the one that handles most of the NPC functionality. I added the script to my prefab but now he opens the regular NPC dialogue window that any random NPC uses. The NPC I replaced was 182_22, aka the guy who gives quests at the Mage's Guild.

Do I need to write my own script or make some changes elsewhere for the NPC data to get properly injected to the replacement? StaticNPC script itself doesn't allow for any editing in the inspector so I am unsure how to proceed.

Pic of the model working. Disregard the actual model used, it was just for testing.
Spoiler!
Image

User avatar
TheLacus
Posts: 879
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: Modding Tutorials: Asset-Injection

Post by TheLacus » Thu Aug 08, 2019 5:07 pm

Siwone wrote:
Thu Aug 08, 2019 7:19 am
Out of pure curiosity I decided to try replacing an NPC sprite with a 3d model and the process was quite easy using the Flats and Models part of the tutorial for reference. Even adding an idle animation was no problem. However I am unable to get the replaced NPC to function as the original did. It is my limited understanding that StaticNPC script is the one that handles most of the NPC functionality. I added the script to my prefab but now he opens the regular NPC dialogue window that any random NPC uses. The NPC I replaced was 182_22, aka the guy who gives quests at the Mage's Guild.

Do I need to write my own script or make some changes elsewhere for the NPC data to get properly injected to the replacement? StaticNPC script itself doesn't allow for any editing in the inspector so I am unsure how to proceed.

Pic of the model working. Disregard the actual model used, it was just for testing.
Spoiler!
Image
Thank you for report, there is an issue with current build which causes imported npcs not to be assigned this component. I submitted a fix for next build.
If you are interested in creating mods for Daggerfall Unity you can find the documentation here.

Post Reply