vrchat-community / osc

Files and Info on using OSC to communicate with VRChat
MIT License
234 stars 4 forks source link

Allow Limited Arrays #44

Open Nifty255 opened 2 years ago

Nifty255 commented 2 years ago

What's the idea? Allow VRChat to receive limited types of arrays, validating to prevent shenanigans where appropriate. For example:

/avatar/parameters/xy/TailWag would auto-inflate to the avatar params TailWagX and TailWagY. /avatar/parameters/n/core would auto-inflate to the avatar params core0, core1, core2, etc. up to a limit.

Is there another way? Currently, to fill my avatar's 8 CPU core params, I have to separately send 8 floats as ...ms/core0, ...ms/core1, so on.

Additional context See below for how I have to loop and separately send each CPU core's floats to my avatar.

momo-the-monster commented 2 years ago

Neat approach! OSC can technically support arrays of any size (and event mixing arg types in the same message) but we need to know the expected argument number and type for our case for performance reasons. I like your solves here, and I'll do some thinking about how we could support this in the config file (and eventually some kind of in-client GUI).

Nifty255 commented 2 years ago

For /xy/paramPrefix you could safely assume length of 2 and throw/debug log for shorter arrays. For /n/paramPrefix, you could require the very first element be an extra int for the length and similarly throw/debug log.

This'd allow you to be performant with properly formed arrays, and badly formed data would only lag the single affected user. I suppose that could still be a problem if they got the malsending OSC driver from someone else and they can't fix the issue. Perhaps stop processing for that param and fire some sort of notification if possible? That's the best I could think of without knowing the system.

brandonvdongen commented 2 years ago

Personally I'd advice against this or at least in this particular format as Unity internally uses / for sorting an categorizing of parameters. for example if you name your parameter example/sub1/sub2 it will be folderized as example > sub1 > sub2 in the parameter menu. myself and mother others i know frequently use this for sorting purposes. and this could potentially cause some issues depending on the naming used.

an example of this behaviour. Categorized Parameters

Nifty255 commented 2 years ago

I imagined this: /avatar/parameters/xy/Tail -> TailX and TailY

Rather than this: /avatar/parameters/xy/Tail -> xy/Tail

The OSC system would auto-translate the correct slashes away and simply append caps X and Y to whatever is left.