SceneSwitcher icon indicating copy to clipboard operation
SceneSwitcher copied to clipboard

Send macro data over network to OBS on another PC?

Open GOINGCRAZYWITHIT opened this issue 8 months ago • 4 comments

Background

I've been working towards a 2 PC streaming setup for a bit now, and the final thing that would take a huge load off my gaming PC is being able to send only a game capture to my streaming PC, but as of now, I'm not aware of a way to also send macro data for which games are open and focused, which I use for changing positions of sources for each game, changing Twitch category, and the reason I can't use use a barebones OBS with a single game capture and the plugin already, using the current focused game as a way to change a game capture source to that game. There is the "capture any fullscreen application" mode inside of game capture for this, but in my experience, it's unrealiable and slow, and more importantly, it doesn't switch games if I simply tab out of one and into another. I also do the same thing but with a window capture for games like Roblox or Destiny.

Solution

A separate option inside of the plugin to send select data to another instance of OBS on the network that is also running the plugin. Further selection of what you would like to send, for example ticking certain macros on or off might be beneficial to some.

Alternatives

I can kind of imagine changing contents of a .txt file on a network drive, and possibly doing something with that inside of the plugin in each OBS, but I don't know if that would work.

Anything else we should know?

Love the seemingly endless work being put into this plugin.

GOINGCRAZYWITHIT avatar May 01 '25 05:05 GOINGCRAZYWITHIT

I think sending websocket messages between the two OBS / plugin instances would be a good fit. You can find more information here: https://github.com/WarmUpTill/SceneSwitcher/actions/runs/14752124189

The sending side might look like this:

Image

And the receiving side might setup macros similar to this:

Image

I hope that helps! Let me know if you have questions!

WarmUpTill avatar May 01 '25 10:05 WarmUpTill

Sorry I didn't see your reply until now, thank you for responding so quickly! This method will absolutely work and I already have setup and tested the websocket stuff and it was painless. However, I have ran into an issue with the use of .* when looking for window name.

Unless I want to turn off the "only on condition change" setting and have the macro constantly checking the title of what is focsued, I don't think this method is going to work. I'm sure the resource use of a single macro being updated nonstop on both PCs is almost 0, and that whatever impact sending so many websocket messages has is also essentially 0, but is there a way maybe, to put a list of window names I want to look for, and use regular expression to spark the macro when I tab into a game who's name is in the list?

If this is possible, I could have less conditions and macros than the method I am currently using, which would be great. Though, if I want to do the same thing where I put a list instead of one name for finding out if none of the games in the list are running, I believe I would have to use the Process condition? I would prefer to use that over Window for everything, but as you have used the Window condition over the Process one in your example, I assume there is a reason, possibly less resources used?

To be clear, I'm asking: 1. Can I put a list instead of a single process/title. Something like aces.exe, osu!.exe, cod.exe / War Thunder, osu!, Call of Duty​®​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. I tried those examples and had no luck. I have no idea what I'm doing, but I also tried some regular expression stuff to no avail. 2. If 1 isn't currently a feature, and there's no plans for it to be added, is there any other way I can achieve a "list" of sorts in a single text field in the Process or Window condition? 3. If the one with the higher resource usage is even significant enough to ever notice, which condition is more resource intensive, Process or Window?

I misclicked the close button my bad 😭

GOINGCRAZYWITHIT avatar May 08 '25 12:05 GOINGCRAZYWITHIT

  1. Can I put a list instead of a single process/title. Something like aces.exe, osu!.exe, cod.exe / War Thunder, osu!, Call of Duty​®​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. I tried those examples and had no luck. I have no idea what I'm doing, but I also tried some regular expression stuff to no avail.

A regular expression which matches either of the words War Thunder, osu! or Call of Duty​®​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ would look like this: (War Thunder)|(osu!)|(Call of Duty​®)

  1. If 1 isn't currently a feature, and there's no plans for it to be added, is there any other way I can achieve a "list" of sorts in a single text field in the Process or Window condition?

The Window and Process condition types also support regular expressions: Image

  1. If the one with the higher resource usage is even significant enough to ever notice, which condition is more resource intensive, Process or Window?

This depends on the number of windows and number of processes. In general the window condition checks per window might be slightly more expensive than the process checks per process. But both of them should usually not be very resource intensive.

Unless I want to turn off the "only on condition change" setting and have the macro constantly checking the title of what is focsued

You could use variables to work around this limitation:

Image

Image

I misclicked the close button my bad 😭

No worries :)

WarmUpTill avatar May 08 '25 19:05 WarmUpTill

Thank you for reopening :)

Since my response I looked up some regular expression stuff, painfully sifted through posts for hours because I'm bad at googling, and then unironically asked grok for help and ended up with something like the example you gave. I went the process route, which I am shocked to find out is the probably less intensive way to go about this, and am using ^(aces.exe|osu!.exe|cod.exe)$, but with many more games.

Going the regular expression route has allowed me to keep actions only on condition change ticked, and like I thought, remove multiple macros checking if each game is open or focused. I appreciate you for your help and amazing plugin! I don't want to take any more of your time, and this issue is unrelated to the OP at this point, feel free to just call this done if you want.

I have setup nearly everything to work with websocket, but in my infinite wisdom, I've arrived in a situation with more macros than I wanted for something, though I'm not sure there's any way around it. I have some macros on in one OBS that send a message to the other OBS of, lets say A for the main actions, and then B, and in the receiving OBS, I would like do have it setup similarly where it does 1 for A and in the else actions, for B, it does 2, but because the buffer is either cleared or will be replaced by something else, the single macro on the receiving OBS can't do the job.

Because of this, I need one macro for "if A do 1" and another for "if B do 2" in the receiving OBS whenever I do a single macro with a websocket message in both the main and else sections of the macro in the receiving OBS. Am I correct that this is the smallest way to accomplish what I'm trying to do? The only other thing I could think of us multiple websocket connections between the two OBS, which I assume will work, but that would be 5 more connections, which I think is worse than double the macros in the receiving OBS when I need to make macros like this.

Thanks again!!

GOINGCRAZYWITHIT avatar May 09 '25 17:05 GOINGCRAZYWITHIT