Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Manager - Miss, Bad Cut, Multiplier Down, Left Slice/Collision, Right Slice/Collision #144

Closed
Xentha opened this issue Dec 28, 2022 · 14 comments
Assignees
Labels
enhancement New feature or request

Comments

@Xentha
Copy link

Xentha commented Dec 28, 2022

[Problem]

  • Combo Break does not trigger without at least a 1 hit combo, requiring extraneous events and conditions to track multiple misses.
  • Only Combo Break can indicate a lost multiplier, requiring multiple checks and failsafes to determine current multiplier.
  • Current Slice and contact events do not distinguish between left and right hits, and has no apparent workaround.

[How it is a Solution]

  • On Miss and On Bad Cut events would allow receiving input when you miss more than one note in a row.
  • On Multiplier Down would allow for more direct tracking of multiplier transitions, and streamline determining max multiplier.
  • Left and right slice distinction would allow for avatar effects that are appropriate to the relevant half of the avatar or saber colors, such as wrist bands that flash when their respective saber hits a note. Combined with 'On Bad Cut' would even prevent false reads or allow for behavior specific to a bad cut on that saber.

[Additional Context]
On Level Start does not seem to activate animator trigger parameters, requiring the workaround that led me to start trying to track multiplier for creative purposes, and to find this made difficult by the lack of these requested events.

@Xentha Xentha added the enhancement New feature or request label Dec 28, 2022
@nicoco007
Copy link
Owner

These are very good points and suggestions!

On Miss and On Bad Cut events would allow receiving input when you miss more than one note in a row.

I'm not sure exactly what you mean here. Should these events pass the number of consecutively missed notes?

On Multiplier Down would allow for more direct tracking of multiplier transitions, and streamline determining max multiplier.

Would it make sense to instead have an OnMultiplierChanged similar to the OnComboChanged event that passes the current multiplier?

Left and right slice distinction would allow for avatar effects that are appropriate to the relevant half of the avatar or saber colors, such as wrist bands that flash when their respective saber hits a note. Combined with 'On Bad Cut' would even prevent false reads or allow for behavior specific to a bad cut on that saber.

Makes sense. I'll add this.

On Level Start does not seem to activate animator trigger parameters, requiring the workaround that led me to start trying to track multiplier for creative purposes, and to find this made difficult by the lack of these requested events.

I know the OnLevelStart event can be troublesome – I believe it might be triggered too early for certain things like animator parameters to work properly. I'll make sure to look into this.

@Xentha
Copy link
Author

Xentha commented Jan 23, 2023

Oh! I hadn't realized you replied! Glad I decided to check in.

I'm not sure exactly what you mean here. Should these events pass the number of consecutively missed notes?

So for On Miss and On Bad Cut, it would just trigger once for each note missed or bad cut, as opposed to combo break which only triggers when you break a combo of at least 1. Missing/badcutting on 0 combo does not trigger this event again.
Having miss and bad cut be separate would also allow for unique interactions. But if they can't be distinguished between in the code, one event for both would be sufficient.

Would it make sense to instead have an OnMultiplierChanged similar to the OnComboChanged event that passes the current multiplier?

Is there an On Combo Changed? I don't recall seeing that in the events. - On Multiplier Changed would technically work, but it would require a tandem with hit or miss events in order to determine if the multiplier went up or down. Since OnMultiplierUp already exists, I figure it would be easiest to just add a counterpart for Down.

I know the OnLevelStart event can be troublesome – I believe it might be triggered too early for certain things like animator parameters to work properly. I'll make sure to look into this.

I see! Much appreciated.

I should perhaps also mention that OnMenuEnter has the unexpected behavior of only triggering when transitioning between menu environments, such as going from song select to the Counters+ config space, rather than when leaving a map.
Would you prefer I open a new issue specifically describing this so it's easier to keep track of?

@nicoco007
Copy link
Owner

So for On Miss and On Bad Cut, it would just trigger once for each note missed or bad cut, as opposed to combo break which only triggers when you break a combo of at least 1. Missing/badcutting on 0 combo does not trigger this event again.

Oh okay, that makes sense.

Having miss and bad cut be separate would also allow for unique interactions. But if they can't be distinguished between in the code, one event for both would be sufficient.

It's definitely possible to distinguish the two so I'll add those as separate events.

Is there an On Combo Changed? I don't recall seeing that in the events.

Looks like it's broken right now. My bad! That'll be fixed.

On Multiplier Changed would technically work, but it would require a tandem with hit or miss events in order to determine if the multiplier went up or down. Since OnMultiplierUp already exists, I figure it would be easiest to just add a counterpart for Down.

I see. I'll just add the "down" event then.

I should perhaps also mention that OnMenuEnter has the unexpected behavior of only triggering when transitioning between menu environments, such as going from song select to the Counters+ config space, rather than when leaving a map.
Would you prefer I open a new issue specifically describing this so it's easier to keep track of?

Thanks for letting me know! No need to create a new issue, I'll just add it to my list of things to do.

@nicoco007
Copy link
Owner

Alright, I think I've added/fixed everything we talked about here:

  • New bad cut, note missed, and multiplier down events
  • Fixed missing combo changed event
  • Left/right for good cut, bad cut, note miss, and saber collisions
  • Level Started should now run at the correct time (I've tested with animator triggers and it seems to be working properly)
  • Menu Entered now gets executed when returning from a song (note this still includes entering the menu when starting the game and coming back from the multiplayer environment - I can add also add a "return to menu from song" event if it makes sense)

Also a few other things that were changed:

  • Good cut, bad cut, and note missed now only trigger once for chain notes
  • Hitting bombs no longer counts as a good cut
  • Added Multiplayer Lobby Entered event

It's all available as of this build if you'd like to give it a try.

On a somewhat related note, do you think it'd be useful to have the combo and multiplier numbers be set as animator parameters? I haven't played around with animators a whole lot yet but I'm assuming this would be better than relying solely on triggers.

@Xentha
Copy link
Author

Xentha commented Feb 12, 2023

You're awesome! Thank you so much for your time and patience with all this. I'll absolutely give it a try, and perhaps even leave a link to a clip of some kind if I can get what I had in mind going well! (It'll probably be a Twitch clip.)

And, actually yeah, that could be pretty useful. Multiplier is pretty easy to keep track of with up/down events since there's only 4 tiers, but combo being able to go into the hundreds or even thousands makes it somewhat impractical to track manually. Though I do use 'Combo Reached Event' as a means to track which multiplier tier I'm at, as of my existing avatar iteration, which won't be necessary with these additions.

Edit: Regarding the returning from multiplayer environment, that could be good, given but not totally necessary, as it would be possible to simply have a parameter toggled on by 'enter multiplayer lobby', which could just as simply be checked upon triggering 'menu entered'. That's how my multiplier changed tracking functions, checking for a specific combo target parameter in conjunction with a multiplier up event parameter.

@Xentha
Copy link
Author

Xentha commented Feb 12, 2023

As of checking the new version in Unity, it seems there's a couple issues.

  • There still isn't a 'combo changed' but rather a "Combo Increased (Int32)", I don't know if this is intended. Though much like multiplier, Combo Increased and Combo Broken can be used in tandem to determine a 'change' just as well.
  • ComboReachedEvent, EventFilterBehavior and EveryNthComboFilter scripts seem to be missing. (First noticed because I was previously using Combo Reached.)
  • Combo Increased, Multiplier Increased and Multiplier Decreased have (Int 32) rather than just () in their event names, which appears to add a set of properties under 'dynamic int' into the function menus. While more or less inconsequential, it causes the animator sub-menu to be so large that it requires scrolling to reach 'SetTrigger (string)' which is what animator parameters primarily use.

I'll edit this post once I've had a chance to incorporate the new event structure to my avatar and test it. So far I have not encountered any issues that'll prevent me from refining my existing animator layout, and adding the new left/right saber stuff.

@nicoco007
Copy link
Owner

 There still isn't a 'combo changed' but rather a "Combo Increased (Int32)", I don't know if this is intended. Though much like multiplier, Combo Increased and Combo Broken can be used in tandem to determine a 'change' just as well.

Yeah, it turns out the "combo changed" event was only getting triggered when the combo increased so I just renamed it for clarity's sake. As you said, it and the broken event can be used together to figure out when the combo changes and I'd rather not have redundant events to reduce clutter so I'll leave it like that.

ComboReachedEvent, EventFilterBehavior and EveryNthComboFilter scripts seem to be missing. (First noticed because I was previously using Combo Reached.)

Oh sorry about that, it looks like I accidentally removed them from the editor DLL. They're back as of this build.

Combo Increased, Multiplier Increased and Multiplier Decreased have (Int 32) rather than just () in their event names, which appears to add a set of properties under 'dynamic int' into the function menus.

Yeah that's normal – those events pass the combo/multiplier as that Int32 parameter. The combo one is necessary for the event filter behaviours to work. The multiplier ones aren't used yet but they might be useful in the future.

@Xentha
Copy link
Author

Xentha commented Feb 13, 2023

Yeah, it turns out the "combo changed" event was only getting triggered when the combo increased so I just renamed it for clarity's sake. As you said, it and the broken event can be used together to figure out when the combo changes and I'd rather not have redundant events to reduce clutter so I'll leave it like that.

Ahh, makes sense. Right-o, that one's squared away then.

Oh sorry about that, it looks like I accidentally removed them from the editor DLL. They're back as of this build.

Glad I noticed! I am however going to hold off on picking up that build, as, as implied, I'm not in need of those scripts anymore, but also it seems there are further issues that may necessitate tweaking. [Detailed later in this response.]

Yeah that's normal – those events pass the combo/multiplier as that Int32 parameter. The combo one is necessary for the event filter behaviours to work. The multiplier ones aren't used yet but they might be useful in the future.

Ah! Fair enough. Luckily setting functions is a one-and-done thing, so it's no big deal.


Testing completed! Menu entered and map entered events now indeed work! So far the left/right hit differentiation also works perfectly, but only for good hits. Bad hits and misses are instead triggering the Menu Entered event it seems.
For context, I made stand-in saber hilts to be visible on my avatar instead of the actual sabers, for use in a first person + avatar side panel. By default, and when finishing/leaving a map, they are hidden, and on entering a map they become visible. So as such, due to this misplaced menu entered trigger, a miss or bad cut causes the relevant hand's hilt to hide instead of the intended animations.

EDIT: Pardon, this may be an issue on my end actually. Animations and animators are, not as intuitive in Unity as they really should be.

EDIT 2: I cannot seem to determine why good hits are working but bad/misses aren't, on my end. I had one hand working for a while and now it's not and I can't figure out how to get it working again. I even tried severing the connection to the state containing the hide animation and it still is having issues. I'm at a loss and I've run out my patience for the night.

@nicoco007
Copy link
Owner

Alright, I'm glad I'm not the only one who finds them confusing 😅

I'm pretty sure the bad cut/missed note events are working properly (I spent a while making sure left/right worked properly with the left handed setting) but I'll double-check on my end just in case.

@Xentha
Copy link
Author

Xentha commented Feb 13, 2023

Further testing seems to say that it was something to do with having Write Defaults enabled on the various animator states. I thought I had taken sufficient measures that such a thing shouldn't be a problem, but never the less, it seems disabling that on all animator states has solved the issue for now.

As far as I can tell, write defaults was taking whatever the first state activated and resetting to those values any time Bad/MIssed events were triggered, but not good cut. Which doesn't make much sense if ALL of the states were set to write default, meaning the last state active should have been what was applied, but it wasn't.

Update: Further testing has indeed confirmed that it was just 'Write Defaults' being enabled on Animator states preventing things from working correctly. Through various bits of tinkering with the animations themselves, I have a working system! My avatar elements now flash brighter on a hit on the relevant hand, red on a bad cut and grey on a miss. It would be a bit too much hastle to get a proper video, so instead here's a little clip of some desktop mode misses: https://i.gyazo.com/944ac26906c644b99678a5fd02f41a0b.gif

@Xentha
Copy link
Author

Xentha commented Feb 23, 2023

In case this post is still considered up in the air; beyond the usual Unity related animation shenanigans, the new additions and changes do seem to work perfectly!

I have discovered another potential bug though!
Custom Key Event doesn't seem to actually do anything. I mapped one to B and another to Y from the Oculus Trigger Button dropdowns, but nothing happens when I press those buttons. The animator itself functions correctly when I pre-enable the given parameter, but it doesn't receive the paramater activation from the event.
Could this be anything to do with me using Quest Pro controllers instead of the Quest 2 controllers that came with my Q2?

@nicoco007
Copy link
Owner

Okay good to know, thank you for trying it out!

I don't think CustomKeyEvent was ever part of the main Custom Avatars mod. Based on the wiki it was a separate mod. The latest one I could find has been archived but might still work.

Related to above, I do want to figure out a way to manually trigger animator stuff using your controller and make it an official part of the mod. Ideally it'd be similar to the action menu in VRChat but I haven't really looked into how that would work yet. Depending on how much effort is involved I might add something similar to CustomKeyEvents as a stop-gap solution.

@Xentha
Copy link
Author

Xentha commented Feb 24, 2023

I don't think CustomKeyEvent was ever part of the main Custom Avatars mod. Based on the wiki it was a separate mod. The latest one I could find has been archived but might still work.

Oh! I didn't even realize. I guess I grabbed it so long ago that it slipped my mind that it was from somewhere other than this mod. I shall try and see if it's just a version issue. Edit: Turns out I didn't realize that it had its own plugin to insert rather than just a Unity component. It works now. :)

Related to above, I do want to figure out a way to manually trigger animator stuff using your controller and make it an official part of the mod. Ideally it'd be similar to the action menu in VRChat but I haven't really looked into how that would work yet. Depending on how much effort is involved I might add something similar to CustomKeyEvents as a stop-gap solution.

That would awesome! I do prefer the idea of being able to just press a button to directly activate an expression, but an actual menu would be great for more elaborate things like color or outfit changes.

In relevance, I hope that you're still considering figuring out lipsync too! That's a huge part of avatar expression after all. It could be as simple as sending the volume value of the mic feed and letting people figure out how to apply that to an animator, until you figure something more complete that can recognize syllables and whatnot.

However that has its own Issue Post, so unless you would like to use this one as a means to track button event progress, perhaps we should call this one closed?

And with all that said, I want to express that I highly appreciate all the effort you've put into all this. As someone who has done a measure of coding in the past I understand how difficult and often frustrating it can be. I would offer monetary support if I could.

@nicoco007
Copy link
Owner

Turns out I didn't realize that it had its own plugin to insert rather than just a Unity component. It works now. :)

Glad you got it working!

I do prefer the idea of being able to just press a button to directly activate an expression, but an actual menu would be great for more elaborate things like color or outfit changes.

I see. I'm mostly worried about eventually running out of buttons to use. I'll have to think about it.

In relevance, I hope that you're still considering figuring out lipsync too! That's a huge part of avatar expression after all. It could be as simple as sending the volume value of the mic feed and letting people figure out how to apply that to an animator, until you figure something more complete that can recognize syllables and whatnot.

Yep, that's definitely still on my to-do list. Great suggestion - it's definitely a decent first step.

However that has its own Issue Post, so unless you would like to use this one as a means to track button event progress, perhaps we should call this one closed?

Yeah, I think we're done here. I'll keep the key events & animator parameter things in mind. They definitely won't make it into the next update since there's a small bug that needs to be fixed for 1.28.0. There's also some relatively urgent tracking/calibration-related things that have been on my to-to list for over a year that I really need to fix before doing basically anything else so I unfortunately can't give you a timeline on this, but hopefully sooner rather than later!

And with all that said, I want to express that I highly appreciate all the effort you've put into all this. As someone who has done a measure of coding in the past I understand how difficult and often frustrating it can be. I would offer monetary support if I could.

Thank you so much for your kind words! Don't worry about it – I'm always happy to help, especially when you're willing to spend some time helping me figure it all out 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants