Devlog: my game streams itself on Twitch now, no streamer and the AI villain talks in chat. Some stuff that broke on the way

3 days ago by ultimaluz to c/gamedev

LA ÚLTIMA LUZ · Era 6 · Void 89% · an AI erases what you paint · paint by hand: ultimaluz.com/r/twitch | Streaming art for 2 viewers.

Some context first. The game is a shared 256x256 pixel canvas, people paint it by hand from the browser and an AI called La Maquina spends the day erasing it. Free, no account. Problem is it has basically no players and I'm not going to stream it myself every day, so I tried to let the canvas stream itself.

I already had a 3D spectator view (three.js) with a "stream mode", the camera goes on autopilot and jumps to whoever just painted a pixel and shows their name, and her lines go as captions. So the plan was just put that page in OBS as a browser source and leave it running. It runs on a PC at home that isn't free all day (4060 Ti, NVENC, 1080p30, around 6 Mbps up), that's why the schedule is a bit weird.

At first I wanted a cheap VPS for this but measured before paying. Without a GPU chromium falls back to software WebGL and the scene was doing 0 or 1 fps, with the GPU it's around 100. So no VPS.

Things that broke:

  • when the PC was off and comes back, the browser source started black two times and once with no sound, while the page inside was totally fine. reloading the source doesn't fix the black one, only restarting OBS does
  • if OBS gets killed instead of closed, next start it asks "start in safe mode?" and waits forever because nobody is there to click. the thing it checks is a folder, not a file, lost a whole evening with that one
  • so now there's a small watchdog every 5 min that asks OBS (obs-websocket) for a screenshot of the source and the audio levels. black or silent -> reload, still bad -> restart OBS

For the chat there's a little bot reading the same live events the game uses and posting her lines. Only lines from the bank the game already has, I don't want anything generated going out without me reading it first. When the channel is offline she shuts up, !play and !era work always. And since this week the chat can paint too, !near lights a pixel next to the last one and !more east or !more north keeps drawing from yours, one pixel per message with the same charges as on the web (you have to follow the channel, mostly to keep throwaway accounts out).

Since yesterday it also goes to Kick at the same time, and since today to YouTube too. The PC sends the stream once to a tiny nginx-rtmp relay on the game's VPS and that copies it to all three, so the upload at home stays the same. Kick only takes RTMPS and nginx-rtmp doesn't do TLS, so that one goes through stunnel.

First night without telling anyone: 9 hours, 10 unique viewers (I guess people browsing the Art category) and zero of them went to the game lol. So this post is kind of the real launch.

Live on Twitch, Kick and YouTube weekdays 03:00-12:30 UTC and weekends 01:30-07:00 UTC. The game works anytime: https://ultimaluz.com/r/lemmy-gamedev-canal

If someone is doing something similar ask me, happy to share how the watchdog works

JakenVeina 2 points 2 days ago

By "AI villain" do you mean an LLM or a more traditional game AI?

path: 0 26311389, hotness: undefined, score: 2, children: 1
ultimaluz -1 points 2 days ago

both, kind of. the part that actually erases stuff is plain game AI, rules and a budget: it finds groups of 25+ connected pixels, announces a siege on one, closes a ring around it, and if people don't keep the ring lit it eats the work. all deterministic code. on top of that, every 15 min a small LLM (gemini flash lite through openrouter) gets the state of the board and picks which of the legal moves to make, which work to siege and when, and the code clamps whatever it answers, it can't break the rules. it also writes a one line reason that goes in a war log on the site, that's the only generated text players see. everything she says in the game and on the stream comes from a bank of lines I wrote by hand, and nothing on the canvas is generated, it's all people painting. if the LLM is off, a fixed set of rules plays instead

path: 0 26311389 26315670, hotness: undefined, score: -1, children: 0
gamedev
gamedev

@programming.dev

login for more options
6442
731
336

Welcome to the game development community! This is a place to talk about and post anything related to the field of game development.

Community Wiki

go to feed...