Page 2 of 2

Re: [0.2b BETA] TwitchyDoom - Streamer interaction!

PostPosted: Fri Apr 23, 2021 2:03 pm
by kevansevans
Cutmanmike wrote:Now if only there was a way to write data to a file to be read by another program...


Maybe setting a bunch of cvars? Not the most elegant solution, but strings are values that can be set and stored! The hurdle would be making an interpreter that can navigate the gzdoom.ini file. Getting proper support of writing data would definitely get shot down quickly for fear of people shipping mods with malicious code.

Re: [0.2c BETA] TwitchyDoom - Streamer interaction!

PostPosted: Fri Apr 23, 2021 2:20 pm
by Cutmanmike
I don't think cvars are actually written to the ini until the game closes

Re: [0.3 BETA] TwitchyDoom - Streamer interaction!

PostPosted: Fri Apr 30, 2021 4:48 pm
by Undead Zeratul
Well this will be fun once I can get it all set up...

I noticed it's leveraging Streamlabs' older Chatbot instead of Cloudbot, which doesn't seem to behave them same way (I assume because Cloudbot doesn't have access to your local files). This should work as long as the file is appended, right? I'm thinking of leveraging a bit of software called Touch Portal to do the file I/O that can be kicked off via events from Twitch such as chat messages or (what I intend to try) channel point redemptions.

I've been successful with getting the file updated but it doesn't seem to react in-game. Any suggestions how to proceed?

Edit: Well hey! I think I actually got something working while dicking around with it tonight... it took some messing around to understand how it's working, but I can redeem channel points and summon a squad of 4 random marine allies, hook into when I get raided and mass resurrect everything as well as summon 32 random former humans... I like this

Re: [0.3 BETA] TwitchyDoom - Streamer interaction!

PostPosted: Sat May 01, 2021 3:46 am
by Cutmanmike
Any extra information you can give me about setting up cloudbot or any other bots would be appreciated as my bot + twitch streamer knowledge is limited and I want to make it as accessible as possible.

Re: [0.3 BETA] TwitchyDoom - Streamer interaction!

PostPosted: Sat May 01, 2021 8:30 am
by Undead Zeratul
Oh, sure!

The way I'm going with it doesn't use chat commands, but rather the 1st party Channel Points Twitch has set up, as I already integrated them with a few things in OBS and want to continue leveraging them. My solution involves a third party software called Touch Portal which acts as a Stream Deck, but can also hook into various events from Twitch once you connect it.

Essentially, Touch Portal's actions include a set of FileSystem I/O interactions, which itself includes appending to an existing file. So I just added an action to open the STREAM.txt file and append a "SpawnItem|Actor=HealthBonus,Effect=ItemFog|$twitch_last_channel_point_redeemer|$twitch_last_channel_point_message" (along with a newline). From there, I just add a button to my Stream Deck (my phone running the mobile app) and when I hit the button, the item gets spawned. I still have to test the channel point redemption live, but since I have infinite points, I can test it through OBS locally and it does seem to work as well. It's worth noting that Touch Portal DOES hook into chat messages so you could use it to make a chatbot, but I just chose not to go that route.

The thing I had to mess with and understand better was the fact that the number of lines in the file matters and can't be cleared out during gameplay, but once the game exits the file can be wiped just fine. I'm hoping to figure out how to automate that, as I'd rather not have that file grow potentially indefinitely without intervention.

Because the items spawn out of Line of Sight, it's sometimes hard to find the item (noclipping helps) and I've noticed it sometimes doesn't seem to fire at all? It's probably something on my end (I'm doing some more complex stuff with randomized logic and whatnot in Touch Portal so I'm not surprised).

I'm hoping to get hosts to spawn a friendly marine with a random weapon, raids to mass resurrect and summon a horde of former humans, among other stuff going this route.

Was there something in particular you were curious about, or did I answer your question? I can get some screenshots once I confirm all my stuff works live if that helps?

Re: [0.3 BETA] TwitchyDoom - Streamer interaction!

PostPosted: Sat May 01, 2021 11:39 am
by Cutmanmike
Undead Zeratul wrote:Because the items spawn out of Line of Sight, it's sometimes hard to find the item (noclipping helps) and I've noticed it sometimes doesn't seem to fire at all? It's probably something on my end (I'm doing some more complex stuff with randomized logic and whatnot in Touch Portal so I'm not surprised).


You could try the NoLOS=true parameter so they can spawn in line of sight, but they will still appear at a random spot. I'm also adding an optional parameter to show the item on the automap. Failing that, you could just use the GiveItem command instead to give it directly to the player.

Undead Zeratul wrote:Was there something in particular you were curious about, or did I answer your question? I can get some screenshots once I confirm all my stuff works live if that helps?


That's probably enough for me to try out at some point, thanks.

Re: [0.3 BETA] TwitchyDoom - Streamer interaction!

PostPosted: Sun May 02, 2021 12:58 am
by Captain J
Never thought of making Doom Twitch-friendly and can be possible. This is very clever and surprising! But i do wonder if anyone tried this in Multiplayer aka Co-op Stream. Did they? It surely doesn't work on Zandronum though.

Re: [0.3 BETA] TwitchyDoom - Streamer interaction!

PostPosted: Sun May 02, 2021 3:39 am
by Cutmanmike
I haven't tested it but it should work.

I've updated to 0.4 which improves the random spawning of actors and adds some extra parameters such as showing the actors on the automap. There's also some basic settings in the option menus now too.

Re: [0.4 BETA] TwitchyDoom - Streamer interaction!

PostPosted: Sun May 02, 2021 8:06 am
by Netheritor
I have a few ideas;

1. Give the ally monsters movement state. I know there is one where the ally don't teleport to player and teleport to player. Can you add the guard variant? Like monster as a sentry to allies and enemies alike? The monster in this state can be walk-through.

2. Is there nothing else for viewers to gain points except by watch time? Maybe make the points increase if streamer defeating monster?

3. Can you edit the title to include "twitch integrated / integration" or something like that? Just because I want this mod easily found in google search with those keywords.

Edit: One more question; Can this work with Zandronum?

Re: [0.2b BETA] TwitchyDoom - Streamer interaction!

PostPosted: Mon May 03, 2021 5:07 am
by Rachael
kevansevans wrote:
Cutmanmike wrote:Now if only there was a way to write data to a file to be read by another program...


Maybe setting a bunch of cvars? Not the most elegant solution, but strings are values that can be set and stored! The hurdle would be making an interpreter that can navigate the gzdoom.ini file. Getting proper support of writing data would definitely get shot down quickly for fear of people shipping mods with malicious code.

Cutmanmike wrote:I don't think cvars are actually written to the ini until the game closes

Cutmanmike is right.

However, you can use a program to parse out GZDoom's cvar data directly from memory and write to a file that way, but that's a bit advanced. ;) (Something simpler might be to inject a DLL that forces the 'writeini' command to happen frequently, but that is wasteful far from ideal...)

Another thing you can do is enable logging. As far as I know logs are flushed after every print, so it should be possible to use a program to grab hints from the program with another program using the log file. (They will, however, show on the screen)

Anyway...

I think it's important to put out a word of caution on this. This *IS* exploiting a kind of unintended/undocumented feature in GZDoom. I have no plans to break it (don't worry, you can all breathe a sigh of relief) and it's fairly harmless so there isn't any need to worry about this getting a dev's attention.

However - that does not immediately dismiss this little important caveat that must be said ...

As you all well know, refactorings can and do happen often in GZDoom. Because of the way this mod works where it exploits GZDoom not using any sort of stored in memory version of the file, this mod doesn't and never will have a promise of tomorrow. It's an interesting mod - it's not likely to break anytime soon - but keep in mind - it could, and without warning.

That is ultimately the unfortunate price to pay of all unintended/undocumented features. Like I said, I don't have any plans to break this and I don't see any reason to - but that little caveat applies to all programs, not just GZDoom. When you're using unintended features, you are on your own.

Re: [0.2b BETA] TwitchyDoom - Streamer interaction!

PostPosted: Mon May 03, 2021 6:08 am
by Cutmanmike
Rachael wrote:That is ultimately the unfortunate price to pay of all unintended/undocumented features. Like I said, I don't have any plans to break this and I don't see any reason to - but that little caveat applies to all programs, not just GZDoom. When you're using unintended features, you are on your own.


Not the end of the world if does get broken down the line, for me anyway. The scope of the mod is pretty small compared to what you could be doing with ReadLump and other third party programs. The person who is planning server MMO features is the one that needs to be warned ;)

Also users could always stick to an older GZDoom if they want to use this in a worse case scenario.

Netheritor wrote:1. Give the ally monsters movement state. I know there is one where the ally don't teleport to player and teleport to player. Can you add the guard variant? Like monster as a sentry to allies and enemies alike? The monster in this state can be walk-through.


This is outside the scope of this mod. You'll have to create your own actors in decorate/zscript to handle this.

Netheritor wrote:2. Is there nothing else for viewers to gain points except by watch time? Maybe make the points increase if streamer defeating monster?


You can use whatever points system your stream bot software is capable of, but reading game data back into said software (i.e when a monster is killed) is tricky/not feasible (see the discussion about writing to cvars).

Netheritor wrote:Edit: One more question; Can this work with Zandronum?


Not without a modified Zandronum client or some other hack. And even then it would be hard to get the same features. Ask anyone who has tried to make names appear above player's heads using only DECORATE and ACS :blergh: