Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Optimal XBox 360 controller setup

General discussion for players of Oolite.

Moderators: winston, another_commander

Post Reply
mcarans
---- E L I T E ----
---- E L I T E ----
Posts: 320
Joined: Sun Jun 20, 2010 6:00 pm

Optimal XBox 360 controller setup

Post by mcarans »

[UPDATE: Please see http://wiki.alioth.net/index.php/XBox360_Controller for Linux XBox360 Controller setup]

I've plugged away at this and come up with the following set up using the Xboxdrv http://pingus.seul.org/~grumbel/xboxdrv/xboxdrv.html.

My launcher for Oolite that sets up Xboxdrv with my button and axis mappings is:

#!/bin/sh

# Start xboxdrv and remember its PID in the variable XBOXPID
xboxdrv -s --trigger-as-button --dpad-as-button -l 0 --axis-sensitivity X1=-0.5,X2=-0.5,Y2=-0.5 --axismap -Y2=Y2 --ui-axismap Y1=XK_1:XK_2 --ui-buttonmap \
du=XK_Up,dd=XK_Down,\
dl=XK_Left,dr=XK_Right,\
lt=XK_w,\
rt=XK_z,\
lb=XK_r,\
rb=XK_i,\
X=XK_Return,\
A=XK_t,\
B=XK_e,\
Y=XK_u,\
start=XK_d,\
guide=XK_j,\
back=XK_p,\
lb+du=XK_3,\
lb+dd=XK_8,\
lb+dl=XK_6,\
lb+dr=XK_7,\
lb+back=XK_5,\
lb+start=XK_c,\
lb+X=XK_h,\
lb+A=XK_backslash,\
lb+B=XK_m &
#du=XK_Up,dd=XK_Down : speed
#dl=XK_Left,dr=XK_Right : previous, next target
#lt=XK_w : fire lasers
#rt=XK_z : scanner zoom
#lb=XK_r : identify object
#rb=XK_i : inject speed
#X=XK_Return : launch missile
#A=XK_t : target missile
#B=XK_e : ecm
#Y=XK_u : untarget missile
#start=XK_d : fast dock
#guide=XK_j : jumpdrive
#back=XK_p : pause
#lb+du=XK_3 : buy equipment/ships
#lb+dd=XK_8 : market prices
#lb+dl=XK_6 : local/galactic chart
#lb+dr=XK_7 : planet info
#lb+back=XK_5 : current status/manifest
#lb+start=XK_c : slow dock with target
#lb+X=XK_h : hyperspace
#lb+A=XK_backslash : advanced compass
#lb+B=XK_m : comms log
XBOXPID=$!

# Give xboxdrv a second to startup and create the device
sleep 1

# Launch your favorite game
/usr/bin/oolite

# Kill xboxdrv and wait for it to finish
kill $XBOXPID
wait $XBOXPID

# EOF #


This required changing some key configs:


{
key_roll_left = "a";
key_roll_right = "s";
key_pitch_forward = "[";
key_pitch_back = "'";
key_yaw_left = ",";
key_yaw_right = ".";

key_increase_speed = 255; // up arrow
key_decrease_speed = 254; // down arrow
key_inject_fuel = "i";

key_fire_lasers = "w";
key_launch_missile = 13;
key_next_missile = "y";
key_ecm = "e";

key_target_incoming_missile = "T";
key_target_missile = "t";
key_untarget_missile = "u";
key_ident_system = "r";

key_scanner_zoom = "z";
key_scanner_unzoom = "Z";

key_launch_escapepod = 27; // escape
key_energy_bomb = "\t"; // tab

key_galactic_hyperspace = "g";
key_hyperspace = "h";
key_jumpdrive = "j";

key_dump_cargo = "D";
key_rotate_cargo = "R";

key_autopilot = "C";
key_autopilot_target = "c";
key_autodock = "d";
key_docking_clearance_request = "L";

key_snapshot = "*";
key_docking_music = "s";

key_advanced_nav_array = "^";
key_map_home = 302; // Home
key_map_info = "i";

key_pausebutton = "p";
key_show_fps = "F";
key_mouse_control = "M";

key_comms_log = "m";
key_next_compass_mode = "\\";

key_cloaking_device = "0";

key_contract_info = "?";

key_next_target = 252; // right arrow
key_previous_target = 253; // left arrow

key_custom_view = "v";

key_dump_target_state = "H";
}


Virtually everything can be controlled from the gamepad. For menus, the dpad is mapped to arrow keys and X is Enter. The left shoulder button is treated as a shift key.

Forward on the left analog stick gives forward view and back gives aft view - ie. the stick fwd/back is mapped to buttons, but left/right is not mapped and should be mapped in the game to roll. The other analog stick is for pitch/yaw.
Last edited by mcarans on Fri Aug 06, 2010 9:09 am, edited 1 time in total.
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8512
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

Nice work! 8)
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
mcarans
---- E L I T E ----
---- E L I T E ----
Posts: 320
Joined: Sun Jun 20, 2010 6:00 pm

Post by mcarans »

[UPDATE: Please see http://wiki.alioth.net/index.php/XBox360_Controller for Linux XBox360 Controller setup]

I have slightly improved the setup and embedded the comments for ease of readability based on help from the XBoxDrv author. The key config in my first post is still needed. Here is my new launcher for Oolite:


#!/bin/sh

# Start xboxdrv and remember its PID in the variable XBOXPID
xboxdrv -s --trigger-as-button --dpad-as-button -l 0 --axis-sensitivity X1=-0.5,X2=-0.5,Y2=-0.5 --axismap -Y2=Y2 --ui-axismap Y1=XK_1:XK_2 --ui-buttonmap \
du=XK_Up,dd=XK_Down,`# speed`\
dl=XK_Left,dr=XK_Right,`# previous, next target`\
lt=XK_w,`# fire lasers`\
rt=XK_r,`# identify object`\
lb=XK_y,`# next missile`\
rb=XK_i,`# inject speed`\
X=XK_Return,`# launch missile`\
A=XK_t,`# target missile`\
B=XK_e,`# ecm`\
Y=XK_u,`# untarget missile`\
start=XK_z,`# scanner zoom`\
guide=XK_j,`# jumpdrive`\
back=XK_p,`# pause`\
lb+du=XK_3,`# buy equipment/ships`\
lb+dd=XK_8,`# market prices`\
lb+dl=XK_6,`# local/galactic chart`\
lb+dr=XK_7,`# planet info`\
lb+back=XK_5,`# current status/manifest`\
lb+guide=XK_h,`# hyperspace`\
lb+start=XK_c,`# slow dock with target`\
lb+X=XK_d,`# fast dock`\
lb+A=XK_backslash,`# advanced compass`\
lb+B=XK_m `# comms log` &
XBOXPID=$!

# Give xboxdrv a second to startup and create the device
sleep 1

# Launch your favorite game
/usr/bin/oolite

# Kill xboxdrv and wait for it to finish
kill $XBOXPID
wait $XBOXPID

# EOF #
mcarans
---- E L I T E ----
---- E L I T E ----
Posts: 320
Joined: Sun Jun 20, 2010 6:00 pm

Post by mcarans »

Please see http://wiki.alioth.net/index.php/XBox360_Controller for Linux XBox360 Controller setup

I have made it a link off the FAQ.
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

..

Post by Lestradae »

Shouldn't this be in the "Porting to other platforms" section, too?

Just suggesting.
mcarans
---- E L I T E ----
---- E L I T E ----
Posts: 320
Joined: Sun Jun 20, 2010 6:00 pm

Re: ..

Post by mcarans »

Lestradae wrote:
Shouldn't this be in the "Porting to other platforms" section, too?

Just suggesting.
I'm happy to add it there, but couldn't find where you mean. Can you post a link? [EDIT: Do you mean "Porting to other platforms" in the forums or some place on the wiki?]
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: ..

Post by Eric Walch »

mcarans wrote:
Lestradae wrote:
Shouldn't this be in the "Porting to other platforms" section, too?

Just suggesting.
I'm happy to add it there, but couldn't find where you mean. Can you post a link? [EDIT: Do you mean "Porting to other platforms" in the forums or some place on the wiki?]
Its here at this BB.
mcarans
---- E L I T E ----
---- E L I T E ----
Posts: 320
Joined: Sun Jun 20, 2010 6:00 pm

Post by mcarans »

I had a post in the Oolite-Linux forum which is probably a more appropriate place than Porting to other platforms as the setup I described is for Linux. It is here:
https://bb.oolite.space/viewtopic.php?t=8199
Post Reply