opl- / beatsaber-http-status

Live game status over web sockets.
MIT License
105 stars 36 forks source link

[Feature Request] Get player's current HP #4

Open SplitPixl opened 5 years ago

SplitPixl commented 5 years ago

Like explained in the title, provide HP as part of the performance object

heborras commented 4 years ago

Any news on this? I am planning to create a light animation, similar to the Hue animation, but in such a way that people outside can better understand in what state the player is at the moment. For this the current player HP is super important since it is the main indicator of how good the player is doing.

opl- commented 4 years ago

Not really. I tried implementing this once with Harmony, but due to what I believed to be code inlining my hooks just wouldn't work, so the state could not be reliably updated on time. I could check if I still have that branch, but at this point I think it's going to be several versions behind.

Admittedly I haven't put much energy into this project recently, mainly because I don't have easy access to the game. If you want to try your hand at getting that data you can check the notes I left on #5.

TL;DR version is that there were a lot of weird edge cases and potential race conditions (even though in theory delegates should call listeners in order, it's not guaranteed) that needed to be considered for the sake of keeping the data consistent and since my hooks weren't working I couldn't achieve that.

This could be solved with MonoMod patching, but unfortunately the Beat Saber community has settled on using runtime patching with Harmony and I didn't want this mod to be difficult to install.

EmilMalanczak commented 2 years ago

Is there a possibility of merging #5 or adding that feature? @opl-

I'm working on beat saber overlay generator - repo

Currently, I want to create HP bar element but I miss energy data 😕

rynan4818 commented 2 years ago

I, too, have made a pull request for this feature before, but gave up because I could not solve the problem of inconsistent energy values. https://github.com/opl-/beatsaber-http-status/pull/57

Please refer to the event information obtained from http-status as it is possible to estimate the current energy value on the overlay side. The following code is working fine. https://github.com/rynan4818/beat-saber-overlay/blob/ddfc3c20f7123e8dd2e434d7fb77c2d25d2b52c7/js/ui.js#L13-L107

However, since chain notes will be added in BeatSaber 1.20, the decrease in energy value when a mistake is made in chain notes will be different from normal and will need to be modified. Also, to do so, http-status, which is compatible with 1.20, needs to send information that ChainNotes can determine.

EmilMalanczak commented 2 years ago

thank u a lot for sharing a link to working code 🤩

I'm aware of upcoming 1.20 version but since http-status seems to be maintained I dont have to care that much - I'll be adding support for other data mod providers. I'll also add a version checker per element to not break anything :P