Thursday 27 October 2011

Battlefield 3 Key Bindings issue fix

So I've been plagued with key binding issues like a large number of you. I refused to play the beta as the idea of using the default bindings it came with was annoying to me. Now, a lot of my keys have been able to bind without problems, but some I've been unable to bind, or in one case, I was able to bind it once, but never again once I cleared it. The joystick Jet/Roll for example I can't swap properly, I can't bind my right mouse as forward for the tank, use my other mouse buttons, and a bunch of other random configuration gaps.

I've taken the time to reverse engineer the BF3 configuration to see if there was a way I could bypass the interface and modify the configuration by hand. The configuration is extremely ugly to look at and modify, but I've been successful in making ALL of the changes I've wanted.

Warning: This isn't exactly easy, but it works.

Your configuration is located in "%USERPROFILE%\Documents\Battlefield 3\settings", named "PROF_SAVE_profile". Before doing ANYTHING, take a copy of the file. If you mess it up, you can delete your modified version and rename the copy back, reverting your changes back.

Now open the original file with any text edit. Yes this is ugly, and I have no idea why Dice organized the configuration this way. The complexity of this is most likely why the binding interface is so broken. I've noticed that configuration lines that SHOULD be in this file didn't exist, and when the key binder attempted to change the key, it probably couldn't find the line it needed to modify (Hint to Dice, this may help you fix these bugs?).

Lets break down what everything means. Lets look at the mouse bindings for zooming in a tank:
GstKeyBinding.vehicle.ConceptZoom.0.axis 24
GstKeyBinding.vehicle.ConceptZoom.0.button 8
GstKeyBinding.vehicle.ConceptZoom.0.negate 0
GstKeyBinding.vehicle.ConceptZoom.0.type 1

  1. GstKeyBinding is the start of each config
  2. .vehicle is the config you're modifying. I.e. vehicles.
  3. ConceptZoom is the bind your modifying. In this case, zoom.
  4. 0 is the binding number. This is sequencial. If you add a new binding to ConceptZoom, then create 4 more lines with an incremented number that does not yet exist (i.e. 1). If you're replacing an existind binding, just use the one that is there.
The rest are the property that you're modifying. Each binding has 4 properties. Axis, button, negate, and type.
  • Axis: This is the input stream. Keyboard and mouse appear to be 24. Were some inputs on other devices, like the joystick map differently (more on that later).
  • Button: This is the button that is being pressed in the input stream. Each input type has a button for unbound. In this case, button 8 is the mouse unbound, which means we have 7 mouse buttons available to us. 255 is unbound for the keyboard, and 60 is unbound for the joystick.
  • Negate: This is the negative to another binding. Yaw uses this. Left would be negate 0, and right would be 1.
  • Type: This is the input device for the bind. Type 0 is keyboard, Type 1 is mouse, and Type 2 is joystick.
The above example shows that the mouse input for vehicle zoom is unbound. If it was set to 1 it would be your right mouse button, and 2 would be your left mouse button. Yes, this means you can use ALL of your mouse buttons.

In this configuration example, I've added this so that I can bound my mouse 5 to select the defibrilator (key 4 on the keyboard):

GstKeyBinding.infantry.ConceptSelectInventoryItem4.0.axis 24
GstKeyBinding.infantry.ConceptSelectInventoryItem4.0.button 5
GstKeyBinding.infantry.ConceptSelectInventoryItem4.0.negate 0
GstKeyBinding.infantry.ConceptSelectInventoryItem4.0.type 1

Joystick Axis: For my joystick, I've noted that Axis 0 is joystick left/right, and Axis 7 is up and down. This is actually an exciting change over Bad Company 2, because this shows that the game accepts raw axis inputs from the joystick, instead of handling the input like a button. Since no button is used, to bind these you'll set the button to 60 (unbound).

Feel free to experiment and make the changes you need to where you havn't been able to. Keep in mind that if you mess something up, you can always revert back. Once you make the changes and save them, you will need to restart the Battlefield 3 client in order to see them in the configuration.