Cracking Open Combat

Discuss modding questions and implementation details.
l3lessed
Posts: 42
Joined: Mon Aug 12, 2019 4:32 pm

Re: Cracking Open Combat

Post by l3lessed » Wed Aug 14, 2019 6:44 pm

I'll look into it when I have a chance in next week or so. I need to track down where the stealth mechanics are located, as I have not seen any indication of them in the combat scripting I have been running through.

I'm still trying to get a 100% confirmation coding wise, on armor merely upping your agility/dodge chance. All in game observations verify the only thing higher armor does it up your chance to not get hit, but no one has confirmed it in the code yet. Maybe, I'll be lucky and find the formulas and code for both these things in the same area. That be nice.

Things will be going slower on my end though; the semester is kicking back into gear, and I, despite loving tech and coding, am actually in education. I taught college composition, technical writing, and critical thinking for 10 years and am now doing program development using my tech knowledge. Point being, I may come in and out on this project, so be patient please. :D

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

Re: Cracking Open Combat

Post by l3lessed » Wed Aug 14, 2019 6:49 pm

That is interesting and can cause some challenges, if you manage to get different ranges to work the next thing would be how the enemies would decide which weapon to use. They will sometime opt to use a bow if they have LOS which if broken makes them walk into melee range. So there is something going on within the code already to allow them to choose missile weapon vs melee. But if it came down to a dagger vs a Dai-Katana it could be challenging to get them to decide which would be better. Right now I would say the Dai-Katana but if you could make it so there is an optimal range to use a two handed weapon by giving negative modifiers to hit as the target got closer or a drop in damage that would be a good start.
Thanks for pointing this out. I have not seen where this is taking place, or I have and just overlooked it. My best guess would be it is using the sense engine to detect how close or far the enemy is and their approach speed, and then tells the enemy to switch to a melee weapon if they trigger some approach speed and distance minimum.

As of now, I didn't even consider enemies switching multiple melee weapons, if they have them. I see no reason adding range to melee weapons should affect current range mechanics or enemies switching to melee weapons. The code I'm modifying or adding doesn't appear to touch those mechanics or the variables the control them in anyway. However, laws of unintended consequences. Will find out when I get deeper and am able to start play testing the changes in engine.

User avatar
Jay_H
Posts: 2512
Joined: Tue Aug 25, 2015 1:54 am

Re: Cracking Open Combat

Post by Jay_H » Wed Aug 14, 2019 7:18 pm

The combat formulas, AFAIK, are in the FormulaHelper. I was going to pick through it and see what I could bring out for you but I'm not that good at reading code :lol: Interkarma has very good inline comments so you should be able to orient yourself around with it.
Come join the Unofficial Daggerfall Unity Discord.
See the Daggerfall Unity Wiki on the UESP.
Progress on fixing classic quests here.

Ommamar
Posts: 277
Joined: Thu Jul 18, 2019 3:08 am

Re: Cracking Open Combat

Post by Ommamar » Wed Aug 14, 2019 7:24 pm

I have not fully seen the code how stealth is implemented just references to this function playerMotor.IsMovingLessThanHalfSpeed made in several places. But have not found where it is in the code so far, I think it is the key to fully understand how stealth is implemented. Just from game play I would say a stealth check is used regardless of what speed you are moving. I just think there is a heavy modifier implemented when the stealth key is activated. I have occasionally ran up to an enemy that didn't notice me initially, if I stand there a few seconds they seem to discover me then initiate combat. Stealth also raises in a passive way regardless if I use stealth or not which tells me running doesn't disable it just makes you very bad at it. Of course I would love to see code to gain a full understanding.

I think those are components of the system l3lessed but there is also a LOS component as if you stop at the start of a hallway with a bow using enemy that has sensed you they begin shooting at you, If you then move back or place a wall between them and you they come forward to where they last saw you to engage in melee.

User avatar
mikeprichard
Posts: 684
Joined: Sun Feb 19, 2017 6:49 pm

Re: Cracking Open Combat

Post by mikeprichard » Wed Aug 14, 2019 7:35 pm

l3lessed wrote:
Wed Aug 14, 2019 6:44 pm
I'm still trying to get a 100% confirmation coding wise, on armor merely upping your agility/dodge chance. All in game observations verify the only thing higher armor does it up your chance to not get hit, but no one has confirmed it in the code yet. Maybe, I'll be lucky and find the formulas and code for both these things in the same area. That be nice.
Yes, armor mechanics are exactly the other thing I'm trying to nail down for the UESP classic pages! I understand you're busy and everyone has real life stuff, but if you can eventually clarify what exactly is going on in the code with both armor and stealth (for stealth, possibly including the DFU code I linked above - https://github.com/Interkarma/daggerfal ... es.cs#L573), it will be a huge help. Also, see here for my very preliminary armor testing, which also suggests armor may only affect chance to be hit rather than have anything to do with damage reduction: viewtopic.php?f=8&t=2514#p29304. Thanks all!

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

Re: Cracking Open Combat

Post by l3lessed » Wed Aug 14, 2019 11:05 pm

Will do. I might be able to help you out with this

Also, I wouldn't assume everything is under one script file, as they are communicating back and forth constantly. So, the formula may be in one area, but more specific effects/code used to execute the formula may be tucked and hidden in other script files.

I'm discovering this as I go along myself. I think I have everything where it should be, only to get a compile error and track down another public variable or routine being used in some other script file I never would of thought to look into.

As an example, to get the range property into the engine and showing, I had to edit 6 different files. And the last one totally threw me off, as it was hidden inside an item creation script, where it assigns item properties based off of materials. Because I didn't know about this, the engine wasn't carrying the property through to the item, since it didn't know what to do with the range variable based on the material type. I just ended up adding the property and defaulting it to the set range, as material type should not affect range.

Good news, weapon range is being properly injected into and read by the engine from the item template file. This means all items can now have a custom range number, which can be used for any number of things, even outside of combat. I also used a float point variable, like weight does, so ranges can be set to precise numbers to allow more unique feel to each weapon. I ultimate need to figure out how the units are actually being measured in game to ensure it scales to real life weapons and ranges. Then I need to decide on what measurement unit I will be using. I am thinking using ft and inches, but also considering cm for metric people.

Does anyone here have any experience with UI manipulation? In order to ensure my code was being injected and read,, I merely changed the weight info read out in the inventory to read out the range. When I tried to add an extra line to show range into the UI, I can't get it to show up. I am confused about how the UI is working. Where is the item info UI readout stored specifically? I've gone through numerous UI script files, and even created a extra ui painting token to see if that would do it, but it did nothing.

BansheeXYZ
Posts: 472
Joined: Fri Oct 23, 2015 8:19 pm

Re: Cracking Open Combat

Post by BansheeXYZ » Thu Aug 15, 2019 2:47 am

l3lessed wrote:
Mon Aug 12, 2019 5:01 pm
I love daggerfall, but the combat system takes all the power from the player and gives it over to passive systems and luck, which is horrid design in modern gaming theory and systems.
I like experimenting with new mechanics, so I hope you'll give us something to try. But I think you're going to have a hard time turning Daggerfall's enemies into Skyrim/Dark Souls enemies without advanced 3d models and animations. It's probably possible to get rid of "chance to hit" stuff at least. You'd have to:

-bump everything's hp to account for all the new hits landing
-nerf knockback to a 20% mace attribute or something so you don't effectively stunlock everything
-make enemies faster so you can't kite them so easily, but give them an attack pause so that you can bait them into stoppage for a counterattack

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

Re: Cracking Open Combat

Post by l3lessed » Thu Aug 15, 2019 8:30 pm

Thanks for the encouragement.

I have been thinking about this sense I started messing around. However, there are things that can be done to mitigate these issues up front. One of them will be monsters will get range increases from the weapons they use too, so you aren't the only one with the range advantage.

I also plan on putting in some movement modifiers for when your attacking and in combat state. I want to reduce speed a small amount when your unsheathed to simulate going into a combat stance. After than, going to see if I can also slow down player movement while in swing state, so when swinging you're largely locked in position with some minor movement for adjustments.

I also plan on messing with combat states at some point to see if I can add in some extra combat states to simulate more combat mechanics and degrees of attacks. I hope I can use this to create parry windows and power attacks and the likes of that.

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

Re: Cracking Open Combat

Post by l3lessed » Thu Aug 15, 2019 8:33 pm

Good news, weapon range is officially in my engine and being injected into the weapons when they are randomly generated by the engine. I just messed with it and got my longsword to double and triple its attack range by merely adjusting the itemtemplate variable I introduced. Right now, I'm just throwing in random guesses on the ranges based on the default weapon range of 2.25f. Will get it honed it as this develops.

Bad news, laws of unintended consequences. Setting reach to 0 seems to make the weapon disappear in fps mode. I'm unsure if this will affect none weapon items, since they don't use the weapons manager script at all. The one consequence I need to debug is fists are now gone. I have to find where the fist attack/setup code is and see how it is setting their default range. Once I do, I'm going to just force in a hard constant range that will never change. To be far, all npcs and player should have same melee reach.

I also think I hit another small bug. To test it real quick, I forced in a static method in the itemhelper script. It retrieves the range info and assigns it to the weapon when it equipped via weaponmanager script. However, since I forced it in via a static method/variable, range doesn't seem to be changing after the first weapon. Need more testing. Should be easy to fix, once I figure out how to create a instance of the range method and pass it through that.

BansheeXYZ
Posts: 472
Joined: Fri Oct 23, 2015 8:19 pm

Re: Cracking Open Combat

Post by BansheeXYZ » Thu Aug 15, 2019 9:00 pm

l3lessed wrote:
Thu Aug 15, 2019 8:30 pm
I want to reduce speed a small amount when your unsheathed to simulate going into a combat stance. After than, going to see if I can also slow down player movement while in swing state, so when swinging you're largely locked in position with some minor movement for adjustments.
These both sound like ideas that could work well and make combat more strategic.

Post Reply