Settings.ini: Weapons Settings

Post here if you need help getting started with Daggerfall Unity or just want to clarify a potential bug. Questions about playing or modding classic Daggerfall should be posted to Community.
User avatar
Xaphir
Posts: 85
Joined: Sat Jul 16, 2016 12:55 pm

Settings.ini: Weapons Settings

Post by Xaphir »

Interkarma, this is what I've currently got set:

WeaponSwingThreshold = 0.0
WeaponSwingTriggerCount = 3

I can get swings from this but could probably get better results if you can explain what each of these do. I've been doing trial and error type settings.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Settings.ini: Weapons Settings

Post by Interkarma »

WeaponSwingThreshold is how far you must move the mouse from last frame position to register a movement. This is tied to how Unity tracks mouse movement. A low threshold means high sensitivity, high threshold means low sensitivity. Valid range is 0.1-1.0 (your setting of 0.0 will be clamped to 0.1 internally).

WeaponSwingTriggerCount is how many frames you must move the mouse along the same axis (forward, backward, left, right, diagonals) in a row before a weapon swing is triggered. Lowering this value changes how many frames it takes to initiate a swing. This prevents swings triggering too early.

If you're having trouble with weapon swings, there are two known causes at this time:
  • If frame rate is too low, swing detection can become sluggish (because it's frame-dependent). Gradually lower the values above until the desired sensitivity is reached. The defaults seem to work well at around 30fps or greater.
  • Unity runtime on Linux can have general problems with mouse input. Most users reporting weapon swing issues are on Linux. I have very few problems in Ubuntu, but ymmv.
I'm not ready to overhaul weapon swings just yet, and when I do I'd like to find a non frame-dependent way of handling this (possible but non-trivial based on how Unity updates Input).

Something that may help in the short term is a scaling value of some kind, like WeaponSwingSensitivity, to replace the two confusing values above. If I give you the ability to scale mouse input for attacks, you should eventually be able to find a good number that works regardless of how swings are counted internally.

Of course, if it's a mouse input issue while cursor locked (problematic in Linux) then you may be out of luck anyway.

User avatar
Xaphir
Posts: 85
Joined: Sat Jul 16, 2016 12:55 pm

Re: Settings.ini: Weapons Settings

Post by Xaphir »

Interkarma wrote:WeaponSwingThreshold is how far you must move the mouse from last frame position to register a movement. This is tied to how Unity tracks mouse movement. A low threshold means high sensitivity, high threshold means low sensitivity. Valid range is 0.1-1.0 (your setting of 0.0 will be clamped to 0.1 internally).
You really aren't kidding about the clamping. I had settings.ini pulled up in gvim at the same time the game was running; DFU changed my setting from 0.0 to 0.1 right there in front of me, in the editor.
Interkarma wrote:WeaponSwingTriggerCount is how many frames you must move the mouse along the same axis (forward, backward, left, right, diagonals) in a row before a weapon swing is triggered. Lowering this value changes how many frames it takes to initiate a swing. This prevents swings triggering too early.

If you're having trouble with weapon swings, there are two known causes at this time:
  • If frame rate is too low, swing detection can become sluggish (because it's frame-dependent). Gradually lower the values above until the desired sensitivity is reached. The defaults seem to work well at around 30fps or greater.
  • Unity runtime on Linux can have general problems with mouse input. Most users reporting weapon swing issues are on Linux. I have very few problems in Ubuntu, but ymmv.
The trouble with swings is greatly reduced in Linux 28. There is a caveat however; I can do left-right and right-left downswing diagonals, but not forward plunge, or right-left left-right horizontals. I have gotten a vertical downswing after focused effort. I am on a Logitech G602. The G602 sends so much data back to the machine that it requires monopoly use of a logitech transmitter. It is possible I might not be doing something right or holding my coffee correctly; I need to spend more time on it.

Interkarma wrote:I'm not ready to overhaul weapon swings just yet, and when I do I'd like to find a non frame-dependent way of handling this (possible but non-trivial based on how Unity updates Input).

Something that may help in the short term is a scaling value of some kind, like WeaponSwingSensitivity, to replace the two confusing values above. If I give you the ability to scale mouse input for attacks, you should eventually be able to find a good number that works regardless of how swings are counted internally.

Of course, if it's a mouse input issue while cursor locked (problematic in Linux) then you may be out of luck anyway.
Mathematicians have complained that this is the "Age of Oversimplification". I tend to agree with them. If we can retain greater flexibility with your two existing settings, then I would say let's keep them. But if we are consolidating for sake of convenience or by reason that someone might not be reading the manual, then on the other hand I still say let's keep them. ;)

If on the third hand you know about an insufficiency with these two parameters that needs to be rectified, that's another matter entirely.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Settings.ini: Weapons Settings

Post by Interkarma »

Xaph, in the next build (20-Aug-16 or later) I've added some new INI settings that might help us get to the bottom of weapon swing issues.

In [Controls], I've added WeaponSenstivity that scales mouse input by value. Default is 1.0, valid range is 0.1 to 10.0. More on this in a bit.

Under [Experimental], I've added flag for DebugWeaponSwings. When this flag is true, and you have a weapon drawn, the internal mouse state for weapon swings is printed out to top-left corner of screen.

When idle, you will see both axes at 0.0. When holding down right-mouse and swinging mouse around, you should see the values shoot up and down as the mouse is being sampled.

To trigger a weapon swing, you need to increase the axes to a value above WeaponSwingThreshold for a total of WeaponSwingTriggerCount frames in a row. For example (with default settings) to perform a sideways left-to-right swing requires you to raise the mouseX value to 0.8 or greater while the mouseY value remains less than 0.8 for a total of 3 frames.

It should be very easy to raise these values by moving mouse in a particular direction. Depending how fast you move the mouse, it should shoot up anywhere from 1.5 to 4.0 without much effort. If you're seeing much larger numbers, that could be a problem also.

When you can, I'd like you to first have a play with the debug string, but please set the WeaponSwingThreshold back to 0.8 and WeaponSwingTriggerCount back to 3 first, and only change the WeaponSenstivity for now. But start from 1.0 so everything is at defaults.

First, try a simple swing like left-to-right and let me know what the mouseX and mouseY values peak to.

If the numbers are very high (>4.0), try gradually lowering WeaponSenstivity by 0.1 at a time to bring this back towards 1.0-4.0.

If the numbers are very low (stay near 0.0), try gradually increasing WeaponSenstivity by 0.5 at a time (or more if needed) to bring this back towards a 1.0-4.0 range.

If the numbers are consistently low at all times no matter the WeaponSenstivity, then this could be the Unity Linux mouse bug I spoke of earlier. Mouse sampling will remain near zero or shoot off in weird directions.

I know that's a lot of information. Please just let me know if questions. I'll have that build up for you in the next 24 hours (or you can grab from git now). Either way, you will need to run Daggerfall Unity at least once to populate the new INI settings before you can change them.

User avatar
Xaphir
Posts: 85
Joined: Sat Jul 16, 2016 12:55 pm

Re: Settings.ini: Weapons Settings

Post by Xaphir »

Interkarma wrote:Xaph, in the next build (20-Aug-16 or later) I've added some new INI settings that might help us get to the bottom of weapon swing issues.

In [Controls], I've added WeaponSenstivity that scales mouse input by value. Default is 1.0, valid range is 0.1 to 10.0. More on this in a bit.

Under [Experimental], I've added flag for DebugWeaponSwings. When this flag is true, and you have a weapon drawn, the internal mouse state for weapon swings is printed out to top-left corner of screen.

When idle, you will see both axes at 0.0. When holding down right-mouse and swinging mouse around, you should see the values shoot up and down as the mouse is being sampled.
Love it! I frakking love it!!! Fantastic gift! Can I keep it??
Interkarma wrote:To trigger a weapon swing, you need to increase the axes to a value above WeaponSwingThreshold for a total of WeaponSwingTriggerCount frames in a row. For example (with default settings) to perform a sideways left-to-right swing requires you to raise the mouseX value to 0.8 or greater while the mouseY value remains less than 0.8 for a total of 3 frames.

It should be very easy to raise these values by moving mouse in a particular direction. Depending how fast you move the mouse, it should shoot up anywhere from 1.5 to 4.0 without much effort. If you're seeing much larger numbers, that could be a problem also.
Yep, hands down the most awesome delta so far. Can't wait to try this out!
Interkarma wrote:When you can, I'd like you to first have a play with the debug string, but please set the WeaponSwingThreshold back to 0.8 and WeaponSwingTriggerCount back to 3 first, and only change the WeaponSenstivity for now. But start from 1.0 so everything is at defaults.
Got it, will do
Interkarma wrote:First, try a simple swing like left-to-right and let me know what the mouseX and mouseY values peak to.

If the numbers are very high (>4.0), try gradually lowering WeaponSenstivity by 0.1 at a time to bring this back towards 1.0-4.0.

If the numbers are very low (stay near 0.0), try gradually increasing WeaponSenstivity by 0.5 at a time (or more if needed) to bring this back towards a 1.0-4.0 range.

If the numbers are consistently low at all times no matter the WeaponSenstivity, then this could be the Unity Linux mouse bug I spoke of earlier. Mouse sampling will remain near zero or shoot off in weird directions.
I reeeaallly hope it ain't that. I'm more hoping that it's X11 mouse settings at default, and not fine tuned in the xorg.conf.
Interkarma wrote:I know that's a lot of information. Please just let me know if questions. I'll have that build up for you in the next 24 hours (or you can grab from git now). Either way, you will need to run Daggerfall Unity at least once to populate the new INI settings before you can change them.
As soon as I see it go up it's gonna be on, like ping pong in hong kong.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Settings.ini: Weapons Settings

Post by Interkarma »

Xaphir wrote: As soon as I see it go up it's gonna be on, like ping pong in hong kong.
Going up in next 15 mins. :)

User avatar
Xaphir
Posts: 85
Joined: Sat Jul 16, 2016 12:55 pm

Re: Settings.ini: Weapons Settings

Post by Xaphir »

Ok Interkarma - getting it now

User avatar
Xaphir
Posts: 85
Joined: Sat Jul 16, 2016 12:55 pm

Re: Settings.ini: Weapons Settings

Post by Xaphir »

IK this is absolutely excellent. With these experimental parameters I am able to control the weapon better than ever. Now I'm doing horizontal swings, both down diagonals, I have even managed a straight down swing. Blade plunges and straight down swings seem to be the most difficult to pull off. I'm watching the numbers and trying to get some correlations. I defaulted WeaponSwingThreshold and WeaponSwingTriggerCount as you requested, then tried boosting WeaponSenstivity to 2. Weapon control was already way improved with WeaponSenstivity = 1, but it seems that now I have more horizontal blade control, and periodic vertical downswings as well.

I need to continue to play more and see what numbers are generated. They move fast so I have to be paying attention pretty close. After I get a better idea of what's happening, I'm going to attempt finetuning WeaponSensitivity as you suggested.

User avatar
Xaphir
Posts: 85
Joined: Sat Jul 16, 2016 12:55 pm

Re: Settings.ini: Weapons Settings

Post by Xaphir »

IK: Based on your original instructions, and after I got the best weapons results, I came up with the following procedure:



Preface: settings.ini is located in .config/unity3d/Daggerfall Workshop/Daggerfall Unity/


1) Under [Experimental], set DebugWeaponSwings = True

2) Confirm that WeaponSwingThreshold = 0.8 and WeaponSwingTriggerCount = 3 (Starting Point Defaults). Default for WeaponSenstivity should be already set at 1, for now.

3) Go into the game and swing a weapon horizontally from left to right and back. Watch your mouseX and mouseY values in the upper left hand corner of your screen; note what the maximum peaks are.

4) The range you want those numbers to be in are <= 4. (Some peaking above 4 is ok, you are concerned with averages; 85 to 90% is what you want to be seeing)

5) The first step to start normalizing your mouseX and mouseY values are to begin adjusting your WeaponSensitivity in .1 increments, up or down, depending on what your mouseX/mouseY are averaging.

Example: mouseX/mouseY is blasting at +30 or more. Adjust WeaponSensitivity down ( .1 increments) until your average peaks are at 4. (This means edit your settings.ini, enter game, test, exit game, edit settings.ini, reenter game.....etc.)

Example: mouseX/mouseY is peaking at 2.45. Adjust WeaponSensitivity up until you are seeing an average peak of 4. Again, a minority of numbers over 4 is ok, as long as you are peaking 90% or so on 4. Expect variances.


6) Now you just laid the groundwork for what is to come. This is where we get increased control of the weapon, and faster reaction times. With your X/Y numbers now in spec, to improve control of the weapon, start increasing sensitivity of the WeaponSwingThreshold parameter downwards in .1 increments. Once your control of weapon movement is is what you expect, you now want to perfect your reaction time.

Note: Checking control means you need to test every available aspect of weapon movement, in every test instance. Example, blade: Forward plunge, left-right down diagonal, right-left down diagonal, horizontal left-right, horizontal right-left, vertical downstroke.


7) After you adjust WeaponSwingThreshold, recheck your mouseX/mouseY numbers again, it is probable that they have changed. If they are out of spec, you need to revisit step 5 and bring them back into spec. Then, jump back to step 8.

8) Reaction time is affected by WeaponSwingTriggerCount. This parameter only works with whole integers. Interkarma will have to confirm the exact upper limits on this parameter, but the bottom line is to adjust downward to get faster reaction time. In my case, going from 3 to 2 was just about perfect.

9) Do a final check on your mouseX/mouseY numbers. They should be ok; but ymmv. If not, revisit step 5.
Last edited by Xaphir on Sat Aug 20, 2016 11:05 am, edited 9 times in total.

User avatar
Xaphir
Posts: 85
Joined: Sat Jul 16, 2016 12:55 pm

Re: Settings.ini: Weapons Settings

Post by Xaphir »

IK, final results:

WeaponSwingThreshold = 0.9
WeaponSwingTriggerCount = 2
WeaponSensitivity = 1.2

Post Reply