npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-game_controllerizer

v0.3.10

Published

Node-RED nodes for GameControllerizer

Downloads

9

Readme

node-red-contrib-game_controllerizer

Node-RED nodes for GameControllerizer.

These nodes allow users to combine the processes of IoT devices, Web services, and applications of AI, and to convert them into game control operations to augment existing digital games.
See our paper for more details.

Block diagram

Getting Started

This assumes you have Node-RED already installed and working. This requires,

Install via Node-RED Manage Palette

node-red-contrib-game_controllerizer

Install via npm

$ cd ~/.node-red
$ npm install node-red-contrib-game_controllerizer
# then restart node-red

Cheat sheet

Import this json as a Node-RED flow.

Usage examples

Example 1

Send control operations (ex. push button-A) to a game console via the H/W gamepad emulator. Do not forget to configure input/output UART node.

[{"id":"72540d54.4285f4","type":"inject","z":"24c06ae6.309316","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":380,"wires":[["96f8637f.a373a"]]},{"id":"9aae373d.e1c218","type":"serial out","z":"24c06ae6.309316","name":"UART","serial":"b33fb905.04c2b","x":650,"y":400,"wires":[]},{"id":"96f8637f.a373a","type":"button","z":"24c06ae6.309316","name":"","button":0,"mode":"push","x":280,"y":380,"wires":[["97b5eb7d.8feaa"]]},{"id":"5ad63d0b.f5c9e4","type":"inject","z":"24c06ae6.309316","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":420,"wires":[["82fb165b.94fc38"]]},{"id":"82fb165b.94fc38","type":"dpad","z":"24c06ae6.309316","name":"","dpad":"2","mode":"3","x":280,"y":420,"wires":[["97b5eb7d.8feaa"]]},{"id":"97b5eb7d.8feaa","type":"binary-serializer","z":"24c06ae6.309316","name":"","x":480,"y":400,"wires":[["9aae373d.e1c218"]]},{"id":"b33fb905.04c2b","type":"serial-port","z":"","serialport":"/dev/ttyAMA0","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"bin","out":"char","addchar":false,"responsetimeout":"10000"}]

Example 2

Send a Street Figher 2 "Hadouken" comamnd to a game console in response to the HTTP get request. You can use JSON based abstract format DSL4GC (Domain-specific Language for Game Control) for command descriptions. See hadouken function node for example.

[{"id":"9a40e17c.c1af4","type":"serial out","z":"24c06ae6.309316","name":"UART","serial":"e8720150.5629d","x":650,"y":160,"wires":[]},{"id":"fd7715d3.54b788","type":"function","z":"24c06ae6.309316","name":"hadouken","func":"msg.payload = [\n    {\"dpad\": 2, \"dur\":3},\n    {\"dpad\": 3, \"dur\":3},\n    {\"dpad\": 6, \"dur\":3},\n    {\"btn\" : [0], \"dur\": 3}\n];\n\nreturn msg;","outputs":1,"noerr":0,"x":300,"y":160,"wires":[["ae3df6ef.dc3fe"]]},{"id":"a2ce9aa1.67f12","type":"http in","z":"24c06ae6.309316","name":"","url":"/hadouken","method":"get","upload":false,"swaggerDoc":"","x":120,"y":160,"wires":[["fd7715d3.54b788","bef21cc2.1c786"]]},{"id":"bef21cc2.1c786","type":"http response","z":"24c06ae6.309316","name":"http response","statusCode":"","headers":{"Access-Control-Allow-Origin":"*"},"x":320,"y":200,"wires":[]},{"id":"ae3df6ef.dc3fe","type":"binary-serializer","z":"24c06ae6.309316","name":"","x":480,"y":160,"wires":[["9a40e17c.c1af4"]]},{"id":"e8720150.5629d","type":"serial-port","z":"","serialport":"/dev/ttyAMA0","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"bin","out":"char","addchar":false,"responsetimeout":"10000"}]

Example 3

Redirect control operations from a general gamepad to a game console. GcScannerJs, a helper software for GameControllerizer, converts general gamepad operations to DSL4GC, then sends it to Node-RED via Websocket/MQTT.

[{"id":"2af3b0eb.387578","type":"serial out","z":"24c06ae6.309316","name":"UART","serial":"58598bf4.c908ec","x":650,"y":260,"wires":[]},{"id":"46ffafc1.409c3","type":"websocket in","z":"24c06ae6.309316","name":"","server":"9cb3c35c.a2fd9","client":"","x":120,"y":260,"wires":[["b26d49d7.723b8"]]},{"id":"b26d49d7.723b8","type":"json","z":"24c06ae6.309316","name":"","property":"payload","action":"obj","pretty":false,"x":290,"y":260,"wires":[["2a433803.5452f"]]},{"id":"897e21a4.1f3c3","type":"websocket in","z":"24c06ae6.309316","name":"","server":"3bc89e3a.806bba","client":"","x":110,"y":300,"wires":[[]]},{"id":"cc8d93d9.90b52","type":"websocket in","z":"24c06ae6.309316","name":"","server":"bf28459.50a72b8","client":"","x":110,"y":340,"wires":[[]]},{"id":"2a433803.5452f","type":"binary-serializer","z":"24c06ae6.309316","name":"","x":480,"y":260,"wires":[["2af3b0eb.387578"]]},{"id":"58598bf4.c908ec","type":"serial-port","z":"","serialport":"/dev/ttyAMA0","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"bin","out":"char","addchar":false,"responsetimeout":"10000"},{"id":"9cb3c35c.a2fd9","type":"websocket-listener","z":"","path":"/gamepad","wholemsg":"false"},{"id":"3bc89e3a.806bba","type":"websocket-listener","z":"","path":"/mouse","wholemsg":"false"},{"id":"bf28459.50a72b8","type":"websocket-listener","z":"","path":"/keyboard","wholemsg":"false"}]

Example 4

Receive a event from a H/W gamepad emulator that has 4 tactile switches on it. You can use an event like a injection node.

[{"id":"5b72539c.63192c","type":"serial in","z":"24c06ae6.309316","name":"UART","serial":"ec13252.94341d8","x":90,"y":440,"wires":[["954fa243.00c0b8"]]},{"id":"954fa243.00c0b8","type":"function","z":"24c06ae6.309316","name":"decode button input","func":"var tId = msg.payload.readUInt8(0);\n\nswitch(tId){\n    case 0x01:\n        return [{}, null, null, null];\n    case 0x02:\n        return [null, {}, null, null];\n    case 0x04:\n        return [null, null, {}, null];\n    case 0x08:\n        return [null, null, null, {}];\n}\n","outputs":4,"noerr":0,"x":290,"y":440,"wires":[[],[],[],[]]},{"id":"ec13252.94341d8","type":"serial-port","z":"","serialport":"/dev/ttyAMA0","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"bin","out":"char","addchar":false}]