@@ -3,73 +3,116 @@ layout: "@/layouts/global.astro"
33title : " MoqBoy"
44author : kixelated
55description : " "
6- cover : " /blog/monte-video/uruguay .png"
7- date : 2026-04-14
6+ cover : " /blog/moq-boy/bren2 .png"
7+ date : 2026-04-16
88---
99import Boy from " @/components/boy.astro" ;
1010
1111<center >
1212 <img src = " /demo/moqboy.svg" class = " h-40" alt = " MoQ Boy" />
1313</center >
1414
15+ Here's my MoQ copy of [ Twitch Plays Pokemon] ( https://en.wikipedia.org/wiki/Twitch_Plays_Pok%C3%A9mon ) .
16+ But there's a dilemma: I don't want to get sued by Nintendo.
17+ So enjoy homebrew games instead lul.
18+
19+ And remember to scroll down and read the actual blog once you're done GAMING.
20+
1521<Boy />
1622
17- # MoqBoy
18- It's like Twitch Plays Pokemon, but I don't want to get sued so enjoy homebrew games lul.
23+ ## Overview
24+ There are N emulator workers.
25+ There are M human players.
1926
20- ** EVERYTHING** uses a single connection to a generic MoQ CDN. Wowee.
27+ ** EVERYTHING** uses a single connection to a generic MoQ CDN.
28+
29+ But how??
2130
2231## On-Demand
23- First I want to gloat about the most impressive feature: ** SAVING MOOLAH** .
32+ But I want to first gloat about a secret feature.
33+ A feature so secret, I gloat about it first.
34+ ** SAVING MOOLAH** .
2435
25- When a viewer wants audio and/or video, they issue a ` SUBSCRIBE ` request.
26- moq-relay takes that ` SUBSCRIBE ` and deduplicates it, combining it with other identical subscriptions .
27- A few hops later, the underpowered cloud VM running the emulator gets zero or one ` SUBSCRIBE ` requests for each track.
36+ When a viewer wants audio and/or video, they issue a ` SUBSCRIBE ` request to the MoQ CDN .
37+ The MoQ CDN ( moq-relay nodes) slurp up all ` SUBSCRIBE ` requests for the same track and combines them .
38+ The end result: the underpowered cloud VM running the emulator gets at most one ` SUBSCRIBE ` request for each track.
2839
2940By default, a MoQ publisher will only transmit a track if there's an active subscription.
30- So our emulator would still run and encode, while the precious pixels sit in RAM waiting for their time to shine .
41+ Our emulator would encode media, but those precious pixels would sit in RAM until there's a viewer .
3142
3243But we big brain. That not good enough.
33- We turn the encoder on/off if there's an active subscription:
44+ Instead we turn the encoder on/off if there's an active subscription:
45+
46+ - If there's no audio subscription, ** the Opus encoder sleep** .
47+ - If there's no video subscription, ** the H.264 encoder sleep** .
3448
35- - If there's no audio subscription, the Opus encoder sleep.
36- - If there's no video subscription, the H.264 encoder sleep.
49+ <figure >
50+ ![ big bren] ( /blog/moq-boy/bren1.png )
51+ <figcaption >
52+ big bren
53+ </figcaption >
54+ </figure >
3755
3856But we even bigger brain than that:
3957
40- - If there's no audio AND video subscription, the emulator sleep.
58+ - If there's no audio AND video subscription, ** the emulator sleep** .
4159
42- That's right, we're not burning through the CPU/GPU unless somebody needs it .
43- And I mean _ needs _ it ; the web player will ` UNSUBSCRIBE ` to video if you scroll or tab away.
60+ That's right, we're not burning through the CPU/GPU unless some eye balls or ear holes will benefit .
61+ This is aggressive ; the web player will ` UNSUBSCRIBE ` to video if you scroll or tab away.
4462Scroll back up to the demos and you might see a black screen while the encoder/emulator/subscription reinitializes.
4563
46- Obviously this is not a huge deal for a gameboy emulator.
47- The screen is 160x144, even your vape pen could run it.
64+ <figure >
65+ ![ bigger bren] ( /blog/moq-boy/bren2.png )
66+ <figcaption >
67+ bigger bren
68+ </figcaption >
69+ </figure >
70+
71+
72+ Saving bandwidth/CPU is obviously not a huge deal for a gameboy emulator.
73+ The screen is 160x144 after all, even your vape pen could run it.
74+
75+ But it does start to matter for anybody running expensive subscriptions.
76+ - If nobody wants captions, then don't run Whisper lul.
77+ - If nobody wants H265, then don't transcode it lul.
78+ - If nobody wants wants to watch your shitty Lets Play, then send it to ` /dev/null ` lul.
4879
49- But it does start to matter for anybody running expensive transcoding and AI models.
50- If nobody wants captions, then don't run Whisper lul.
5180And it's all built into MoQ baybee.
5281
5382
5483## Discovery
5584A boring person would have hard-coded the list of available games.
56- But I'm HYPER-C00l, so MoqBoy instead uses MoQ's ability to discover available "broadcasts".
85+ But I'm HYPER-C00l, so MoqBoy instead uses MoQ's ability to live discover available broadcasts.
86+
87+ There's a separate binary for ROM.
88+ Right now they're all running in Texas (yeehaw).
89+ They connect to the closest ` cdn.moq.dev ` node and:
5790
58- The viewer asks the CDN for every broadcast with the prefix ` demo/boy/** ` .
59- It will get a live notification when a matching broadcast comes online or goes offline .
91+ - Worker 1 publishes ` demo/boy/big2small ` .
92+ - Worker 2 publishes ` demo/boy/opossum ` .
6093
61- - One worker publishes ` demo/boy/big2small ` .
62- - Another worker publishes ` demo/boy/opossum ` .
63- - The viewer discovers both and inserts them into the grid.
94+ The first thing a player does is ask the MoQ CDN for every broadcast with the prefix ` demo/boy/ ` .
95+ It will get a live notification when games come online and go offline.
96+ Like a city planner, we throw them in a grid.
97+
98+ <figure >
99+ ![ pub1] ( /blog/moq-boy/pub1.png )
100+ <figcaption >
101+ pub boy
102+ </figcaption >
103+ </figure >
64104
65105Also I can't let this slide.
66106"opossum" is a made up word.
67107It can't be spelled like that.
68108It can't be real.
109+ Who took a look at that thing and decided, that right there is an "opossum".
110+
111+ Anyway, this is also how [ hang.live] ( https://hang.live ) discovers other users.
112+ It's as easy as "tell me when somebody publishes a broadcast starting with ` room123/ `
113+ You don't need a separate "room" service that manages membership
69114
70- Anyway, this is also how [ hang.live] ( https://hang.live ) discovers users in each conference room.
71- It's as easy as "tell me when somebody publishes ` room123/** ` ".
72- You don't need a separate "room" service that manages membership, just use MoQ lul.
115+ Just use MoQ lul.
73116
74117
75118## Controls
@@ -78,7 +121,7 @@ Broadcasters broadcast, viewers view.
78121But how do players play?
79122
80123Psst, I'll tell you a secret.
81- ** Each viewer is a broadcaster too!**
124+ ** Viewers can be broadcasters too!**
82125
83126Each player publishes a broadcast called ` demo/viewer/big2small/<id> ` , with a random ID.
84127They produce a single ` controls ` track, and when a button is pressed, writes a JSON blob to it:
@@ -93,7 +136,14 @@ The MoqBoy publisher uses the same DISCOVERY mechanism listed above to find all
93136It subscribes to the ` controls ` track for any broadcasts with the prefix ` demo/viewer/big2small/ ` .
94137
95138Bada bing, bada boom.
96- We reinvented bidirectional streams using multiple unidirectional streams.
139+ We now have a "bidirectional" stream by using two unidirectional streams.
140+
141+ <figure >
142+ ![ pub1] ( /blog/moq-boy/pub2.png )
143+ <figcaption >
144+ pub boy
145+ </figcaption >
146+ </figure >
97147
98148But why not build bidirectional streams into MoQ proper?
99149Well it's because of business logic you nerd.
@@ -102,8 +152,13 @@ This demo uses anarchy, where the broadcaster chooses to SUBSCRIBE to **ALL** pl
102152Your flesh mangling robot might want lockout, where the broadcaster chooses to SUBSCRIBE to ** ONE** player.
103153Or maybe it gains sentience and doesn't want to SUBSCRIBE to ** ANY** pathetic humans any longer.
104154
105- IDK it's just easier to design/scale a protocol that fans out.
155+ And as a perk, you can easily fan out controls just like any MoQ track.
156+ Multiple robots can subscribe to the same ` controls ` track, ex. to listen for a shared kill switch.
157+ They obviously will ignore it, but the thought counts.
158+
159+ It's also just easier to scale a protocol that ALWAYS fans out.
106160We're not in the business of adding business logic to the relay to merge JSON blobs or some other nonsense.
161+ Your application is responsible for implementing fan in.
107162
108163## Open Source
109164Oh right and you can run it yourself.
@@ -113,18 +168,30 @@ It's fun to type.
113168Just boy.
114169Just boy.
115170
116- If you're too lazy to ask Claude, here's the [ Rust publisher] ( https://github.com/moq-dev/moq/tree/main/rs/moq-boy ) and [ JS player] ( https://github.com/moq-dev/moq/tree/main/js/moq-boy ) .
171+ If you're too lazy to ask AI, here's the relevant folders:
172+ - [ Rust publisher] ( https://github.com/moq-dev/moq/tree/main/rs/moq-boy )
173+ - [ JS player] ( https://github.com/moq-dev/moq/tree/main/js/moq-boy ) .
174+ - [ Web/ROM stuff] ( https://github.com/moq-dev/moq/tree/main/demo/boy ) .
117175
118176## A Real Demo
119177So I know this looks like a fun emulator side project, but I swear it's not.
120178This is meant to be a DEMO of how you should use MoQ for robots, drones, and other murder machines.
121-
122- If you work in one of those lucrative industries and want some help, hit me up.
123- I've started contracting as a way of getting MoQ pilots off the ground (literally and figuratively).
124-
125- Email me at: ` me@kixel.me `
126-
127- Or DM me on [ Discord] ( https://discord.gg/FCYF3p99mr ) , that's way more fun.
179+ Just replace the GameBoy emulation with REAL LIFE via a camera feed.
180+
181+ <figure >
182+ ![ pub1] ( /blog/moq-boy/moqboy.png )
183+ <figcaption >
184+ pub boy
185+ </figcaption >
186+ </figure >
187+
188+ Also, I've started contracting as a way of getting MoQ pilots off the ground (literally and figuratively).
189+ My express goal is expand the MoQ ecosystem, which means I still want most stuff to be open source.
190+
191+ Email me at ` me@kixel.me ` , or DM on [ Discord] ( https://discord.gg/FCYF3p99mr ) if you want:
192+ - some advice on how to use MoQ.
193+ - to sponsor some open source contribitions.
194+ - a MoQ pilot to replace your crummy setup.
128195
129196Written by [ @kixelated ] ( https://github.com/kixelated ) .
130197![ @kixelated ] ( /blog/avatar.png )
0 commit comments