Jump to content


Photo
- - - - -

Killing Floor 2 ADS Match Tool


  • Please log in to reply
7 replies to this topic

#1 Skwuruhl

Skwuruhl

    Math Wizard

  • Premium Members
  • Pip
  • 44 posts

Posted 14 April 2017 - 06:33 AM

The program will copy to your clipboard a console command to create 6 keybinds. Paste this into console and hit enter.

 

The keybinds scale from 1 being the lowest zoom level to 6 being the highest. When pressed they will set your zoom sensitivity to properly match for that zoom level. They also temporarily set your FOV to that zoom level to help you ensure you pressed the correct zoom level for your weapon. To check, just zoom in with your weapon after pressing the keybind. If the zoom level doesn't change throughout the zoom-in then you've selected the correct bind.

 

FOVOptionsPercentageValue is located in your KFGame.ini located in C:\Users\<user>\Documents\My Games\KillingFloor2\KFGame\Config

 

Coefficient is the screen match distance as a decimal but vertical. This is like Battlefield's coefficient so 1.33 would be the same as CS:GO and BF1 default.

 

Keybinds are numpad 1-6. Off the top of my head the corresponding binds are: 

5 is ARs/shotguns/some SMGs

6 is the lever action

1 is flamethrowers/mwg

4 is the grenade launcher and pistol

2 and 3 are pistols and most SMGs although I'm not sure which is which. I think 2 is pistols.

I don't have the scoped weapons (crossbow, m14, railgun) working because I don't know the FOV inside scopes or how their sensitivity is calculated.

 

Download: https://mega.nz/#!BN...aU93fadbcSpNxnI

 

Source code: 

import java.util.Scanner;
import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Clipboard;

public class test {
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		System.out.print("FOVOptionsPercentageValue=");
		Double fov = kb.nextDouble();
		System.out.print("Coefficient=");
		Double coef = kb.nextDouble();
		kb.close();
		ads test = new ads(fov, coef);
		StringSelection selection = new StringSelection(test.toString());
		Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
		clipboard.setContents(selection, selection);
	}
} 
import java.text.DecimalFormat;
import java.math.RoundingMode;

public class ads {
	double fov, coef, vfov;
	double[] zoom, vzoom;
	String[] bind;

	public ads(double f, double c) {
		fov = 90 * f;
		vfov = 2 * Math.atan(0.5625 * Math.tan(fov * Math.PI / 360));
		coef = c;
		zoom = new double[6];
		zoom[0] = 80 * f;
		zoom[1] = 77 * f;
		zoom[2] = 75 * f;
		zoom[3] = 73 * f;
		zoom[4] = 70 * f;
		zoom[5] = 65 * f;
		vzoom = new double[6];
		for(int i = 0; i < 6; i++) {
			vzoom[i] = 2*Math.atan(0.5625 * Math.tan(zoom[i] * Math.PI / 360));
		}
		bind = new String[6];
		calcBind();
	}

	public void calcBind() {
		DecimalFormat df = new DecimalFormat("#.######");
		df.setRoundingMode(RoundingMode.HALF_UP);
		bind[0] = "SetBind NumpadOne \"fov " + df.format(zoom[0]) + "|SetZoomedSensitivity "
				+ df.format(Normalization(0)) + "\"";
		bind[1] = "SetBind NumpadTwo \"fov " + df.format(zoom[1]) + "|SetZoomedSensitivity "
				+ df.format(Normalization(1)) + "\"";
		bind[2] = "SetBind NumpadThree \"fov " + df.format(zoom[2]) + "|SetZoomedSensitivity "
				+ df.format(Normalization(2)) + "\"";
		bind[3] = "SetBind NumpadFour \"fov " + df.format(zoom[3]) + "|SetZoomedSensitivity "
				+ df.format(Normalization(3)) + "\"";
		bind[4] = "SetBind NumpadFive \"fov " + df.format(zoom[4]) + "|SetZoomedSensitivity "
				+ df.format(Normalization(4)) + "\"";
		bind[5] = "SetBind NumpadSix \"fov " + df.format(zoom[5]) + "|SetZoomedSensitivity "
				+ df.format(Normalization(5)) + "\"";
	}

	public double Normalization(int z) {
		if (coef > 0)
			return Math.atan(coef * Math.tan(vzoom[z] / 2)) / Math.atan(coef * Math.tan(vfov / 2))
					/ zoom[z] / 0.013330;
		return Math.tan(vzoom[z] / 2) / Math.tan(vfov / 2) / zoom[z] / 0.013330;
	}

	@Override
	public String toString() {
		String output = "";
		for (String s : bind)
			output += s + "|";
		return output.substring(0, output.length() - 1);
	}
}

ADS sensitivity in KF2 is determined by your FOV and your ZoomedSensitivity value. More specifically when you zoom in your new sensitivity becomes

Sensitivity * ZoomedSensitivityScalar * fieldOfView * 0.013330

Where sensitivity is your hipfire sensitivity and fieldOfView is your current field of view, that is the zoomed field of view. 0.013330 is very close to dividing by 75. I originally thought it was dividing by 75 until I found them using * 0.013330 in decompiled code. Very strange way to do ADS sensitivity. Especially in a lot of cases your sensitivity can go up from hipfire. Meaning your distance/360 is even lower while ADS.


Edited by Skwuruhl, 17 April 2017 - 03:00 AM.

  • Joshua Willis likes this

#2 WhoCares?

WhoCares?

    Newbie

  • Premium Members
  • Pip
  • 82 posts

Posted 15 April 2017 - 03:39 PM

First of all: Great work, I really appreciate this! :)

But I have a few questions.

1: Do I have to run the "run.bat" ever again?

2 : Keys are NumPad 1-6 (from source Code), right?

3: My Fov never changes when zooming-in with any weapon regardless of what Num Key I press :/  That shouldn't be tha case, right?

4: Whenever I use a weapon with a different Zoom-Level-class (lets say lever Action to Pistol while combat), do I have to manuelly press the correct NumPads Key?

5: My ADS sensitivity feels to fast now (maybe ist just new for me cuz I played with lower ADS sense before ;) ) Does the FOVOptionsPercentageValue is already included in the claculations? Mine isnt the Default one, it's 1.183560


Edited by WhoCares?, 16 April 2017 - 10:07 AM.


#3 Skwuruhl

Skwuruhl

    Math Wizard

  • Premium Members
  • Pip
  • 44 posts

Posted 16 April 2017 - 03:05 AM

First of all: Great work, I really appreciate this! :)
But I have a few questions.
1: Do I have to run the "run.bat" ever again?
2 : Keys are NumPad 1-6 (from source Code), right?
2: My Fov never changes when zooming-in with any weapon regardless of what Num Key I press :/  That shouldn't be tha case, right?
3: Whenever I use a weapon with a different Zoom-Level-class (lets say lever Action to Pistol while combat), do I have to manuelly press the correct NumPads Key?
4: My ADS sensitivity feels to fast now (maybe ist just new for me cuz I played with lower ADS sense before ;) ) Does the FOVOptionsPercentageValue is already included in the claculations? Mine isnt the Default one, it's 1.183560

  • If the binds were successfully created you should only have to rerun run.bat if TWI ever adds new binds to the game. When they do this it will reset all your keybinds and you'll have to redo the console command. I made this program during early access where keybinds were frequently reset.
  • I did mention the numbers for the keybinds, but not that they were numpad so yeah.
  • I'm not sure if I entirely understand. But what you should do is: While in hipfire press the keybind to set the zoomed sensitivity. When you do this it should lower your FOV to the zoom it just normalized for. To make sure you pressed the key that corresponds to your weapon try entering ADS. Throughout the ads animation your FOV should be unchanged. If the FOV changed then you either pressed the wrong keybind or didn't enter the correct FOVOptionsPercentageValue. Once you exit ADS your FOV will reset to it's normal hipfire value.
  • Due to the nature of the zoom sensitivity setting in KF2 you can only have the settings normalized for a single zoom amount at a time. The keybinds are just to quickly change that setting to precise values. So if you want to start having it normalized at a different zoom level then you need to press the corresponding keybind. Annoying I know, but better than unnormalized aim imo. The alternative would be creating an injector of some kind to override the sensitivity equation with its own like the Payday 2 mod.
  • Remember that this match distance is in terms of vertical screen distance. Also that the coefficient is as a decimal. 75% horizontal for 16:9 is the same as 133% vertical. Be sure to enter this as 1.333333 not 133. It's possible I have a mismatched parenthese or something causing higher sensitivity but a quick lookover I don't see anything wrong. FOVOptionsPercentageValue is used in the contructor so I don't need to use it every single time I use an FOV. double f is the value.


#4 WhoCares?

WhoCares?

    Newbie

  • Premium Members
  • Pip
  • 82 posts

Posted 18 April 2017 - 05:14 PM

No matter what I do, the keybinding don't want to work :/ The fov in hip fire dont change regardless what num-key I press :/ (NumPad is enabled of cause )



#5 Skwuruhl

Skwuruhl

    Math Wizard

  • Premium Members
  • Pip
  • 44 posts

Posted 18 April 2017 - 10:19 PM

After running the program you're pasting your clipboard into console right?

 

Post a picture of the bottom of your KFInput.ini like so: http://i.imgur.com/7yv2k9D.png


Edited by Skwuruhl, 18 April 2017 - 10:20 PM.


#6 WhoCares?

WhoCares?

    Newbie

  • Premium Members
  • Pip
  • 82 posts

Posted 19 April 2017 - 05:44 PM

I thought I did but I guess there was nothing in my clipboard. I tested it and run the .bat a second time and there is nothing to copy/past in my clipboard :/

Can you copy out the bindings from your Input.ini and I put them in my Input.ini? :)



#7 Skwuruhl

Skwuruhl

    Math Wizard

  • Premium Members
  • Pip
  • 44 posts

Posted 21 April 2017 - 05:08 AM

I thought I did but I guess there was nothing in my clipboard. I tested it and run the .bat a second time and there is nothing to copy/past in my clipboard :/

Can you copy out the bindings from your Input.ini and I put them in my Input.ini? :)

Are you not getting this winow: http://i.imgur.com/KbNlmQY.png ?

 

Do you have java installed?



#8 WhoCares?

WhoCares?

    Newbie

  • Premium Members
  • Pip
  • 82 posts

Posted 21 April 2017 - 09:37 AM

Do I didn't get that window, and I don't have Java (Obviously you Need it when looking closer to the source Code...stupide me) and I dont want to install it, but I think I have to when I want to continue  :P

 

The ads-sensitivity is still much faster, so it worked only half-way...


Edited by WhoCares?, 21 April 2017 - 09:41 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users