DenchiSoft / VTubeStudio

VTube Studio API Development Page
MIT License
830 stars 77 forks source link

Feature: feed in data for any default or custom parameter with a "lock" label #12

Closed HHHHhgqcdxhg closed 2 years ago

HHHHhgqcdxhg commented 2 years ago

You have to re-send data for a parameter you want to control with your plugin at least once every second. Failure to do so will result in the parameter being considered "lost" and it will go back to the value of whatever was controlling it before.

I think this design is not elegant. I prefer a "lock" label with type boolean in the request, such as:

{
    "apiName": "VTubeStudioPublicAPI",
    "apiVersion": "1.0",
    "requestID": "SomeID",
    "messageType": "InjectParameterDataRequest",
    "data": {
        "parameterValues": [
            {
                "id": "FaceAngleX",
                "value": 12.31
            },
            {
                "id": "MyNewParamName",
                "weight": 0.8,
                "value": 0.7,
                                "lock": true
            }
        ]
    }
}

Some times, i want to change the clothes of my model for some minutes, then i have to send ws requests to VTS in a loop with a intervial of 500 ms. But, this is not enough. I tested this method, there is a serious problem: the ws sometimes have a delay more than 1 second, which i think caused by the VTS plugins server. This means, I cannot keep my parameter value, it sometimes would blink to its default value!!!

Thinking the charactor Pio in the game "Poison Maker", she has toooooooo much clothes, and if she want to be a vtuber, she may need a plugin to help her choose a cloth. Then i have a need like this, help, please!

DenchiSoft commented 2 years ago

There should be no delay. Requests/Responses to the VTube Studio API should be near-instant and if they aren't, that's likely a bug. You should be able to easily send in data at 60+ FPS for multiple parameters without any performance degradation or lag.

In any case, please bring up this issue in the VTube Studio Discord: https://discord.gg/VTubeStudio

The design of having to re-send data is based is intentional. It allows plugins to just stop sending data and have other tracking sources or plugins take over seamlessly without any explicit "unlock" messages. I'm unlikely to change it at this point unless there's a very good reason to do so.

A 1 second response lag is of course unacceptable. Do you have any logs from VTS? That might give us a clue about what's happening.