Log In  

PICO-8 apparently supports 8 players but keyconfig() only covers players 1 and 2. How do I set the controls for the other 6 players? The manual does not cover this, so if someone could give me some insight that would be helpful.

P#36690 2017-01-26 00:49 ( Edited 2017-01-27 16:14)

Players 3-8 are only accessible via SDL-configured controllers. They can't be played with the keyboard.

From pico8.txt:


PICO-8 uses the SDL2 controller configuration scheme. It will detect common controllers on startup and also looks for custom mappings in sdl_controllers.txt in the same directory as config.txt. sdl_controllers.txt has one mapping per line.

To generate a custom mapping string for your controller, use either the controllermap program that comes with SDL2, or try http://www.generalarcade.com/gamepadtool/


P#36693 2017-01-26 01:45 ( Edited 2017-01-26 06:45)

... I've been meaning to figure this out for a while now so I thought I'd give it a few minutes, inspired by your question. sdl_controllers.txt is under-documented. I can verify that this procedure does something:

1) Connect a controller.
2) Run the app downloaded from http://www.generalarcade.com/gamepadtool/ (Windows or Mac). It should detect the controller.
3) Click "Copy Mapping String."
4) Edit the file sdl_controllers.txt in the Pico-8 config directory (e.g. ~/Library/Application Support/pico-8/ on a Mac). Paste the mapping string into the file and save it.
5) Close and reopen Pico-8 to pick up the change.

The mapping string looks something like this (newlines added to avoid spoiling the post width):

79000000000000001100000000000000,Retrolink Classic Controller,
x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,
leftx:a3,lefty:a4,platform:Mac OS X,

With one controller config listed, I can get my Retrolink Classic Controller to work with player 1 (btn(n,0)).

I have no idea how to associate this controller with a different player number. The position of the line in the file doesn't seem to matter. I could maybe try to connect a bunch of controllers and see what happens (do they just claim player numbers as they're detected?). Anyone have experience with this?

I can say that the controller mapping appears to do something productive. Without that line, Pico-8's default detection of my Retrolink only understands the x and o buttons. It needs the config line to map the d-pad to the analog directions. (Previous discussion on that: https://www.lexaloffle.com/bbs/?pid=19855, https://www.lexaloffle.com/bbs/?tid=3250)

P#36695 2017-01-26 02:11 ( Edited 2017-01-26 07:17)

And FWIW, here's a hastily written btn() tester:

function _update()
end
function _draw()
 cls()
 for p=0,8 do
   print(''..p..':', 0, p*7, 1)
   for b=0,6 do
     if btn(b,p) then
       print(b, b*5 + 10, p*7, p+1)
     end
   end
 end
end
P#36696 2017-01-26 02:16 ( Edited 2017-01-26 07:17)

dddaaannn: sdl_controllers.txt only defines what sdl should do with your controller 'brand'. you could plug 8 retrolinks and they would all benefit from the same mapping. their order is only defined by the system and can change each time you plug/unplug a controller. more or less it should be the order in which they're plugged in (or polled when your system starts). also sdl2 allows hotplugging but it's not handled in pico, so you have to restart it if you accidentally unplug a controller.

P#36715 2017-01-26 11:55 ( Edited 2017-01-26 16:55)

Thanks for the info @dddaaannn and @ultrabrite !

Someone should add that information to the online documentation -- I was trying to figure it out a few weeks back and never got anywhere.

P#36739 2017-01-26 14:23 ( Edited 2017-01-26 19:23)

Thanks ultrabrite! I added a new article to the wiki based on this information:

http://pico-8.wikia.com/wiki/Controllers

P#36743 2017-01-26 16:23 ( Edited 2017-01-26 21:23)

@dddaaannn: from your article: "Also, there is no way to force the first controller to get assigned to Player 3."
actually, "pico8 -joystick 2" will do exactly that.

P#36759 2017-01-27 03:27 ( Edited 2017-01-27 08:27)

Thanks! Added.

(You are of course invited to contribute directly to the wiki if you like. :) )

P#36776 2017-01-27 11:14 ( Edited 2017-01-27 16:14)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 10:21:29 | 0.014s | Q:22