TeamRizu / OutFox

The Bug Reporting Repository for OutFox LTS 0.4, Alpha V and Steam Early Access Builds
https://projectoutfox.com
Apache License 2.0
187 stars 3 forks source link

[Feature Request] API #638

Open barbeque-squared opened 1 year ago

barbeque-squared commented 1 year ago

Please Select the game mode your feature request is about.

All Game Modes


Is your feature request related to a problem?

I would like programmatically get live information out of OutFox. Some of my current usecases (currently limited to karaoke in UltraStar Deluxe, but they easily apply to all game modes):

The first three are must-have's for me. See "Additional context" for more background on how exactly the third one is currently set up and why I'm not interested in having OutFox control my fixtures directly. The last one can be ignored for the time being, since it needs much more data compared to the other ones, and isn't really a priority the immediate future anyway.


Describe the solution you'd like

I'd like some kind of plugin/API system. Note: I use "plugin" not in the sense as "it adds functionality to OutFox itself" but more "this is the way of getting live data out of OutFox so I can use it as input to MyCustomAwesomeScriptOrProgram". Feel free to use a different term if that covers this better.

plugin loading/registering/hooks

Personally, my usecase is this: is whatever fifo/file that this plugin is going to output to present? If yes, then 'subscribe' to something that just gets called for every drawn frame. I can do my own frame limiting. The fifo/file gets created by the receiving script/program, and if it isn't present, it makes no sense for the plugin to do anything either.

API functions available to plugins

If you're going for the "every single frame" approach, plugins should at least be able to get the following things:

You'll have to figure out what you want to do if someone calls an API function that doesn't make any sense at that particular moment, like "give me the artist" while in the game settings. They shouldn't really be called at such a moment anyway, but null or empty string is a thing. Personally I'm fine with either as long as it's consistent.

nice to have's

Although not strictly OutFox-related, if the scripting environment is really limited (IIRC in USDX you can't import anything, and it's not the full Lua either), please provide some convenience functions for object-to-single-line-string for the most used things, like json and XML. Anything that can be easily piped into something else, basically.

future thoughts

It's possible that in the future you also want to update player names or even start entire songs from a plugin. I don't need any of this right now (if ever), but don't tailor the API for reads only if maybe you want to eventually do writes.


Describe alternatives you've considered

The convencience (to a plugin author) that the first two add is near insignificant, while (massively) increasing OutFox maintenance. And the third is just nope in terms of performance.


Additional context

Attached are two plugins I wrote and use in UltraStar Deluxe. Both append single-line json's to a file, which in turn gets tailed by some external script. USDX's Display.Draw hook runs on every single frame, hence there's also some logic to not actually do stuff every single frame. A lot of my inspiration for this feature request came from there.

ultrastardx-plugins.zip

Usecase: controlling light fixtures

As requested on Discord, here is a brief overview of how I currently control my light fixtures.

Preparation QLC+ controls my light fixtures. For some songs (matched based on artist/title/position coming from USDX), I've created a bunch of directives that basically translate to "if song x - y is playing, at beat z press this button in QLC+".

The Plugin Literally all the plugin does is sending the artist+title when the song starts, continually outputs the current beat while playing, and sends when it has ended (or forfeited, or whatever). It outputs this information to a file that 'happens' to be created by The Script.

The Script The Script is a fugly bash script, which (highly simplified):

The Real World The big advantage is that I'm always able to manually override what the lights are doing. Temporarily disabling entire effects is also very easy (not every convention likes stroboscopes). And of course, it's not USDX-specific. With manual control I can also use it with any music, or YouTube video, or even Discord calls.

Although my primary interest is karaoke, the API functionality itself can be tested on probably any game mode. I don't mind helping to test this, in fact it's in my own interest to do so, because there's little incentive for me to switch to OutFox if I can't do this. I am in the Discord.


EDIT: added some horizontal lines to make the sections clearer