@CMDR Spadino , thx a bunch for the push in the right direction Respect for sharing knowledge and inspiring others, well done!
The provided solution in the OP didn't work for me at first, but thats a personal thing and is not a value judgement of any kind, can't stretch that enough!
The problem I had was 2 fold. One, the auto return function for absolute movement. The functionality is not provided in the base game, I never needed it, so I was just fighting against it. The second (and the most important) one, the liniair written relative mouse movement routine, with hard coded values. I saw what it tried to do, but it didn't come close to the relative mouse movement routine provided by the game. I have tried to combine the default in game mouse control mechanism with a virtual device and that one came close, but still no cigar. It messed with the absolute movement close to center screen movements and since I love rail guns, it was a no go for me. Abstractions need to help you, and when it comes to aiming anything less than provided by the game is a no go for me.
So I started again, and after a week of tweaking, I got this (be gentle, this is my first python script ever):
This script does nothing with the SRV. No sliders, no extra faf. It does contain a feeder for absolute mouse movements with a progressive curve, similar to the one in the OP. The feeder for the relative mouse movement is new, and contains a progressive adjustable curve per axis. So you can tweak the Y and X axis apart from each other (same goes for the sensitivities). Myself, I've yaw on x-axis and pitch on y. I role with Q and E. If you need anything different, have fun After tweaking for a couple of days, the new relative routine performs the same way as the one the game provides, or at least I can't notice any differences with the way my controller was setup before all this.
Now, to anyone new to this, follow everything in the opening post. Yes, you need to install 2 seperate tools in order to get this to work, but after that you end up with a great virtual controller system you can use for any game. I was sceptical at first, but love it after a week! When you run the above script and get an error about a controller not being found, edit controller = vJoy[0]. The index 0 is the position where the virtual device is found in the collection of virtual VJoy controllers known to the operating system. I have no controllers then the default virtual one, so mine is at 0 (the first, its zero based, sry for the confusion). If you have more then 1 virtual controller, you'll know how to fix this.
Only thing that is missing in the OP is a clear description how to bind all this to ED. Here is where some users tend to go wrong, they think it doesn't work and move on. Which is a waste, because it does work, marvelously.
When you have the virtual controller working, you basically have an XBox controller with 2 joystick. Both are controlled by your mouse. So go to the in game controller options and bind the main joystick movements. Now setup the alternate flight controller options (further down the settings) in the same way. Now, I hear you think "Wait? You said 1 controller with 2 joystick driven by one mouse, how can ED distinguish one stick from the other when setting the bindings?", exactly, it can't. So after setting up the bindings, you end up with the main AND alternate controller doing the same thing. You need to exit the game and edit the bindings file and correct that yourself. You have 2 sticks, so 4 axisses. After setting up the bindings in game, you need to correct 2 axises to the ones ED did not see during configuration. This is crucial. If you don't do this, its not going to work well.
PRO TIP:
While you are in the settings file, bind the same key you use to toggle Flight Assist to the toggle function of the Alternative Controller. The in game settings GUI doesn't let you do it, but the game supports it nonetheless.
The provided solution in the OP didn't work for me at first, but thats a personal thing and is not a value judgement of any kind, can't stretch that enough!
The problem I had was 2 fold. One, the auto return function for absolute movement. The functionality is not provided in the base game, I never needed it, so I was just fighting against it. The second (and the most important) one, the liniair written relative mouse movement routine, with hard coded values. I saw what it tried to do, but it didn't come close to the relative mouse movement routine provided by the game. I have tried to combine the default in game mouse control mechanism with a virtual device and that one came close, but still no cigar. It messed with the absolute movement close to center screen movements and since I love rail guns, it was a no go for me. Abstractions need to help you, and when it comes to aiming anything less than provided by the game is a no go for me.
So I started again, and after a week of tweaking, I got this (be gentle, this is my first python script ever):
Python:
from System import Int16
global relative_x_sens, relative_y_sens, relative_x_range, relative_y_range, rel_x_speed, rel_y_speed,rel_x_speed_curve, rel_y_speed_curve, absolute_curve, controller, absolute_sens
#############################################################################################################################
# User adjustable parameters #
#############################################################################################################################
#
controller = vJoy[0] # the reference to the installed vJoy device #
absolute_curve = 3 # exponential factor for the ablsolute axises curve #
absolute_sens = 20 # absolute mouse mode sensitivity #
relative_x_sens = 20 # relative mouse mode x sensitivity #
relative_y_sens = 30 # relative mouse mode y sensitivity #
relative_x_range = 300 # relative mouse range for x auto centering #
relative_y_range = 300 # relative mouse range for y auto centering #
rel_x_speed_curve = 1.5 # exponential factor for tweeking the x auto centering curve #
rel_y_speed_curve = 2.2 # exponential factor for tweeking the y auto centering curve #
#
#############################################################################################################################
if starting:
# Init
system.setThreadTiming(TimingTypes.HighresSystemTimer)
system.threadExecutionInterval = 5 # loop delay
max = Int16.MaxValue*0.5+0.5 # 16384
min = -Int16.MaxValue*0.5-0.5 # -16384
mouse_rx = 0; mouse_ry = 0; mouse_x = 0; mouse_y = 0; mouse_x_curved = 0; mouse_y_curved = 0
# Coordinates for self centering
a = 0; b = 0; c = 0; d = 0
#Mouse axis definition
mouse_x += mouse.deltaX * absolute_sens # absolute mouse, lateral
mouse_y += mouse.deltaY * absolute_sens # vertical
mouse_rx += mouse.deltaX * relative_x_sens # relative mouse, lateral
mouse_ry += mouse.deltaY * relative_y_sens # vertical
# Constraining axises to max values
if (mouse_x > max): mouse_x = max
elif (mouse_x < min): mouse_x = min
if (mouse_y > max): mouse_y = max
elif (mouse_y < min): mouse_y = min
if (mouse_rx > max): mouse_rx = max
elif (mouse_rx < min): mouse_rx = min
if (mouse_ry > max): mouse_ry = max
elif (mouse_ry < min): mouse_ry = min
# Absolute mouse; lightly exponential curved axis
if (mouse_x > 0): mouse_x_curved = math.floor((math.sqrt(mouse_x ** absolute_curve) /2 ) / 64)
if (mouse_x < 0): mouse_x_curved = math.floor(-abs(math.sqrt(abs(mouse_x ** absolute_curve)) / 2 ) / 64)
if (mouse_y > 0): mouse_y_curved = math.floor((math.sqrt(mouse_y ** absolute_curve) /2 ) / 64)
if (mouse_y < 0): mouse_y_curved = math.floor(-abs(math.sqrt(abs(mouse_y ** absolute_curve)) / 2 ) / 64)
# Writing absolute output to controller
controller.x = filters.deadband(mouse_x_curved, 25)
controller.y = filters.deadband(mouse_y_curved, 25)
# Relative mouse; self centering axis routine
a += mouse.deltaX
b += mouse.deltaX
if filters.stopWatch(True,60): c = a + 0
if filters.stopWatch(True,30): d = b + 0
if (c - d == 0):
if mouse_rx < -(relative_x_range): mouse_rx += math.sqrt(abs(mouse_rx)) * rel_x_speed_curve
elif mouse_rx > relative_x_range: mouse_rx -= math.sqrt(abs(mouse_rx)) * rel_x_speed_curve
if mouse_ry < -(relative_y_range): mouse_ry += math.sqrt(abs(mouse_ry)) * rel_y_speed_curve
elif mouse_ry > relative_y_range: mouse_ry -= math.sqrt(abs(mouse_ry)) * rel_y_speed_curve
# Writing relative output to controller
controller.rx = filters.deadband(mouse_rx, relative_x_range)
controller.ry = filters.deadband(mouse_ry, relative_y_range)
##### Diagnostics
diagnostics.watch(controller.rx)
diagnostics.watch(controller.ry)
diagnostics.watch(controller.x)
diagnostics.watch(controller.y)
This script does nothing with the SRV. No sliders, no extra faf. It does contain a feeder for absolute mouse movements with a progressive curve, similar to the one in the OP. The feeder for the relative mouse movement is new, and contains a progressive adjustable curve per axis. So you can tweak the Y and X axis apart from each other (same goes for the sensitivities). Myself, I've yaw on x-axis and pitch on y. I role with Q and E. If you need anything different, have fun After tweaking for a couple of days, the new relative routine performs the same way as the one the game provides, or at least I can't notice any differences with the way my controller was setup before all this.
Now, to anyone new to this, follow everything in the opening post. Yes, you need to install 2 seperate tools in order to get this to work, but after that you end up with a great virtual controller system you can use for any game. I was sceptical at first, but love it after a week! When you run the above script and get an error about a controller not being found, edit controller = vJoy[0]. The index 0 is the position where the virtual device is found in the collection of virtual VJoy controllers known to the operating system. I have no controllers then the default virtual one, so mine is at 0 (the first, its zero based, sry for the confusion). If you have more then 1 virtual controller, you'll know how to fix this.
Only thing that is missing in the OP is a clear description how to bind all this to ED. Here is where some users tend to go wrong, they think it doesn't work and move on. Which is a waste, because it does work, marvelously.
When you have the virtual controller working, you basically have an XBox controller with 2 joystick. Both are controlled by your mouse. So go to the in game controller options and bind the main joystick movements. Now setup the alternate flight controller options (further down the settings) in the same way. Now, I hear you think "Wait? You said 1 controller with 2 joystick driven by one mouse, how can ED distinguish one stick from the other when setting the bindings?", exactly, it can't. So after setting up the bindings, you end up with the main AND alternate controller doing the same thing. You need to exit the game and edit the bindings file and correct that yourself. You have 2 sticks, so 4 axisses. After setting up the bindings in game, you need to correct 2 axises to the ones ED did not see during configuration. This is crucial. If you don't do this, its not going to work well.
PRO TIP:
While you are in the settings file, bind the same key you use to toggle Flight Assist to the toggle function of the Alternative Controller. The in game settings GUI doesn't let you do it, but the game supports it nonetheless.
Last edited: