Author Topic: Joystick Config 101  (Read 23015 times)

0 Members and 1 Guest are viewing this topic.

Offline CHHš Jazz

  • MWLL Developer
  • Recruit
  • *
  • Posts: 182
  • Karma: 0
  • Sound Designer
Joystick Config 101
« on: December 27, 2009, 09:19:27 AM »
Joystick Config 101 - This will cover assigning very basic flight controls and weapons to a joystick, specifically for Aero and VTOLs - though the same commands apply to mech movement. (many thanks to Spartacus for the quote):

This particular section covers your actionmaps.xml folder located in c:/documents/my games/crysis/profiles/<profile name>/ folder.

Quote
Sections
=============
debug
default
helicopter (Aerospace/VTOL)
landvehicle
multiplayer
player        
seavehicle
singleplayer
vehicle
vtol

Under each section I see various actions, with names that are pretty straightforward: moveleft, moveright, moveforward, moveback, etc. I also see multiple different parameters for those named actions, such as:

OnPress="1"
onPress="1" onRelease="1"
onPress="1" onRelease="1" retriggerable="1"
always="1"
onPress="1" onRelease="1" onHold="1"
onPress="1" consoleCmd="1"
onHold="1"

Under each named action, there are one or more keys. It seems the xi_ set is for the X-box

controller, the maxis_ is for mouse, and there are multiple for the joystick:

<key name="joyaxis_x"/>
<key name="joyaxis_y"/>
<key name="invjoyaxis_y"/>
<key name="joyaxis_z"/>
<key name="joyrot_z"/>
<key name="joybut_1"/>
<key name="joybut_2"/>
<key name="joybut_3"/>
etc

So all of that seems very straightforward. I've gotten the following to work:
   <key name="joyaxis_y"/>        pitch down
   <key name="invjoyaxis_y"/>     pitch up

This is the lever in back of the Evo used to change rate of speed:
   <key name="joyaxis_z"/>        accelerate
   <key name="invjoyaxis_z"/>     reverse  (or vice versa, I can't recall for sure)

This is twisting the JS:
   <key name="joyrot_z"/>         torso twist

When looking at a function you'll see something like this:

  <action name="Fire_Group1" onPress="1">
   <key name="1"/>
  </action>

It's simple - Action name is just that. The action name. It comes with a modifier - in this case, the "onPress" command, which means that it activates the function when you press the button (rocket science!). The key name is the key assignment. The last line indicates the end of the programming for that action.

So for setting up VTOLs and Aero, you want to look primarily at the helicopter and vehicle sections of your actionmaps (ignore VTOL - it does not apply to the mod). First, the helicopter section. This one is easy (my actionmap - note bold sections):

Quote
<actionmap name="helicopter" version="19">
  <action name="v_brake" onPress="1" onRelease="1">
   <key name="x"/>
  </action>
  <action name="v_boost" onPress="1" onRelease="1" retriggerable="1">
   <key name="lshift"/>
   <key name="xi_shoulderl"/>
  </action>
 <action name="v_rotateyaw">
   <key name="joyaxis_x"/>
  </action>
  <action name="v_rotatepitch">
   <key name="maxis_y"/>
   <key name="joyaxis_y"/>
  </action>

  <action name="v_moveup" onPress="1" onRelease="1" retriggerable="1">
   <key name="w"/>
  </action>
  <action name="v_movedown" onPress="1" onRelease="1" retriggerable="1">
   <key name="s"/>
  </action>
  <action name="v_rotatedir">
   <key name="maxis_x"/>
  </action>
  <action name="v_rollleft" onPress="1" onRelease="1" onHold="1">
   <key name="a"/>
  </action>
  <action name="v_rollright" onPress="1" onRelease="1" onHold="1">
   <key name="d"/>
  </action>
  <action name="v_pitchup" onPress="1" onRelease="1">
   <key name="r"/>
  </action>
  <action name="v_pitchdown" onPress="1" onRelease="1">
   <key name="c"/>
  </action>
 </actionmap>

For my helicopter actionmaps, I added yaw controls, and enabled the joystick for pitch controls using the joyaxis_x and joyaxis_y commands:

Quote
 <action name="v_rotateyaw">
   <key name="joyaxis_x"/>
  </action>
Quote
 <action name="v_rotatepitch">
   <key name="maxis_y"/>
   <key name="joyaxis_y"/>
  </action>

Once this is in, you're good to go with flight controls. No changes need be made in options. If your joystick is connected, you can use it's X and Y functions to fly.

Now you'll need to be able to fire weapons.

NOTE: You'll need to know what numbers are programmed into each buttons (The trigger is usually joybut_1, and likewise, all other buttons have number assignments, though each joystick varies). To confirm what they each are, Joystick.exe is located within your Beta folders. That will give you all the info you need.

FOLLOW UP NOTE: Joystick.exe may label your first button as 00. In this case, that button should be considered 1, and not 0 when inserting it into the action map. (IE - my trigger is button 00 on my Saitek Cyborg X, but when I write in the code, it is labeled "joybut_1", and the following buttons would each be moved up a number).

Here's a portion of the group fire section of my actionmaps:

Quote
 <action name="Fire_Group1" onPress="1">
   <key name="1"/>
   <key name="joybut_1"/>
  </action>
  <action name="Fire_Group2" onPress="1">
   <key name="joybut_3"/>
   <key name="mouse2"/>
  </action>
  <action name="Fire_Group3" onPress="1">
   <key name="joybut_5"/>
   <key name="mouse3"/>
  </action>

It's simple. You assign a button using the <key name="joybut_#"/> command to a function. Here's the tricky part. Note that this particular actionmap sample includes the "onPress" command, but not the "onRelease". This means you'll have to find the opposite function with the "onRelease" command (in this case, the "Stop_Fire_Group") and apply the same buttons to the same groups, otherwise you'll constantly fire the triggered weapon group:

Quote
 <action name="Stop_Fire_Group3" onRelease="1">
   <key name="joybut_5"/>
   <key name="mouse3"/>
  </action>
  <action name="Stop_Fire_Group2" onRelease="1">
   <key name="joybut_3"/>
   <key name="mouse2"/>
  </action>
  <action name="Stop_Fire_Group1" onRelease="1">
   <key name="1"/>
   <key name="joybut_1"/>
  </action>

NOTE: Only two keys can be assigned to any one function. Don't apply any more then that or the function will not work.

And that is it. That is all the more complex it gets. A great way to go about learning more would be to take a look at the provided example actionmaps in your mod folder. They're set up to specific joysticks, so they won't necessarily work for everyone, but simple adjustments can be made to create a more appropriate control scheme for each individual.

This is a very basic setup guide and I'm admittedly pretty tired (thus making me prone to incoherent writing), so please feel free to field any questions. Some of us have become quite experienced in trying to figure this out :P

EDIT: In some cases, joystick sensitivity needs to be adjusted in your c:/crysis/mods/mwll/games/config/ folder. Aruin (who coded in joystick functions) describes these values below:

If you have problems that your joytick only acts like keys, maybe the attenuators are wrong for your joystick, not every joystick reports in the same way to the directx input. Try to adjust this file, you will find in for example:
D:\Crysis\Mods\mwll\Game\Config
Open this with an editor, it should look like this:

joystick = 1
x_axis_att = 7.5 <= for x_axis the higher the faster the movement to x.
y_axis_att = 7.5 <= for y_axis the higher the faster the movement to x.
z_axis_att = 10 <= for z_axis the higher the faster the movement to x.
x_rot_att = 1 <= same for rotational axis
y_rot_att = 1
z_rot_att = 1
x_axis_off = 150 <= offset, blind area,  normaly full left is reported with -1000, +1000 for full right, but around zero most joysticks are flickering between -100 and 100
y_axis_off = 150
z_axis_off = 150
x_rot_off = 150
y_rot_off = 150
z_rot_off = 150
slider_1_att = 1
slider_2_att = 1
slider_1_off = 100
slider_2_off = 100

To see what axis is doing what use the joystick.exe program in the mwll directory it shows you the output to the directx input by your joystick or gamepad.


At the Moment i write a configuration program, but this is not as simple because i have to use 3 different writing languages to get it full compatible with different directx and windowsversions. So give me a little time.....
« Last Edit: December 27, 2009, 11:32:21 PM by CHHš Jazz »

Might before Metal - 35th Infantry Division, Star League Defense Force

Offline CHHš Siege

  • Lead Texture Artist
  • MWLL Developer
  • Lance Captain
  • *
  • Posts: 563
  • Karma: 43
  • Inveniemus Viam Aut Faciemus
    • Clan Hell's Horses: Gamma Galaxy Reborn
Re: Joystick Config 101
« Reply #1 on: December 27, 2009, 09:45:15 AM »
^^^ 'Da MAN.



Proud designer of the Mk II E 'Siege Engine' and the 'Perseus'...
Lo-Wang say, "Animated .gif is worth one mega-word."

Offline =Outlaw=

  • MechWarrior
  • **
  • Posts: 256
  • Karma: 0
Re: Joystick Config 101
« Reply #2 on: December 27, 2009, 03:43:20 PM »
which joysticks have worked with the mod so far? My MS sidewinder precision 2 is not working. Wonder if anyone has been able to get one to work, or any of the sidewinders.
..down by the river

Offline =]FC[=Striker

  • Lance Sergeant
  • **
  • Posts: 492
  • Karma: 18
  • The INSTIGATOR™
Re: Joystick Config 101
« Reply #3 on: December 27, 2009, 05:02:18 PM »
which joysticks have worked with the mod so far? My MS sidewinder precision 2 is not working. Wonder if anyone has been able to get one to work, or any of the sidewinders.

I worked on getting my Microsoft ForceFeedback 2 working, but once again, the actionmaps only allow buttons to work and does not make it so the joystick is analog. This means that it only works with Aeros and will be near unplayable for 'Mechs and Tanks. To me it was not worth the time and effort, but if you really want to try it then use the tutorial Jazz posted.

If you have done that then make sure to run the Joystick.exe file inside the MWLL folder to make sure you are able to press buttons and they work. If they are working in Joystick.exe, but not in game, then check to see if you have a Virtual HID device running, which may override your Joystick when in game. Do this in Device Management. There is no need for the Virtual HID device to be running, so just disable it and your Joystick should then take over as the primary input.

Striker
"Cry havoc and let slip the dogs of war." -William Shakespeare



"The tyrant will always find a pretext for his tyranny, and it is useless for the innocent
 to try by reasoning to get justice, when the oppressor intends to be unjust." -Aesop's Fables

Offline kvannvar

  • Bondsman
  • *
  • Posts: 36
  • Karma: 0
Re: Joystick Config 101
« Reply #4 on: December 27, 2009, 07:05:04 PM »
Quote
NOTE: Only two keys can be assigned to any one function. Don't apply any more then that or the function will not work.

So Keyboard buttons and Joystick buttons can be programed as long as only use 2 Key/buttons?

Offline CHHš Jazz

  • MWLL Developer
  • Recruit
  • *
  • Posts: 182
  • Karma: 0
  • Sound Designer
Re: Joystick Config 101
« Reply #5 on: December 27, 2009, 07:14:50 PM »
^Correct.

Outlaw: Post a screen shot of your joystick.exe, and let me know what functions you're trying to get working.

Might before Metal - 35th Infantry Division, Star League Defense Force

Offline =Outlaw=

  • MechWarrior
  • **
  • Posts: 256
  • Karma: 0
Re: Joystick Config 101
« Reply #6 on: December 27, 2009, 09:10:04 PM »
which joysticks have worked with the mod so far? My MS sidewinder precision 2 is not working. Wonder if anyone has been able to get one to work, or any of the sidewinders.

I worked on getting my Microsoft ForceFeedback 2 working, but once again, the actionmaps only allow buttons to work and does not make it so the joystick is analog. This means that it only works with Aeros and will be near unplayable for 'Mechs and Tanks. To me it was not worth the time and effort, but if you really want to try it then use the tutorial Jazz posted.


That answered my question. I'll just have to get used to the mouse and keyboard, but Im getting used to it already.
..down by the river

Offline CHHš Jazz

  • MWLL Developer
  • Recruit
  • *
  • Posts: 182
  • Karma: 0
  • Sound Designer
Re: Joystick Config 101
« Reply #7 on: December 27, 2009, 09:28:22 PM »
the actionmaps only allow buttons to work and does not make it so the joystick is analog. This means that it only works with Aeros and will be near unplayable for 'Mechs and Tanks.

This is inaccurate - the joystick can be applied to directional controls via these functions in the 'vehicle' section:

Quote
 <action name="v_rotateyaw">
   <key name="joyrot_z"/>
  </action>

  <action name="v_rotatepitch">
   <key name="invjoyaxis_y"/>
  </action>

  <action name="Joy_move_x">
   <key name="invjoyaxis_x"/>
  </action>

v_rotateyaw is your torso twist.
v_rotatepitch is your turret elevation
Joy_move_x is your leg direction (this one has to be added in to the standard actionmap)

As you can see, I'm using the X-axis for directional movements, the Y-axis for up/down aiming, and the Z-rotation for torso/turret twists (I'll have to double check this on tanks, but I'm fairly certain it works there as well).

The issue you may run into is your Z-rotation. On my stick, I needed to boost the sensitivity in the mwll/game/config file. You may have to play around with this as well to make the torso twisting effective.

Send me that screen shot and requested functions and I can assist.

EDIT: After testing, the Joy_move_x function is in fact a trigger and does not acknowledge analog controller movements. It can be set up, but your turn rate will be constant in 'mechs and tanks. It also seems to set the default throttle at a slightly elevated rate. I'll toss this by the devs and see if we can't get this fixed.

EDIT 2: Joy_move_x does not work with tanks, only mechs. The other two are functional.
« Last Edit: December 27, 2009, 09:52:16 PM by CHHš Jazz »

Might before Metal - 35th Infantry Division, Star League Defense Force

Offline =]FC[=Striker

  • Lance Sergeant
  • **
  • Posts: 492
  • Karma: 18
  • The INSTIGATOR™
Re: Joystick Config 101
« Reply #8 on: December 27, 2009, 09:41:07 PM »
Alright, Jazz and I have confirmed that the Leg Turn is not analog, which makes aiming while turning legs near impossible. The devs are more aware of the issue now and will see what they can do, but no promises.

Striker
"Cry havoc and let slip the dogs of war." -William Shakespeare



"The tyrant will always find a pretext for his tyranny, and it is useless for the innocent
 to try by reasoning to get justice, when the oppressor intends to be unjust." -Aesop's Fables

Offline Ceekay Boques

  • Bondsman
  • *
  • Posts: 14
  • Karma: 0
Re: Joystick Config 101
« Reply #9 on: December 27, 2009, 10:03:01 PM »
I used to think I was smart at computer stuff, but I've changed all kinds of different things and only my pitch and (slow rotating, have to increase the sensitivity) torso twist works.  I'll have to wait for someone to post a healthy text file, or take some brain pills.  If any of you are Vulcan let me know, mind meld would be perfect.  Or actually, if you could just point me to JUST the <Actionmap Name=> section I can focus on... there are 6 V_rotates and my tiny brain can't compute it.

Offline CHHš Jazz

  • MWLL Developer
  • Recruit
  • *
  • Posts: 182
  • Karma: 0
  • Sound Designer
Re: Joystick Config 101
« Reply #10 on: December 27, 2009, 10:12:33 PM »
Let me know what functions you're trying to apply to the joystick and I'll give ya a hand.

Might before Metal - 35th Infantry Division, Star League Defense Force

Offline Aruin

  • Apprentice Dev
  • Recruit
  • *
  • Posts: 61
  • Karma: 0
  • Shigata ga nai
Re: Joystick Config 101
« Reply #11 on: December 27, 2009, 10:23:41 PM »
If you have problems that your joytick only acts like keys, maybe the attenuators are wrong for your joystick, not every joystick reports in the same way to the directx input. Try to adjust this file, you will find in for example:
My Documents\My Games\Crysis\Profiles\<Name>
Open this with an editor, it should look like this:

joystick = 1
x_axis_att = 7.5 <= for x_axis the higher the faster the movement to x.
y_axis_att = 7.5 <= for y_axis the higher the faster the movement to x.
z_axis_att = 10 <= for z_axis the higher the faster the movement to x.
x_rot_att = 1 <= same for rotational axis
y_rot_att = 1
z_rot_att = 1
x_axis_off = 150 <= offset, blind area,  normaly full left is reported with -1000, +1000 for full right, but around zero most joysticks are flickering between -100 and 100
y_axis_off = 150
z_axis_off = 150
x_rot_off = 150
y_rot_off = 150
z_rot_off = 150
slider_1_att = 1
slider_2_att = 1
slider_1_off = 100
slider_2_off = 100

To see what axis is doing what use the joystick.exe program in the mwll directory it shows you the output to the directx input by your joystick or gamepad.


At the Moment i write a configuration program, but this is not as simple because i have to use 3 different writing languages to get it full compatible with different directx and windowsversions. So give me a little time.....
« Last Edit: March 01, 2010, 08:30:54 AM by Seraph »
Shigata ga nai

Offline CHHš Jazz

  • MWLL Developer
  • Recruit
  • *
  • Posts: 182
  • Karma: 0
  • Sound Designer
Re: Joystick Config 101
« Reply #12 on: December 27, 2009, 10:39:16 PM »
Good to see ya Aruin! You're much better with this stuff then I am. =)

EDIT: I placed Aruin's post into the main post so it could be located more quickly.
« Last Edit: December 27, 2009, 11:33:19 PM by CHHš Jazz »

Might before Metal - 35th Infantry Division, Star League Defense Force

Offline ColdFusion

  • Recruit
  • *
  • Posts: 89
  • Karma: 0
  • Omnes Una Manet Nox
Re: Joystick Config 101
« Reply #13 on: December 27, 2009, 11:07:11 PM »
Can we be a little more specific and create a true Joystick Config 101, as not everyone is going to know where the file is located

It seems that the simplest thing to do is to post what is working for you (eg copy your joystick configuration file) and post it. People can then take your file and edit it to work with our individual joysticks rather than starting each config. from scratch.

First off, Where is the file you are editing?

Just looking around, without going through every folder, I thought at first it was

C:\Crysis\Mods\mwll\Joystick configuration.txt

or is it

C:\Program Files\Electronic Arts\Crytek\Crysis\Mods\mwll\Game\Config ?
(open joystick.cfg with notepad)

Please continue...

Maybe everyone already knows this but I think it is critical esp for noobs

Thanks

PS just a couple elementary point/questions from the viewpoint of a first time user

1. You might think from looking at C:\Program Files\Electronic Arts\Crytek\Crysis\Mods\mwll\example_actionmaps_for_joystick.xml that your joystick is good to go - It is not! (At least it was not for me using a Saitek X52 http://www.saitekusa.com/prod/x52.htm)

2. C:\Program Files\Electronic Arts\Crytek\Crysis\Mods\mwll\Joystick.exe is helpful to see which buttons work with your joystick. I just went through each button one at a time and noted which ones actually were triggered when I pressed them and wrote down the button numbers.

Once you see this works you might think, great my joystick is up and recognized by MWLL, - It is not!
as pointed out by Jazz the buttons now need to be assigned via his quotes

3.  There is no check box selection in the Crysis options menu in game to actually choose a joystick - This is confusing as you would think there would be. Instead you find you CAN select a keyboard function and assign it to a joystick button. If that is all you want to do fine you got it. - This does not mean you have a fully functional joystick. Again, if you want stick and throttle controllers to function you need to assign them via Jazzs quotes.






« Last Edit: December 27, 2009, 11:50:25 PM by ColdFusion »

Offline CHHš Jazz

  • MWLL Developer
  • Recruit
  • *
  • Posts: 182
  • Karma: 0
  • Sound Designer
Re: Joystick Config 101
« Reply #14 on: December 27, 2009, 11:25:13 PM »
Ah. Good point.

The actionmaps file it located in your c:/documents/my games/crysis/profiles folder. That is where you insert the functions (IE joybut_1, joyrot_z, etc)

The config file is located in your c:/crysis/mods/mwll/game/config folder. This is where you adjust sensitivity (Aruin's post has the example).

As far as the configs go, the point of this thread is to understand how to make alterations to meet your own needs. I would certainly be willing to post my actionmaps file if someone requests it, but otherwise, use this as a tool to make your own modifications.

I'll add this to the main post as well.

EDIT: Also, there are two example actionmaps for joystick located in your c:/crysis/mods/mwll/ folder. As mentioned in the main post, please feel free to use these as starting points, but keep in mind that these were based on specific joysticks based on specific preferences. It may not be what you're looking for without adjustment.
« Last Edit: December 27, 2009, 11:37:11 PM by CHHš Jazz »

Might before Metal - 35th Infantry Division, Star League Defense Force