Linux Format

Linux gaming Gamepad control.............

Gaming on Linux has truly come of age and Mayank Sharma shows you how to make the most of gaming sessions by adding a gamepad.

- Mayank Sharma is a technical author and former contributi­ng editor at Linux.com but now spends his time playing Linux games all day in his underpants.

If you want to make the most of your games you’ll need control options – and a gamepad could be just what you need.

The vast majority of games for your PC will have been written with the mouse and keyboard in mind, but sometimes you can’t beat playing a game using a proper gamepad, whether you prefer an old-school joystick or console-like controller­s, and in the case of some games, such as HyperLight­Drifter, they are designed for gamepads.

Ubuntu is rapidly becoming a popular choice for gamers thanks to its official SteamforLi­nux support and its lean demands on system resources—and when it comes to using a gamepad with Ubuntu, the good news is that the vast majority of PC game controller­s should work out of the box while many USB console controller­s (particular­ly Xbox) should also be recognised. Support for these is baked into Ubuntu in the form of the XPAD kernel driver. It offers decent basic support for key functional­ity and installati­on involves nothing more than plugging in your game controller.

Test and configure

Of course, plug and play is all well and good, but how do you verify the controller has been detected and is working correctly? The answer lies with the jtest-gtk tool. Install this via the SoftwareCe­ntre by searching for ‘joystick’ (it’s the first entry in the list). Once done, it should appear as a shortcut on the launcher—double-click it to start.

You should see your game controller’s exact model listed. If a generic controller is listed instead alongside your keyboard, try rebooting Ubuntu with the controller plugged in. When your controller is correctly identified, click ‘Properties’ to test it. A new window will open split into two sections: Axes for tracking joystick movement, and Buttons for – wait for it – registerin­g button presses.

As you move or click buttons, you should see the screen update accordingl­y—if things don’t work quite as you expect, click ‘Calibratio­n’ followed by ‘Start Calibratio­n’ to run through a wizard that should help you get your controller set up correctly. You’ll also see a ‘Mapping’ button on the main screen, which will enable you to change which buttons do what. Some knowledge of how gamepad buttons work is required here to correctly interpret which button does what, but don’t worry—there are more user-friendly and intuitive mapping tools out there.

As things stand, your gamepad should work with any game that supports controller­s. All you need to do is find one—for starters, open the UbuntuSoft­wareCentre and search for ‘SuperTuxKa­rt’. This racing game should work out of the box with your controller. If you’re a Steam user, you need to set up your gamepad prior to playing any games with it. Launch Steam and click the game controller icon to switch to Big Picture mode. Click ‘Settings’ followed by ‘Add/Test under Controller.’ Your controller should be detected, select it and you may be prompted to map your controller using the wizard if it’s not already known to Steam. Do so and if you make a mistake, simply use the mouse to select any previously set control to change it. Once complete, you’ll be invited to upload the controller for others to use – accept this.

Once these steps have been performed, you should find your controller works perfectly with any Steam game—before playing, however, check the game’s Options screen to see if gamepad support has been enabled.

Using AntiMicro profiles

You’ll find that many Linux games don’t directly support controller­s – instead, they assume you’ll be playing with a mouse or the keyboard (or combinatio­n of both). This isn’t a deal-breaker, thanks to the fact you can emulate key presses and mouse movements on your gamepad, allowing you to use it with just about any game.

One of the best ways to do this is AntiMicroP­ortable ( https://sourceforg­e.net/projects/antimicrop­ortable), which as the annotation ( right) reveals makes the emulation process as straightfo­rward as possible. You’ll need to install it through the Terminal with the following commands: sudo add-apt-repository ppa:nilarimoga­rd/webupd8 sudo apt-get update sudo apt-get install antimicro

Once installed, open the Dash and type ‘antimicro’ to locate and launch it. First, you need to click ‘Controller Mapping’ to map the expected buttons and joystick controls to your controller. You’ll see an image of a controller appear, with each button highlighte­d in turn—which is far easier to follow than jtest-gtk’s somewhat cryptic approach. Press the button and work through the list. Again, if you make a mistake, just click on the incorrect entry and press the correct button to fix it.

Once done, AntiMicro stores key and mouse settings in profiles and sets. You could, for example, store multiple game settings in a single profile by allocating each to a separate set or you can set up multiple sets for a single game and be able to quickly change the way your gamepad controls the action within a game, e.g. for different classes in a team game.

You’ll obviously need to know what controls your target game uses before you can attempt to map them to your controller. Typically launching the game alongside AntiMicro and locating the instructio­ns or settings will give you the

informatio­n you need. Otherwise, try the particular game’s web page for a wiki.

Once set up, you can launch the game in question and you’ll see that AntiMicro now translates your controller’s movements into the equivalent key presses and mouse movements (and clicks).

Adding profiles

Going forward, make sure you’re running AntiMicro alongside any game you wish to emulate—pick your profile and/or set, then start the game in question.

If you find the controller is too sensitive (or not sensitive enough) for you there are plenty of ways that you can tweak specific controls, particular­ly when assigning mouse actions to your controller.

Before setting up a profile, take a quick trip to the site at

https://github.com/AntiMicro/antimicro-profiles/tree/

master/applicatio­ns where kindly users have shared their own custom AntiMicro profiles for a wide number of games. These exist in XML format and need to be downloaded in the correct manner in order to work with AntiMicro.

Scroll down the list, and if you see the game you’re currently playing – the brilliant first-person shooter Open Arena, for example – then click it to locate the XML file within. Click the XML link to reveal the code and click ‘Raw’ to view the code directly. Right-click this and choose ‘Save page as’ to save the file to a suitable folder on your hard drive (say an AntiMicro Profiles folder inside Documents, for example).

Once you’ve done this, open AntiMicro and click the ‘Load’ button. Select the XML file and you should see the window update with the correct key and mouse assignment­s for the game in question.

 ??  ??
 ??  ?? AntiMicro makes it easy to remap your controller and get the experience you’re looking for from your games.
AntiMicro makes it easy to remap your controller and get the experience you’re looking for from your games.

Newspapers in English

Newspapers from Australia