Have USB controllers added to extensions

id: 280263

category: Suggestions

posts: 2877

SArpnt SArpnt loading
Scratch has a lot of extensions for things like lego, makey makey, generally some strange input types that aren't usable for a lot of projects.
adding support for controllers would help lots of projects, especially ones that work well with analog input, like driving games,

when button [a v] pressed :: extension hat // buttons include ABXY, dpad, L, R, L1, R1, L2, R2, L stick, R stick (analog sticks can be clicked down on some controllers)
// this could also have blocks dropped in as an input, just like you can for key pressed blocks.
// when dropping in blocks, it could take the button number ids, meaning that even unsupported controllers could work (to an extent)

when [L2 v] distance [= v] (100) % :: extension hat // input options are triggers and all stick movement (shown on next blocks)
// this block could also have blocks dropped in and take axis ids, just like the button blocks.

[normal v] rumble for (1) secs until done :: extension stack // different rumble strengths

[normal v] rumble for (1) secs :: extension stack // doesn't pause script to rumble

[normal v] rumble :: extension stack // just keeps rumbling until stopped

stop rumble :: extension stack

<button [a v] pressed? :: extension> // (can drop in blocks, like above)

([left v] stick x :: extension)

([left v] stick y :: extension)

([left v] stick direction :: extension)

([left v] stick distance :: extension) // how far the stick is from the center

([L2 v] distance :: extension) // how far the trigger is pushed down (can drop in blocks, like above)
triggers are LT, RT, L2, R2, or ZL, ZR. note that switch controllers (if they get support) just have triggers (ZL and ZR) be at either 0% or 100% since they aren't analog.
if possible, it would change these depending on the controller currently connected, but if it can't, it could just use positions for ABXY (like the switch does for single joycons), and just use L1/L2 (there's only 2 of them, anyone can figure out which is which easily just by trying it)

another thing that could be done is adding support for multiple controllers, for thigns like multiple players. with would modify the blocks to add player numbers from 1-4 (this would be the same as the player indicator on the controller) and add these blocks.
when player [1 v] connected :: extension hat

when player [1 v] disconnected :: extension hat

<player [1 v] connected? :: extension>
multiple controllers should probably be a togglable option (if added) because it does make things much more complicated.

FAQ:
Q: why not use joytokey or other controller remapping programs?
A: these programs don't run on all devices, you often have to pay for them, and it doesn't support proper analog movement.

Q: what about wii remotes?
A: Most operating systems don't support wii remotes without extra software, and this could get a lot of people confused. pointing the wii remote also wouldn't work because you would need the wii sensor bar, which many people won't realize and create MANY help threads to try and get it to work. motion control and point sensing would be VERY hard for the scratch team to implement, and would only work for wii remotes. there will also likely be lots of suggestions about nunchuk support, classic controller, motion+, and every single other thing that can be connected to a wii remote, which each part being used extremely little. these controls also don't translate to mouse/keyboard well, which will likely result in tons of projects that only work with a woo remote, and leave people unable to play them. it also doesn't make sense what the blocks would be for this, they would either not be useful or be far too complicated for most people to use.
TLDR: too much work, doesn't make sense, too confusing for users, suggestions spam, and unplayable projects.

Q: what about bluetooth/wireless controllers?
A: yes, this is handled by the operating system AND the browser already, it will never matter how you connect your controller, and it likely can't even be detected.

Q: what about blocks to check what kind of controllers people are using?
A: no, this will generally only cause problems. it shouldn't matter what controller people are using. you can already represent most inputs by their positions like the switch does. if this were added, people would likely run into issues using rare controllers. it also isn't clear how scratch would detect the type of controller, the only information it can use is a name which varies wildly even for similar controllers.

Q: what about this controller?
A: if it looks like a regular controller (xbox, playstation, switch, gamecube), and you can easily connect it to your computer (so not the wii classic controller), then yes. if not, then it probably wouldn't be supported. keep in mind that “not supported” here doesn't neccicarily mean the controller won't connect, it may just behave oddly. you could still use these controllers with the button and distance blocks, you would just have to figure out how to get it to work manually.
for example, layouts like the n64 controller just are different buttons, and no second joystick. you would likely have issues using the dropdowns for buttons, but you could just input numbers yourself, including to get all the C buttons.
you can test out your controller on HTML5 gamepad tester, it shows you how all the inputs on your controller work.
Bla-Games Bla-Games loading
Support
It would be really cool
-Osiris- -Osiris- loading
Support, I don't know if what you say about more Scratchers having USB controllers is true, but I think this would be a cool idea for those who do have USB controllers. My one question, and pardon me if it is a dumb one is: are USB controllers compatible with Scratch? I mean, Picoboards and LegoWeDo were designed to be compatible with Scratch, right?

-Osiris- wrote:

are USB controllers compatible with Scratch?
I wonder what this thread is about.
-Osiris- -Osiris- loading

LiberlandAnimations wrote:

-Osiris- wrote:

are USB controllers compatible with Scratch?
I wonder what this thread is about.
I mean, are the controllers capable of being compatible with Scratch?

-Osiris- wrote:

LiberlandAnimations wrote:

-Osiris- wrote:

are USB controllers compatible with Scratch?
I wonder what this thread is about.
I mean, are the controllers capable of being compatible with Scratch?
Oh! In that case, seeing how many other people did it before (as in, with other games and such that were indie) I think it's totally possible.
SArpnt SArpnt loading

-Osiris- wrote:

are USB controllers compatible with Scratch?
For the online version: search up “HTML5 Gamepad Tester” on google. if one website can detect it, any website could. the only problem here would be that scratch uses flash, and i'm not sure if flash can detect controllers, but there could possibly be a workaround if flash can interact with the rest of the webpage, where then i believe HTML could pick up the controller signals, then flash would use the data from that.

For the offline version: Absolutely could work, no doubt.
Cub56 Cub56 loading
Why do you need a controller?
Hex4Nova Hex4Nova loading

Cub56 wrote:

Why do you need a controller?
Because it's cool
lightedblox lightedblox loading

SArpnt wrote:

the only problem here would be that scratch uses flash, and i'm not sure if flash can detect controllers, but there could possibly be a workaround if flash can interact with the rest of the webpage, where then i believe HTML could pick up the controller signals, then flash would use the data from that.

also remember that scratch 3 will not be flash-based, it will be html based.

support
SArpnt SArpnt loading
Support. This would get the “Extensions” blocks used more frequently because not a lot of people on Scratch use Lego WeDO or other stuff.
Exactly. The whole idea behind those other extensions was a promo by LEGO. The only other use for it is if you want to use fan-made extensions in ScratchX. Making controller support (with custom mapping probably) would be really amazing, since with multiplayer games, it is hard to map all of the controls to just the keyboard (you can see with my project Dragon Lord - it's only ever easy to play it multiplayer if you have small hands). I'd love to see this in Scratch 3.0 since you can definitely do it with HTML5, and that's what Scratch 3.0 is being made in.
Cub56 Cub56 loading
I guess this could be nice, but the need of a controller is partially caused by Scratch not supporting all keybinds (like I have to use space to aim down sights in my FPS game instead of right click).

What about people without a controller?
WolfCat67 WolfCat67 loading
Support. USB controllers would be a great inclusion for Scratch, and having them as an extension will definitely not confuse new users viewing the site for the first time (as it will be hidden). However, I don't agree with some of the wording here, specifically the use of “trigger”. Remember that only Xbox controllers refer to the top buttons as triggers, whereas on PlayStation it is L2 / R2 and with Nintendo it's ZL / ZR. Instead, have it simply replaced with L, R, L2, R2. This is possibly the most simple to understand with most people when looking at a controller. When a controller is plugged in, perhaps the name could change based on what controller it is.
epicRedHot epicRedHot loading

WolfCat67 wrote:

Support. USB controllers would be a great inclusion for Scratch, and having them as an extension will definitely not confuse new users viewing the site for the first time (as it will be hidden). However, I don't agree with some of the wording here, specifically the use of “trigger”. Remember that only Xbox controllers refer to the top buttons as triggers, whereas on PlayStation it is L2 / R2 and with Nintendo it's ZL / ZR. Instead, have it simply replaced with L, R, L2, R2. This is possibly the most simple to understand with most people when looking at a controller. When a controller is plugged in, perhaps the name could change based on what controller it is.
This seems like the best choice.
(Ironic, how the system with the most confusing face buttons to outsiders also has the simplest name for the shoulder buttons.)
SArpnt SArpnt loading

Cub56 wrote:

What about people without a controller?
Controller is definetly not a replacement for keyboard, and never will be. any game that supports it will still have an option for keyboard. If a game leaves out the keyboard option, it's not the fault of the extension, it's the fault of the creator.
SArpnt SArpnt loading

WolfCat67 wrote:

Support. USB controllers would be a great inclusion for Scratch, and having them as an extension will definitely not confuse new users viewing the site for the first time (as it will be hidden). However, I don't agree with some of the wording here, specifically the use of “trigger”. Remember that only Xbox controllers refer to the top buttons as triggers, whereas on PlayStation it is L2 / R2 and with Nintendo it's ZL / ZR. Instead, have it simply replaced with L, R, L2, R2. This is possibly the most simple to understand with most people when looking at a controller. When a controller is plugged in, perhaps the name could change based on what controller it is.

Noted that different controllers will have different extensions, and changed blocks to be less confusing.
SArpnt SArpnt loading
(insert bump here)
EmperorWolf EmperorWolf loading
I totally support this. I personally don't have a controller, but this sounds like a good idea. FULL SUPPORT!
I have an Xbox One, and I regularly use the controllers to play computer games on my mac with a driver. I think that controllers could work if the extension thinks that the Right stick is the arrow keys, and the Left stick is wasd. For PS4 It's even easier because it uses Bluetooth. no driver needed.
I would be happy if someone wanted to work with me on this.
You mean supporting the extra buttons on games console controllers? That seems like a cool idea, but keep in mind that people with controllers can simply map the buttons to keyboard keys.
Support, it would give my universal controller a use.
Support,it would introduce a new way of playing games.
SArpnt SArpnt loading

venyanwarrior wrote:

I have an Xbox One, and I regularly use the controllers to play computer games on my mac with a driver. I think that controllers could work if the extension thinks that the Right stick is the arrow keys, and the Left stick is wasd. For PS4 It's even easier because it uses Bluetooth. no driver needed.
I would be happy if someone wanted to work with me on this.

a small problem with these is that i want analog support too. the only analog input on scratch is the mouse, which allows for 2 axis of movement. an xbox controller has 10 axis of movement. also, i would prefer if the buttons on a controller and keyboard were separate. finally, i don't believe most people on scratch would be able to properly set up joy2key.
Meowlit12 Meowlit12 loading

SArpnt wrote:

venyanwarrior wrote:

-snip-
a small problem with these is that i want analog support too. the only analog input on scratch is the mouse, which allows for 2 axis of movement. an xbox controller has 10 axis of movement. also, i would prefer if the buttons on a controller and keyboard were separate. finally, i don't believe most people on scratch would be able to properly set up joy2key.
Also, JoytoKey requires a license after a trial period.
What about Bluetooth controllers? The Nintendo Switch Joy-cons are Bluetooth and can be used with emulators, phones, computers, etc.
SArpnt SArpnt loading

LordOfMuffins wrote:

What about Bluetooth controllers? The Nintendo Switch Joy-cons are Bluetooth and can be used with emulators, phones, computers, etc.
this would depend if scratch would be able to detect it. iif someone can show that it would be possible in html (the programming language for scratch 3) then i'll update the post.
SArpnt SArpnt loading
bummmmmmmmmmmmmmmmmmnmnmnnnmnmnmnmmmnmnmnmnmnnmnmnmnmp
BunnyMan64 BunnyMan64 loading
It is interesting though I not sure if Scratch will add it. Semi-support. As much as I love using a controller, I not sure if all will work well on it but it depends on how well Scratch Team added that feature otherwise I think it is for ScratchX.
There should be universal extension for controllers:

when button [1 v] on controller [1 v] pressed :: extension hat
<button (1 v) on controller (1 v) pressed? :: extension>
(axis (1 v) on controller (1 v) :: extension)
Luvexina Luvexina loading
Support! This will be much easier to add in Scratch 3.0 because it uses HTML5 and JavaScript.
openPoll openPoll loading
Whilst I support, because of all the reasons above, it probably won't be added since the Scratch Team would have to get licenses from the companies owning the patents for the controllers to use them in Scratch. And knowing how money-hungry the companies (Sony, Microsoft, Nintendo) producing the most wanted controllers (Xbox 360 and One controllers, DUALSHOCK™ 4 controllers, Joy-Con™ and Nintendo Switch Pro Controller), they would not give permission because people could emulate their games on Scratch for FREE.

It is a shame.

Monniasza_spzoo wrote:

There should be universal extension for controllers:

when button [1 v] on controller [1 v] pressed :: extension hat
<button (1 v) on controller (1 v) pressed? :: extension>
(axis (1 v) on controller (1 v) :: extension)
oops
openPoll openPoll loading

AFNNetworkK12 wrote:

Monniasza_spzoo wrote:

There should be universal extension for controllers:

when button [1 v] on controller [1 v] pressed :: extension hat
<button (1 v) on controller (1 v) pressed? :: extension>
(axis (1 v) on controller (1 v) :: extension)
Please don't necropost.
Please note that necroposting does not exist on Suggestions of it is the first topic to make that suggestion.

openPoll wrote:

AFNNetworkK12 wrote:

Monniasza_spzoo wrote:

There should be universal extension for controllers:

when button [1 v] on controller [1 v] pressed :: extension hat
<button (1 v) on controller (1 v) pressed? :: extension>
(axis (1 v) on controller (1 v) :: extension)
Please don't necropost.
Please note that necroposting does not exist on Suggestions of it is the first topic to make that suggestion.
kk.
AirWay1 AirWay1 loading
Controllers are very good for games, as they have multiple buttons, and are easy to grasp.

Please add!
Truck11111 Truck11111 loading
Support.

openPoll wrote:

Whilst I support, because of all the reasons above, it probably won't be added since the Scratch Team would have to get licenses from the companies owning the patents for the controllers to use them in Scratch. And knowing how money-hungry the companies (Sony, Microsoft, Nintendo) producing the most wanted controllers (Xbox 360 and One controllers, DUALSHOCK™ 4 controllers, Joy-Con™ and Nintendo Switch Pro Controller), they would not give permission because people could emulate their games on Scratch for FREE.

It is a shame.
What if Scratch made their own controllers?
openPoll openPoll loading

Truck11111 wrote:

Support.

openPoll wrote:

Whilst I support, because of all the reasons above, it probably won't be added since the Scratch Team would have to get licenses from the companies owning the patents for the controllers to use them in Scratch. And knowing how money-hungry the companies (Sony, Microsoft, Nintendo) producing the most wanted controllers (Xbox 360 and One controllers, DUALSHOCK™ 4 controllers, Joy-Con™ and Nintendo Switch Pro Controller), they would not give permission because people could emulate their games on Scratch for FREE.

It is a shame.
What if Scratch made their own controllers?
I… Was just thinking about that. They work at MIT, so they already have a team to do that there
But how would they mass produce them?
epicRedHot epicRedHot loading

Truck11111 wrote:

Support.

openPoll wrote:

Whilst I support, because of all the reasons above, it probably won't be added since the Scratch Team would have to get licenses from the companies owning the patents for the controllers to use them in Scratch. And knowing how money-hungry the companies (Sony, Microsoft, Nintendo) producing the most wanted controllers (Xbox 360 and One controllers, DUALSHOCK™ 4 controllers, Joy-Con™ and Nintendo Switch Pro Controller), they would not give permission because people could emulate their games on Scratch for FREE.

It is a shame.
What if Scratch made their own controllers?
While I'm not to sure of the legality of Scratch “ports” (note that I'm using the term very loosely here, as making near 1:1 recreations of even the simplest NES games requires far more knowledge than the majority of Scratch users have), there should be no reason to require specific “Scratch Controllers” for this extension to be added, as over 99% of the industry's main controllers use the same input types, being XInput and DInput.
Support. I think if they made a scratch controller it would be very cool, and open up new ways to make/play games
https://scratch.mit.edu/discuss/post/3520875/

Extension is universal and doesn't promote or use any specific brand of controller.
Maybe you could have something like:
assign [Controller 1 v] to player [1 v]
So you can set players easily.

Truck11111 wrote:

Support.

openPoll wrote:

Whilst I support, because of all the reasons above, it probably won't be added since the Scratch Team would have to get licenses from the companies owning the patents for the controllers to use them in Scratch. And knowing how money-hungry the companies (Sony, Microsoft, Nintendo) producing the most wanted controllers (Xbox 360 and One controllers, DUALSHOCK™ 4 controllers, Joy-Con™ and Nintendo Switch Pro Controller), they would not give permission because people could emulate their games on Scratch for FREE.

It is a shame.
What if Scratch made their own controllers?

Scratch is too slow for 4K HDR graphics, currently present in modern console games.
How about Bluetooth? like WiiMotes?
It's possible that they could just create some way of detecting all controllers, not any specific ones, like how JoyToKey does it. JoyToKey works with a lot of controllers because they support similar button functions.
epicRedHot epicRedHot loading

LiberlandAnimations wrote:

It's possible that they could just create some way of detecting all controllers, not any specific ones, like how JoyToKey does it. JoyToKey works with a lot of controllers because they support similar button functions.
Specifically, modern controllers from at least the Gamecube/Xbox/PS2 era onwards use either XInput or DInput to transmit data to the computer/console, since they're a standardized way of broadcasting controller inputs.
mobluse mobluse loading
Support!

I don't think patents will be a problem when making an extension for USB joysticks/gamepads since they work in Linux which is a free operating system.

There is a system, THEC64 MINI, that supports rather many joysticks/gamepads and that uses some strings to assign functions to the buttons of the joystick/gamepad. This is documented here:
https://retrogames.biz/support/file-loader/

A similar system could be used for a game controller extension.
Support, my controller would be much more useful.
c_l_0 c_l_0 loading
What do you mean by “USB controllers”?