Changing how large the player's weapon is displayed as on the UI?

Discuss modding questions and implementation details.
Post Reply
Litoncinnamon
Posts: 3
Joined: Wed Jan 27, 2021 6:49 pm

Changing how large the player's weapon is displayed as on the UI?

Post by Litoncinnamon »

Weapons (And equipable items in general) have always been perhaps the most aesthetically disappointing aspects of Daggerfall for me. Whereas in Morrowind you may find a beautiful looking weapon and get to look at it everywhere you go and feel the power within your hands, in Daggerfall it's just a different colored verison of what you already have.

I'd like to try to change this by making a mod to reskin the weapons like the DREAM mod does, but while making the actual images is not altogether too difficult I am being significantly held back by the size restrictions of the weapon UI texture. (To clarify I am not looking to change the way the weapons look in the inventory (Yet at least) but am wanting to change the way they look when you physically swing them in game.) The texture size is simply too small to fit a really good looking weapon in, especially since I was wanting to emulate the look of how the weapons appear in the first person perspective when playing skyrim or oblivion. (Say what you will about those games the first person view of your weapon is pretty cool, to me at least. :D )

So my quesiton is: are there any ways to resize the displayed weapon size on the UI to facilitate this proposed mod?

Thank you for your help, I'm very new to modding and while I have some programming and unity experience I am still learning the ropes. :lol:

l3lessed
Posts: 1403
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Changing how large the player's weapon is displayed as on the UI?

Post by l3lessed »

Technically yes.

As an example, I can import a super hi-res shield into my shield mod, and then resize the rect down to the native 320 X 200 setup. This creates the hi-res detailed texture look, while getting the rect object sized to fit the screen.

However, once you start talking about redoing the original atlas textures, it gets a little more complicated. First off, each weapon has 5 separate animation frames you would need to retexture, and each animation is placed in specific spots on screen to ensure no frame cut-offs show.

Also, you would have to build in custom code if you wanted to add in custom variations for each blade and material type. As of now, the code works by forcing a shift in the texture color for the material. You would have to override that process and import your custom textures into their atlas loader object for each weapon type and material type. You also would have to ensure you kept the exact same image dimensions when creating the hi-res version and than downscaling or you risk cut offs showing as it moves through each attack sprite.

If you want to do this though, start by looking both at FPSWeapon.cs script to see how they setup the render system. Also, go through my ambidexterity and shield mods to see how I import custom textures and render them to work like classic mechanics. I would love to see more detailed weapons in my ambidexterity mod.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Litoncinnamon
Posts: 3
Joined: Wed Jan 27, 2021 6:49 pm

Re: Changing how large the player's weapon is displayed as on the UI?

Post by Litoncinnamon »

Okay, I did what you said and looked at the FPSWeapon script. I found the following code:
// Get weapon dimensions
int width = weaponIndices[weaponAnimRecordIndex].width*2;
int height = weaponIndices[weaponAnimRecordIndex].height*2;
I added the *2 and now the weapons are enormous. While I have yet to fine-tune how big they are this is a step in the right direction. I also looked through your shield mod scripts (By the way awesome job on that mod, it's easily my favorite anyone's made and it turns Daggerfall into a whole new level of fun. :D ) and tried to absorb as much as I could. I am also seeing what you mean about the offset of the animations so they don't go off of the screen and assume I'll have to adjust those a bit too to make everything fit.

My question is how would I implement these changes into a mod? (I'm sure this is a very basic question but I have not made a mod before and am still unclear on what you can and cannot do.) What I'm proposing would be a change to one of the game's core scripts and I'm not sure how one implements that or even if you can. Is there an accepted way of accomplishing this or should I explore different methods of making this mod?

My other idea would be to set the regular weapon textures as transparent and simply put my own textures where they would have been and have them coincide with what animation would have been playing, similar to how your mod puts the shield on the screen. This would also make every weapon having a different texture trivial to implement. This would not require changing the game's core scripts but I am very new and am not sure which one is the better route. (Though the more I talk about this one the better of an idea it seems compared to the last)

l3lessed
Posts: 1403
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Changing how large the player's weapon is displayed as on the UI?

Post by l3lessed »

just changing the base FPSWeapon scripts will not make this a mod. You will need to setup your own mod script and then listen/call the fpsweapon script and its objects to do what you want. That then is compiled into the mod file. If you change a base script file, you have to release it as its own stand alone build separate from the dev version; This is what I did for my combat overhaul project, before I got it moved to a mod file.

There is two ways to do this, and I did them both.

The first way is to rebuild the fps render system using the fpsweapon script public objects as a base and recreating what is private but needed. I did this by either directly calling the objects from the FPSweapon script I could, and the non-public ones, I rebuilt from the FPSWeapon script using copy/paste and some tiny edits. You can see my ambidexterity mod and the weapon script files to see what I mean. However, you will need to learn how to use the custom texture import option in the Atlast import object. The benefit of this approach though is it should be more compatible with other mods since it uses the atlas import. The draw back is it requires more work because it is relying on using both base script objects and creating your own where needed.

The second way is to create a custom texture importer and build the rect and render code from scratch yourself. I did this in my shield module, since shield textures were never part of the original game. This is the easiest one since your completely removing the original atlas texture system. First, you need to see if you can hide the original texture without breaking anything. I don't think you can false out the weapon show object, as it will then cause the weapon scripts to stop updating. The update cycles are directly tied to the weapon showing or not if my memory is correct. Once you hide those, you will need to replicate the fps render system. Just create the directories to store the textures, setup the code to pull the texture you need, and then trigger it. It is harder with weapons because you have 5 sprites to load based on the render frame. My shield is a single texture I move around using the built in rect vars.

Also, I believe all you did with those changes was double the texture size itself.

One thing to understand when working on this. There are multiple things that control how a texture is rendered and its size. Just multiplying them by 2 might not actually be giving you higher res textures or texture render room. It could just be doubling the image, so if you put a larger texture in, it would be even bigger.

Code: Select all

public static Rect shieldPos = new Rect(0, Screen.height - 400, 850, 850);
GUI.DrawTextureWithTexCoords(shieldPos, shieldTex, new Rect(0.0f, 0.0f, .99f, .99f));
As you see in this code, the shield position rec has its own size controllers to increase and decrease the shield texture size. Then there is the rect texture coordinates, which is the new Rect() in the GUI.DrawTexture object, which affects how the texture is rendered on the rect object itself. Don't confuse the two, as I did.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

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

Re: Changing how large the player's weapon is displayed as on the UI?

Post by King of Worms »

The texture size is simply too small to fit a really good looking weapon in
Are we talking about the resolution or the size here?

Resolution is basically unlimited.

If you want, I can send you a set of a DREAM sword of one material and you can take a look.

What I miss is the size difference between long sword and short sword. They are the same :X

l3lessed
Posts: 1403
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Changing how large the player's weapon is displayed as on the UI?

Post by l3lessed »

What I miss is the size difference between long sword and short sword. They are the same :X
Don't worry, I plan on putting in differing weapon sizes for the differing weapons that share the same atlas texture in Ambidexterity module. That was going to be the next thing after first release with patches.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Litoncinnamon
Posts: 3
Joined: Wed Jan 27, 2021 6:49 pm

Re: Changing how large the player's weapon is displayed as on the UI?

Post by Litoncinnamon »

Are we talking about the resolution or the size here?
Both, some of the original files are less than 80x80 in size... Try getting creative with that! :lol: I'm thinking I'll go with the second method I3Iessed brought up. While prior experience with programming makes me lean towards the first in terms of efficiency and such, it does not seem like "Hey this is my first mod ever let's do it" type stuff. I also tested the idea with making the weapon textures transparent, I set up a CifRci folder with weapon textures in my installation and set some sword animations as being completely transparent and others being visible. Fortunately, all of them worked, so it would seem to me that the idea of setting them as transparent and playing my own animations where they would have been will hopefully work, though it does have the possibility of clashing with other mods particularly ones that would reskin the textures of the weapons.

It would also allow the thing that everyone's been asking for but I've never really seen done yet, which is an individual texture for every weapon instead of them all looking the same.

I'll keep you guys posted (I'll probably have some more questions later on) I've got some pictures to use for a steel sword relatively identical to the one in Skyrim that I'll try to implement. (I thought it would be cool to use swords from various Elder Scrolls titles as the textures for this mod) thank you so much for your answers I was surprised to get such good answers on such a seemingly small forum. Wish me luck! :D

Post Reply