jaames
(James)
August 11, 2022, 4:46pm
1
Since the Playdate exposes a serial interface when connected to a PC via a USB-C cable, it's sort of possible to get Lua games to communicate with a PC by misusing the eval
serial command to send data in and print()
to send data out.
It would be great if there was a simpler way to achieve this "officially", maybe where a game could register its own serial commands with callbacks that get fired when they are received, and send out serial data to whatever is connected.
Additionally, if it would be possible for two Playdates to open a serial connection between eachother when joined with a USB-C to USB-C cable, this could allow for simple Gameboy-Link-Cable-esque multiplayer (for people who are lucky enough to own multiple Playdates!)
16 Likes
NeoTechni
(Tanya Myoko)
August 11, 2022, 6:23pm
2
Bluetooth would also be great for multiplayer and wouldn't require another cable
hjhart
(James)
August 17, 2022, 5:16pm
3
What about over LAN via WiFi? If we are looking for no cables, that might be the best option.
I know nothing about play date and networking, just that it has a wifi chip built in…
jaames
(James)
August 17, 2022, 5:48pm
4
I totally get why everyone wants wireless (and I do hope we get access to it in the SDK eventually!) but wireless on the Playdate currently is kinda flakey, slow, and eats battery power ravenously. Since the Playdate already supports serial over USB when connected to a computer, it seems slightly more achievable to use that, at least in the short-term.
3 Likes
hjhart
(James)
September 8, 2022, 4:24pm
5
I like this approach for sure. Thanks for the context.
2 Likes
Im realy interested in this too. especially the usbc to usbc version. Seems the easyest way to me.
Iv looked for some examples
First heres EricLewises 2 player example that conects to a pc and uses a couple scripts on pc
common.js
const drivelist = require('drivelist');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const { SerialPort } = require('serialport');
const fs = require('fs-extra');
const POLL_INTERVAL = 1000;
const poll = async ({ fn, validate, interval, maxAttempts }) => {
let attempts = 0;
This file has been truncated. show original
game.lua
import "CoreLibs/sprites"
local playerID = 1
local playerImage = playdate.graphics.image.new(10, 10, playdate.graphics.kColorBlack)
local player = playdate.graphics.sprite.new(playerImage)
player:moveTo(200, 120)
player:add()
local player2 = playdate.graphics.sprite.new(playerImage)
This file has been truncated. show original
index.js
const { connectSerialPort, send_raw } = require("./common");
const { ReadlineParser } = require('@serialport/parser-readline');
const { initializeApp } = require("firebase/app");
const { getDatabase, ref, set, onValue } = require("firebase/database");
const firebaseConfig = require("./config");
const app = initializeApp(firebaseConfig);
const database = getDatabase(app);
function s2b(str) {
This file has been truncated. show original
There are more than three files. show original
committed 07:22AM - 11 May 22 UTC
the second is the playwrite project
# Playwrite
<img src="source/images/card.png">
Experimental word processor for [Playdate](https://play.date). Requires a dedicated keyboard adapter, see [playwrite-dock](https://www.github.com/t0mg/playwrite-dock).
**Overview thread with demo videos: https://twitter.com/t0m_fr/status/1576949261849149440**
<img src="images/hello.jpg" width="33%"> <img src="https://github.com/t0mg/playwrite-dock/blob/master/images/keyboard.jpg" width="58.2%">
Playwrite is a simple text editor for [Playdate](https://play.date). This console doesn't normally support keyboards or any kind of USB accessory, but the Playwrite project uses a bespoke dock relying on USB serial to proxy the input commands to the Plalydate.
This repository is dedicated to the software to be sideloaded on Playdate; it contains the Lua code for the Playwrite app. It's pretty much useless on its own without the dock. For source and documentation on how to build the playdate dock, see [the other repository](https://www.github.com/t0mg/playwrite-dock).
## Features & future development
The app is a proof of concept but quite usable as is, with cursor movement, insertion and deletion support. It has menu option to load, save and export but currenly only supports a single document (no file naming options). The export function flattens the Lua table of the working document into an `export.txt` file that can then be retrieved in USB data disk mode (Settings > System > Reboot to Data Disk).
Possible improvement ideas:
This file has been truncated. show original
Id like to make some 2 player fighting games
1 Like