LAN Waifu
Everyone picks an anime character who lives on their screen: she roams your
open code editors, reacts to what you're doing, and now and then visits
teammates on the same network. She carries your messages and sounds, too:
send one and she walks off your screen and onto your teammate's.
Created by Guy.
What she does
- Is yours. Pick one of seven characters with LAN Waifu: Choose
Character (👗). Teammates may pick the same one; name tags show whose is
whose when more than one is on a screen.
- Roams VS Code. On Windows she walks along the bottom of the whole
window, just above the status bar, over editors, sidebar and terminal
alike. Drag her anywhere in the window and she drops back down when you let
go. On macOS and Linux she walks along the lines of your open editors
instead. With roaming turned off she lives in the LAN Waifu panel in the
Explorer.
- Can be thrown. Grab her and fling her: she flies with the mouse's
speed and crash-lands (Windows). Fling her off the right or left edge and
she flies onto that teammate's screen, crash-landing there; fling a
visitor off and she flies home. With nobody in the room she bounces off
the edge.
- Reacts to you. She cheers when you save, frets when errors appear (and
cheers when you fix them), sits out of your way while you type fast,
celebrates commits, and naps after two idle minutes.
- Visits teammates. Now and then she walks off an edge to visit someone:
right to the next teammate, left to the previous one. Their characters
visit you the same way, and head home after a while.
- Carries messages. LAN Waifu: Send Message (💌) picks a teammate and a
message. Your character walks it over and tells them, plus a normal
notification. If she's out visiting, she takes it once she's back.
- Comes when called. Ctrl+Alt+W (Cmd+Alt+W on Mac) brings her to your
cursor, calling her home first if she's visiting.
- Brings sounds. LAN Waifu: Send a Sound (🔊) picks a teammate and a
sound from the built-in pack (▶ previews it). Your character carries it
over and asks "wanna listen?". Click her to play it. Unheard sounds wait in the panel
and in the status bar (🔊 with a count) until you listen.
- Likes attention. Click any character, on your code or in the panel.
Without a room code she's yours alone and nothing touches the network.
Each person has one character. With several VS Code windows open, she lives
in one of them (the first opened); if you close it, another window takes
her over.
The LAN Waifu panel lists who's in the room, with their characters. Your
name for teammates is your GitHub account's if you're signed in to VS Code
with one, otherwise your computer's user name; LAN Waifu: Set Your Name
(🏷 in the panel) changes it.
Use it
- Run LAN Waifu: Set Room Code and agree on the same code with your
teammates on the same network.
- Teammates' characters start dropping by within a minute or so.
Settings
| Setting |
What it does |
lanWaifu.character |
Your character. Choose Character picks with pictures. |
lanWaifu.roomCode |
Shared secret for your room. Empty means solo. |
lanWaifu.displayName |
Your name for teammates. Set Your Name picks one. |
lanWaifu.roamEditors |
Let her roam over VS Code (default on). Toggle Roaming in Editors flips it. |
lanWaifu.overlay |
On Windows, roam the whole window rather than just the editors (default on). |
lanWaifu.size |
small, medium or large. |
lanWaifu.peers |
Teammates' IPs, for networks that block multicast. |
lanWaifu.relayUrl |
A relay server, for networks that block direct traffic. See relay/. |
Privacy and security
- Every packet is encrypted (AES-256-GCM) with a key derived from the room
code. People without the code can't read messages or forge packets. Pick a
room code that isn't easy to guess.
- Each packet is unique, so recorded packets can't be replayed later.
Teammates' clocks must agree within 10 minutes.
- Packets are size-checked and rate-limited on arrival.
- The relay, if you use one, only sees encrypted bytes and a room tag that
doesn't reveal the code.
Troubleshooting
Run LAN Waifu: Show Diagnostics. It lists your IP addresses, the
teammates this window sees, and how many packets were dropped and why.
- Nobody shows up: check everyone has the same room code. On Windows,
allow VS Code on private networks when the firewall asks.
- "unreadable" packets climbing: someone nearby uses a different room
code or an older version of LAN Waifu.
- "stale" packets: a teammate's clock is more than 10 minutes off.
- Office or guest Wi-Fi: these often block multicast. Add each other's IP
addresses (shown in diagnostics) to
lanWaifu.peers. If that doesn't work
either, run the relay (relay/README.md) and set lanWaifu.relayUrl.
Develop
npm install
npm test # room, mood and codec tests
npm run typecheck
npm run build # also builds the Windows overlay app, if the .NET SDK is installed
npm run package # builds lan-waifu-<version>.vsix
Press F5 in VS Code to launch an Extension Development Host, or from a
terminal:
npm run build
code --new-window --disable-extensions --extensionDevelopmentPath="$PWD"
Don't open this folder inside the Extension Development Host and press F5
there. VS Code would restart that same window for debugging, nothing
attaches, and it fails with "Extension host did not start in 10 seconds".
Layout:
src/core/: the logic, all pure and tested. room.ts (peers, who has her,
handoffs, letters, summons), mood.ts (reactions to your activity),
codec.ts (encryption, replay and rate limits), protocol.ts (packets).
src/net/: transports (lanTransport.ts, relayTransport.ts) and
link.ts, which ties them to the codec.
src/editor/: roaming over code editors and watching your activity.
src/webview/: the panel she uses when no editor is open.
overlay/: the Windows overlay app (C#, .NET Framework 4.8, which comes
with Windows). It draws the characters in see-through windows on top of
VS Code, moving them every screen refresh, and takes the mouse directly.
src/overlay/overlayStage.ts starts it and talks to it over stdin and
stdout, one JSON message per line. Building it needs the .NET SDK.
src/art/characters.ts: the characters and their poses. The images in
media/characters/ are made from the sheets in art/source/ by
scripts/slice_characters.py (Python with Pillow, numpy and scipy; only
needed when adding art). See "Adding a character" below.
relay/: the optional relay server.
See RELEASE.md for publishing and TRIAL.md for testing with teammates.
Adding a character
- Make two sheets in the same layout as the existing ones, 4 poses across
and 2 down, on a transparent background:
<id>-1: idle, walk ×4, wave, jump, laptop
<id>-2: point, thumbs up, excited, asleep, thinking, cheering,
peeking, laptop with a notification
- Save them as
art/source/<id>-1.png and art/source/<id>-2.png.
- Run
python scripts/slice_characters.py <id> and check
art/preview/<id>.png.
- Add the character to
CHARACTERS in src/art/characters.ts and to the
lanWaifu.character enum in package.json.
A full walk cycle can come from art/source/walk/<id>.png (or .webp): one
row of frames of her walking, facing right, on a transparent background. Eight
frames work well: contact, down, passing, up, then the same with the other
foot. They replace the sheet-1 walk frames, scaled to match her other poses.
The overlay advances them with the distance she walks, so if a new cycle has
much longer or shorter steps, adjust CycleLength in overlay/Actor.cs.
A teammate whose character isn't installed on your machine is drawn as
Midnight.
Known limits
- VS Code has no API for drawing over its window, hence the overlay app on
Windows. On macOS and Linux roaming uses editor decorations with extra CSS
(the trick Power Mode uses), which ties her to lines of text. It works in
VS Code 1.141, but a future VS Code could stop allowing it; she'd then only
appear in the panel.
- The overlay shows characters only while VS Code is the window in front, so
they don't float over other apps.
- Without the overlay, a click on her lands in the text under her (moving your cursor
there) and counts as clicking her when it's inside her outline. Past the
end of a short line VS Code can't tell exactly where you clicked, so a
click anywhere to the right of the text beside her counts.
- Sounds play through the OS (PowerShell on Windows,
afplay on macOS,
paplay or aplay on Linux), at your system volume.
Credits and license
Created by Guy. The code is MIT licensed. The character art is not: it's
all rights reserved and may only be used as part of this extension. See
LICENSE.
Sounds by Kenney (https://kenney.nl), CC0. See media/sounds/CREDITS.md.
| |