A custom Scratch 3.0 server with an extension to control sprites with AlpacaML gestures
You may choose not to use your own signaling server and instead use the internet-facing server at ws://scratchpaca.playfulcomputation.group:1230
which comes hardcoded. If that server is down, follow the steps below.
git clone https://github.com/LaboratoryForPlayfulComputation/AlpacaMLScratchExtension.git
cd AlpacaMLScratchExtension/signaling/
npm install
node app.js
, which starts the signaling server. It prints its URL like shown below:
You will need that URL soon.
- Download the source code for the Scratch server at: https://drive.google.com/file/d/18_Jm6u0LArYsIBWWuor2HRQBtb4_f6eZ/view?usp=sharing
- Extract the downloaded file, which gives you a folder called "scratch-gui"
- (Optional) Configure the AlpacaML extension for your personal signaling server:
- The WebSocket URL of the signaling server is hardcoded in the extension
- [TEMPORARILY DEPRECATED]
this.socket = new WebSocket('ws://scratchpaca.playfulcomputation.group:1230');
will connect to an internet-facing server (assuming it is running), avoiding the need to run your own signaling server - Alternatively: Replace the URL in line 16 of
scratch-gui/node_modules/scratch-vm/src/extensions/scratch3_alpacaml/index.js
with the URL printed by your signaling server - For example:
this.socket = new WebSocket('ws://192.168.0.11:8080');
cd scratch-gui/
npm install
npm start --no-inline
- Navigate to http://0.0.0.0:8601/ (works best in Chrome)
- Add the AlpacaML Extension to your Scratch project by clicking the "Add Extension" button in the lower left corner
The AlpacaML codebase is hosted on GitHub, here: https://github.com/LaboratoryForPlayfulComputation/AlpacaML
- Open that project in Xcode
- Configure AlpacaML for your signaling server (Optional):
- The WebSocket URL of the signaling server is hardcoded in the app
ws://scratchpaca.playfulcomputation.group:1230
connects to the internet-facing server- If that server is down, replace the URL in line 12 of
LPC Wearable Toolkit/Config.swift
with the URL printed by your personal signaling server - For example:
fileprivate let defaultSignalingServerUrl = URL(string: "ws://192.168.0.11:8080")! //personal server
- Run the AlpacaML app
- In AlpacaML, tap "Connect to Scratch"
- It will show a 4-digit alphanumeric "secret code"
- In Scratch, type that secret code into the "Connect to AlpacaML" block then click it
- You will see the message "Hi from Scratch!" which confirms the WebRTC connection has been established
- You can use the "Send a message" button in AlpacaML to test the connection