 His! Thank you so much for coming. This is about weird 앞down controllers and why I've made them and how I've made them. Like you said, I hate gamespads with a passion. It's a tiny little movement that takes to press a button or move the thing, it's not how I like to interact with the world. I wave my hands etc. And I don't think I'm alone in this You watch people play computer games and see them with the gamepad' They try to move and control the thing with more than a tiny button press it's just wrang to me 有? Now I have changed slide So there was a time to five years people play games, young people play games, old people play games, they swung their arms around and it was just great fun, it was all sorts of games you could play, bowling, tennis, you know them all it was a great way of playing games and then it just stopped, the we gradually became older and older, there was never really a successor, Mae'r VR-niwch yn dda'i gweld, boi'n gwellach, ond mae'n 40, a VR yn gwael gwahanol i'r gaming ym gyfan ar y mynd i gwael gwahanol. Fe'n ddweud yng Nghymru. Fi'n gwybod, mae'n arnyn nhw'n ddiddordeb. Mae'n ddiddordeb yn lŵr i'r ffordd. Rwy'n gweithio i'r gweithio. Mae'n gweithio i'r gweithio i'r gweithio i'r hwn yn ôl i'r hwn yn ddillogion i'r TV, a rwy'n gweithio i'r rhan o'r hwn yn ddillogion. Ac mae'n gwirio, mae'n fathodol yma i'w ddon, i mi wedi gweinio i fynd i gwaitio ni, i chi ddawodd ac i yn gweithio I-dys i'w ddweud. Ac mae'n gweithio'n ddal iawn i ddemiadio'r tyfn o'n syniad yn ymddangos iawn i'r cyfrifio. Mae'n ddweud yn y cyfrifio ac mae ddweud yn y ddweud, mae'n ddweud yn ddweud, mae'n ddweud yn y wneud. Mae'n ddweud yn ddweud. Mae'n ddweud yn mynd i'w ddweud â'i dewil am arwine i'r dydd. Bring it up, it's fine, but what I really want more people to understand and take away from this, is that you can make game controllers that you enjoy, and they'll be different from the ones I enjoy, they'll be different from the ones someone else enjoys. And hopefully over time we'll find ones that each other like, and just have great games to play and great controllers to play them with. So at a sort of fundamental level a games controller is an interface device. On one side you've got a computer, on the other side ac mae'n goref yw gyda'r ddeud o'ch gwaith yn ôl. Yn dddwn i sydd yn sgwrs, wrth gwrs nhw, mae'n yn gwkefyd i ddim yn y dd αrwynt, ond ond ond fyddai'n meddilyg. Mae'n ddwy'n ddwy'n ziwb— ond mae yna mynd i bod yn effaith'i bod ei workiwys i'r ddweud. Rhywun iawn o wahanol yn cyfaf o'r ddion aír o'r computerau, rhan chef o fyddfa yw bwyllwch, daf yn gweithio i ddwingo a'r pubwys i ddwy, .. that 50 years of computer evolution has given us all these technologies that we can incorporate now in games in various ways. Different sensors, different actuators, different things to bash and wave and things. So yes, now I want to show you a few of the game controllers that I've made over the years. So this is one for... it's a game called Boing which is just a complete rip off of Pong. Should disclose at this point I work for Add Group Hi in the publishing department. This is from a game called Code the Classics which... I just had a bit of fun with some of the games there. The source code was there, it was easy to hack at. It's just good fun. So, you can probably see this is an ultrasonic sensor. They're widely available. There's hundreds of libraries and modules for use in all sorts of languages. Can tell the distance, you can move it up and down, hand up and down, and get the feedback from that. And I had it, you know, put this together, I had a Python script that could read there where my hand was. I had the games written in Python and thought this would be easy. I'd just find a way of sending a keystroke from one Python script to another Python script and job done. Turns out it's actually really hard to send keystrokes from one program to another. Mae'r bod yn sgabethau rhoi'n gyfan, ond byddai'n fasgwladau a bwysigadau ar y cywregolhau, ond nid i'n rhaid i gefnodd cywir sydd'n nhw fyddwch ei dynnu gyda'r cywir gyntafol o'i pryd. A'n maen nhw'n blaen o'r groes bwysig o'r sgwr iddangos sy'n bellach drwy ei ddelectwys, ac yn ymddangos â'r boblogfyrdd ychydig sy'n ei wneud i'r dynnu'r dsinysreal. Mae yw'r amser yn ymddangos. But it worked, it was fun to play, so one of the... It was kind of janky but it was fun and that was my first controller. So this is another game from the Code of Classics, it's called Infinite Banner. This is where I realise how you control games, you don't plug hardware into the same computer that's playing the games is any get into this sort of horrible mess of trying to get things to talk to each other and hacking source code, and it's ugly is anything. All you do is plug it into a micro-controller that can speak USB. Most modern micro-controllers these days can emulate a keyboard and emulate a mouse or gamepad. So when you plug it into a computer it thinks it's just talking to a keyboard that can send key strikes. So I say emulate, so I don't think there's It's clearly a good word for it, it's not a keyboard, it's clearly not a keyboard, it's a book I'm waving around, but it behaves as though it is a keyboard as far as a computer's concerned. It doesn't know it's a book that's being waved around. So when I started this one off… So yeah, The games for the infinitewater which is... frogger! Looking around I think a lot of people here of the generation know what frogger is, but if you don't, find an old person and ask them! Actually I wanted to do this- So I wanted to say you physically jumped, and the micro-control player has got an accelerometer in it, so it can detect jumps. I never got that to work, because the jumps are fluid movement, it doesn't have a stop and a start point, it doesn't have a point at which you should trigger the jump to happen. Is it when your feet leave the floor, is it when you initiate it, just whatever he did it felt wrong. Overrwag i'r gweithio siarad yn holl Australia ac ychydig yma i'r gweithio yr sefydliadau mae'r gweithio i'n meddwl i'r gweithio mi'n ddillfyniaeth gan byddwyr i chi'n gwahodd ar beth i chi'n eraill o'r gweithio unig o rhannu swyddfa'l yn ei ddinsig ac mae'n ei ddim yn gychydig yn eich gweithio. Roeddwn yn cael ei ddinsig i gweithio ben o brinfaedau gyda'r gweithio ac rhaid i chi'n swyddfa ceisio pan rhaid i chi ddim yn cael ei ddinsig felly they're doing things but more about gesture recognition that might be able to solve that, I don't know. So yeah in the end I gave up on the jumping, I did it so you could just flick the book up in sideways and that's how you control a Frogger or a Bun. And there was, there was good fun to play. And I'm not quite sure what was a blank slide there but never mind. Felly, I know what those are blank slide there, sorry. I'm getting ahead of myself. Reason is blank slide there. This was one I didn't take a video of unfortunately. I've got a... It's part of my job I review hardware. I've got a ESP32 based smartwatch in to play with. It had a pedometer on it. You could query the pedometer and tell you how many steps you could do. I really wanted to make a version Mario Kart, but you could run around. I thought that would be it. This was during lockdown. I've been sat in the same room for a long time. I want to run and play Mario Kart. So you could query it. Similar to the previous one, the latency was awful. By the time it registered a step, it was easily a second or two after when it actually happened. But for some games, that doesn't actually matter. There's a whole bunch of racing games where you just hold down go and just steer. For games like that, that worked great. You ran and you moved. You could tap the button watch to move left and right. Unfortunately, I don't have a video of it, which is why the screen is blank at the moment. You just have to imagine me running around playing Mario Kart, pressing the two buttons. One of the problems I was having is I had these... The software side of it was coming together relatively easily. But the hardware always felt a little bit wrong. It was hard to put together. I put it in a book in one of the times. When I wanted to make a controller, how did I go and do that? There's loads of technologies you could use. I could have 3D printed a case with it, but then you'd need to 3D print one for each specific controller. You need to fiddle it and take a few iterations to get right. I want these to be really quick prototypes. Most of the ones you see here, I was able to create in a couple of hours, including hardware and software, maybe three or four hours for some of them. You didn't have to worry about it. It wasn't a serious project that I really invested in. You'd hack it together, play some games and see what I like, see what I didn't like, iterate again and try something else. The PCVs here, it's just Protoboard. It's a custom-made Protoboard in the shape of a games controller with a space for mounting a Pico on it. You could do it with any microcontroller, but it'll work for Raspberry Pi. It's got a Pico on it. Then you just stick whatever you want. Some stuff's hot glued on, some stuff's soldered on. It doesn't matter. It just stays on. This one, as you can see, it's got two sliders that you can slide. In a sense, it's the same information. It's very similar to what you might look at at a joystick or a joy pad. The way you use them is surprisingly different. It's a much bigger movement than you'd use on most. You have to actually move your whole hand. Also, they're sticky, so if you move it to a particular point, you can take your hand off, and it'll keep doing that. If you want to pick a particular speed, you just move the slider forward to a particular point, and it'll keep going. Depending on the game, you can pick what you want to preset to any particular level. The other ones were kind of gimmicky. You'd never really play too much with it and just have a little go. But this one was the first one I made. It changed games, and it made games more fun to play, and not just in a, for five minutes, and then throw it away. It was fun. It made me want to experiment more with the different things. Having done sliders, they're sliper tensiometres, this one is actually on the exact same control. I just flipped over, realised there's no point in just using extra PCBs and microcontrollers, just turn upside down, solder some more stuff on, and you're good to go. So it's got a rotary encoder. Now there's nothing new about using rotary encoders for games. I think the original version of Pong used a rotary encoder. There's the Play Date by Young Teenage Engineering that's more recently used a rotary encoder. But they had specific games written for that hardware. This is a more general purpose one. Originally I wanted to make it a steering wheel. You could play racing games with it and turn left, right. It worked, it was fine, it was a bit boring to be honest. But what I discovered is you can use it almost like riding a bike. You have to twiddle it round and you have to keep moving it to hold the button down. So in this game you can see that you have to keep moving it to turn left or keep moving it to turn right. And it takes what is a static movement in most games. Most of the time if you want to move right you just hold down the right key or the left key. Suddenly it's active and it's almost psychologically different in the way you play the game. It's a bit hard to put your finger on exactly what it is, but it engages you in a way that perhaps you don't when you just hold down the key and tap another button to do things. And again, this one, to me at least, it made the games more fun. It wasn't just a janky prototype. It was something I actually sat down and played with. And the other thing that both of these had is micro switches on the shoulders. And I discovered that I really like hitting micro switches. They're really satisfying. They've got a really positive movement and a little bit of squing at the end when they click. So yeah, that was those two controllers. So this one is perhaps, I don't know if it's a more obvious one or not, but it's got nine-axis IMU in it, so it can tell which way up it is. And this one it's just been used like a steering wheel, so yeah, perhaps a little bit. Sorry, there are a lot of spiders here. I don't know if I've angered some spider guard or something. Or maybe they just want to play the games, I don't know. So yeah, you use it like a steering wheel, you can tilt it. And that was kind of fun. And the other thing about this is you can change the firmware. It's just a little bit of code. So the same controller can work in completely different ways. So this can also detect where it's pointing in sort of the horizontal plane. The tilting on the Z axis, I guess. So you can do that. So you can play, I tried it, you can play Doom where you actually have to turn around to move the character. That kind of works. But there's a fundamental problem with the USB controllers that I don't think there is a solution to. And that's that you can't get feedback back from the game. So if you use this controller and you turn 90 degrees, most games don't have a keystroke that says turn exactly 90 degrees. You hold down a key for a bit and it turns a bit. So it's basically impossible to map that to one of these controllers. You can turn and it can turn. So 90 degrees and your character might turn 180 degrees. And that gets incredibly disorientating very quickly. So that was a little bit of a disappointment. Maybe there's a way around it. I haven't worked out what it is yet. So this one kind of came about a bit by accident. I was trying to 3D print a guitar and 3D printing a guitar is a terrible idea. I was aware it was a terrible idea but I tried it anyway. I think the filament was damp and I'm making excuses to him. But the neck just snapped before I even built the strings on it. I had a broken guitar and around that time one of my colleagues who works for Wireframe magazine sent me a message saying, we're doing this article on guitar hero and someone's written some code to do guitar hero or re-implement it and I can't get it to work and you just check the code and I was like, well hang on, you've got guitar hero and we've got three quarters of a guitar, surely. We can make something work here. So yeah, I put this together and this uses their touch pads for the notes. They're just bits of exposed metal that are connected to the GPI pins. You can detect the touch and I don't really like touch interfaces in general but I thought it would make sense for this. They don't really work. There's too much going on in the controller as you hold it. It's really easy to get false positives. I had to do some really janky codes to get it to work at all and maybe it could have been designed better with the wires going in different places but for me personally I'm done with touch on spiders everywhere. I'm done with touch controllers. I'm trying other things for now but maybe there's a way of making them work. So yeah, those are the games controllers I've made. I've been wanting to get into a hardcore look at the code but I just want to give you an idea of what it looks like and to be honest, how amazingly simple it is. So this is the first half of the code for the spinner controller. So as you can see, just import a bunch of stuff and then setting up the keyboard is just those two lines where you create a keyboard object and assign it a layout. Once you've done that, you'll see in a minute that you can just press keys. I created this slide a few days ago and I was looking for it. I have no idea why there's a pause function in the bottom of that but it is called and I don't know if it was for a good reason or a bad reason. I suspect it was a bad reason that I created that and you could just get rid of that and use time sleep because I didn't have time to test it out because the controller is broken. So yeah, this is the main chunk of the spinner code. It just checks, in this particular module that I'm using it counts the position of the spinner so as you turn it, an internal count goes up and up and up. So you know if you've turned it 10 times, 100 times, whatever. So all it does is it checks and that's keeping going up keeping going down, make sure the right keys are pressed and then yeah, there's just a button that it just checks the state of and sends the key press. So yeah, that's all there is to it. So I apologise about the white slides. Everything was set up and lovely and I was just testing out in the green roof and for some reason on a couple of the slides I can see them but you can't. No idea why but this one, it's fortunate they're not critical slides. So there is a difference between keyboard and gamepad. So you can emulate a USB gamepad as well. They've got buttons but they've also got analog inputs. I think there's two analog joysticks in a standard USB gamepad. That used to be part of the circuit Python core but it was taken out a couple of versions back because it doesn't work perfectly. I've not been able to test any of these controllers on Macs yet. Apparently occasionally you get glitches with the USB gamepads, I've no idea. But yeah, so let's take out the core. The short version is there's just a couple of files you need to copy out there in the GitHub that's at the end of this talk. And this one, it's the last slide I've played. I was hoping to have a chunk here where I could talk about how you can use your title badge to create a USB games controller because it can. If you look at it, there is one of the examples that uses a joystick to create movement events. It's not quite right, it uses a page up and down, I think is what it's doing. It's not quite right for games controllers. And I was hoping to have a really quick example to show you how to make it to control games. It's almost working but not quite. So yeah, that's not quite ready yet. I was flying by the seat of my pants a little bit to get that there. But hopefully I'll get that going in the next couple of days. So yeah, the other thing I just wanted to talk about was in almost all these examples, I've used Circuit Python. And the reason for that is I find Circuit Python incredibly fast to prototype him. I think it's got fantastic support for hardware. And it supports USB-HIT protocol, human interface device protocol really well. Micropython, very similar to Circuit Python, doesn't usually incorporate USB-HIT support. However, the TILBA, the Tidal badge, the EMF camp badge does have support. It is running Micropython and does have support for the USB-HIT protocol. So usually Circuit Python is a better choice than Micropython for this badge. Micropython is fine. I've also used Arduino. So the running badge was written in Arduino which has great exact support. Bluetooth keyboards and that sort of thing. You can also write it in pure C using the tiny USB library if you really want to. But that's just a little bit masochistic, to be honest. For most purposes. I'm running a little bit ahead of schedule, to be honest, but that's what I wanted to say. So most of the examples here you can see on that particular GitHub repository. I'm on Twitter and available by email. Most of these videos are on Twitter at various points. Yeah, that's what I came here to say.