Control OBS from inside a Godot game or app.

OBS Websocket GD

A Godot addon to interact with obs-websocket. Tested on Godot 3.4.

Editor Plugin Quickstart

  1. Install obs-websocket for your platform
  2. Configure obs-websocket in OBS and set the password to something of your choosing
  3. Clone this project and move the addons/obs_websocket_gd folder to your addons folder
  4. By default, the addon tries to connect to localhost:4444 with a password of password. Change the password in addons/obs_websocket_gd/obs_websocket.gd to the password set in step 2
  5. Activate the addon in the Godot editor
  6. A new OBS menu should appear in the bottom bar of the editor

Game/App Quickstart

  1. Install obs-websocket for your platform
  2. Configure obs-websocket in OBS and set the password to something of your choosing
  3. Clone this project
  4. Instance in the addons/obs_websocket_gd/obs_websocket.tscn file somewhere in your project
  5. By default, the addon tries to connect to localhost:4444 with a password of password. Change the password in addons/obs_websocket_gd/obs_websocket.gd to the password set in step 2. The variables are exported for convenience
  6. (OPTIONAL) Connect some listener to the obs_updated(update_data) signal in obs_websocket.gd. obs_updated outputs a Dictioanry
  7. Call the send_command(command: String, data: Dictionary = {}) method on the obs_websocket.gd instance. Reference the obs-websocket protocol to find out what commands + data to send

Discussion

A Discord server is available here if you need help, like to contribute, or just want to chat.

Owner
Timothy Yuen
Employed college grad and amateur game dev
Timothy Yuen
Comments
  • Notify user of connection issue.

    Notify user of connection issue.

    PR for #14

    You shouldn't accept this PR as is, I wanted to show two different options and discuss about which version would be better.

    In obs_websocket.gd I added a new if conditional if json_response.has("error") in the _on_data_received function.

    You could just send a generic signal with the error and let the client handle it, or you could make a huge match statement with common errors if you want to handle it yourself.

    As it is now, the obs_websocket.gd is sending a generic error and the "client" obs_ui.gd is handling what to do with that information.

  • Plans on updating for obs-websockets 5?

    Plans on updating for obs-websockets 5?

    Found out today that obs-websocket 5 is going to break backward compatibility. See the Important Notice! section.

    https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md

  • Error after connecting and refreshing data

    Error after connecting and refreshing data

    SCRIPT ERROR: Invalid get index 'scenes' (on base: 'Dictionary')

    The app halts in the debugger at obs_websocket:198 (if you hit continue it works)

    The plugin shows this error in the console but does not halt.

  • Initially connecting to the obs websocket is odd

    Initially connecting to the obs websocket is odd

    When I start the app it looks like it is connected from the messages in the output window, but the periodic info messages are not displaying so I think it isn't. To "reset" this you have to connect then disconnect then connect again.

  • User is not informed if connection is not established.

    User is not informed if connection is not established.

    If you type your password in wrong, the user is not informed that there is an error nor does the "Connect" button change states.

    In obs_websocket.gd we're calling establish_connection already. Currently we're only checking if it connects to the URL and _authenticate is getting information about the error ({error:Authentication Failed., message-id:3, status:error})

    Websockets aren't something I'm super familiar with, so I'll play around with this for a bit, but I'm not 100% sure on how to approach this problem. Maybe handle it in _on_data_received and emit an error signal?

  • Fixed Starting and Stopping Records/Streams by checking for explict update-type.

    Fixed Starting and Stopping Records/Streams by checking for explict update-type.

    PR for #12

    Also removed unneeded lines from _on_record_pressed()

    Previously, the if condition wasn't being met and an inexplicit else was resetting is_recording back to false.

    I decided to use match to read obs_data and only change states when needed.

    I also removed some lines in _on_record_pressed as they won't be needed since _on_obs_updated updates the state and text anyway.

    It would probably be best to change the SceneItemVisibilityChanged and TransitionEnd to a match as well, but I am not currently switching scenes in my project so I haven't tested those yet.

  • initial data refresh often/usually missed

    initial data refresh often/usually missed

    When the plugin attacheds to OBS it kicks off a data refresh, but this response is often. if not usually, missed becuse another packet came in before the response, this cleared the waiting_for_packet flag so the plugin doesn't process the data packet.

  • Source enable/disable acts odd

    Source enable/disable acts odd

    When you click on the switch by the source to enable/disable, it puts a Render swith in a panel above the scenes. From there you can switch the source on and off. Also clicking on a source causes the switch states to change on all. it seems like clicking on the source panel is treating all the sources like a radio button group instead of a multi-select (maybe a copy/paste error from the scene list, because that is the way the scenes are supposed to work? However, it isn't the switch shown in the source's list item that controls it. The button labeled Render that appears at the top does that, but noither is showing an accurate state initially.

  • Issue to reconnect if disconnected

    Issue to reconnect if disconnected

    Hi! Thanks for the great addon! I am already using it to great effect :) I've noticed there is a bug if I connect to obs, disconnect and tries to reconnect it fails. This line is the problem: https://github.com/you-win/obs-websocket-gd/blob/748f844d2589e04ff06b5ad99d9d32dadd41abe7/addons/obs_websocket_gd/obs_websocket.gd#L182 since the counter goes up and is not 1 anymore after that. I've solved it locally in a hacky way and thought might as well report this.

Monitoring Go application inside docker container by InfluxDB, Telegraf, Grafana
Monitoring Go application inside docker container by InfluxDB, Telegraf, Grafana

REST API for TreatField app Docker compose for TIG and Golang simple app: https://github.com/tochytskyi/treatfield-api/blob/main/docker-compose.yml Gr

Nov 6, 2021
Control external Fan to cool down your raspi cluster
Control external Fan to cool down your raspi cluster

Fan control for Raspberry Pi This is a small project that I build in order to cool down my raspi home cluster The case I use have some external fans t

Dec 11, 2021
Configuration agent for BFE control plane

conf-agent conf-agent 说明 conf-agent 从 api-server 获取最新的配置并触发bfe热加载。 获取方式 获取 conf-agent 工具。获取 conf-agent 有多种方式: 在 releases 页面下载对应平台的可执行文件 通过 go get 工具本地

Oct 28, 2022
Joy2Mouse is a program that allows you to control your computer mouse with a joystick.
Joy2Mouse is a program that allows you to control your computer mouse with a joystick.

Joy2Mouse Joy2Mouse is a program that allows you to control your computer mouse with a joystick. Features Control your mouse with a joystick Mouse dow

Dec 26, 2021
Sa818 - Sa818 UHF/VHF walkie talkie module control library for golang
Sa818 - Sa818 UHF/VHF walkie talkie module control library for golang

SA818 golang library for serial control This library written in Go programming l

Jan 23, 2022
Control QEMU like magic!
Control QEMU like magic!

Qemantra Qemantra is a command-line tool for creating and managing QEMU Virtual Machines. QEMU is better and sometimes faster than VirtualBox , but do

Dec 26, 2022
Go library for hardware I/O control, in the programming style of Arduino

hwio Introduction hwio is a Go library for interfacing with hardware I/O, particularly on SoC-based boards such as BeagleBone Black, Raspberry Pi and

Dec 9, 2022
Wordle - Wordle game in Go
Wordle - Wordle game in Go

wordle wordle game in Go rules - You have 5 guesses - You can only guess using 5

Feb 26, 2022
Supply chain management indie game... IN SPACE!
Supply chain management indie game... IN SPACE!

Ship shape Supply chain management indie game ... IN SPACE! Current state is preliminary - there's a six-level tutorial, about an hour's worth of game

Nov 3, 2022
This is a simple chat app which shows how to use Go with Hotwire.
This is a simple chat app which shows how to use Go with Hotwire.

chat-hotwire-go This is a simple chat app which shows how to use Go with Hotwire. Messages from another user are received via Turbo Streams over a web

Jul 2, 2022
PTT APP 的後端

PTT APP 後端 這個專案主要的開發語言是 Golang 以及中文。 原有的 PTT 程式碼是透過C語言進行開發的, 然而C語言開發的程式碼雖然效能高,但是可維護性稍低,以致於後續接手維護不易。

Dec 28, 2022
Corona App for Ubuntu Touch

Corona App Digitaler Impfausweis Luca - check in Corona Warn App

Nov 14, 2021
Coding assessment to create Todo app given by Percipia

Coding assessment to create Todo app given by Percipia

Oct 20, 2021
Backend for Ribbit, Broker API Reference App
Backend for Ribbit, Broker API Reference App

Ribbit Reference Implementation (Backend) The reference implementation for the backend of a broker-dealer trading application with the Alpaca Broker A

Dec 5, 2022
It is a basic todo app which has CRUD operation using Buffalo and golang

It is a basic todo app which has CRUD operation using Buffalo and golang

Nov 1, 2021
Dolphinsay app written in Go.

DolphinSay About Welcome in DolphinSay! DolphinSay is inspired by Cowsay program. DolphinSay allow you to display a message said by a cute random Dolp

Nov 3, 2021
Minimal example app of hexagonal architecture in go

Hexagonal Architecture Minimal example of hexagonal architecture (ports & adapters) in go. Resources T

Nov 5, 2021
Example app using labstack/echo and ozzo-validator.

Example app using labstack/echo and ozzo-validator.

Oct 17, 2022
Package buildinfo provides basic building blocks and instructions to easily add build and release information to your app.
Package buildinfo provides basic building blocks and instructions to easily add build and release information to your app.

Package buildinfo provides basic building blocks and instructions to easily add build and release information to your app. This is done by replacing variables in main during build with ldflags.

Nov 14, 2021