Working on a rhythm game and so the player is destroying actors as they scroll along. Two things I am interested in doing are 1) counting the number of concurrent destroyed actors to award combos and 2) Triggering game over if a certain % of actors are not destroyed by the player. Was wondering if anyone here had any thoughts about how to achieve either of these functions?
When an actor gets destroyed:
- check if a timer is already running
- if so, keep calculating combo and, optionally, extend the timer
- if no, start the timer whose duration is the allowed time between actors getting destroyed
- when the timer is up, reset the combo logic (not sure how the combo is supposed to work here)
- Triggering game over if a certain % of actors are not destroyed by the player.
- you know the
total
of actors there is count
actor getting destroyed- you can derive the percentage from the above
(count/total)*100
- condition check the threshold when an actor gets destroyed
The whole thing could be triggered with Overlap Triggers or with Event Dispatchers.
Ah amazing. This is so helpful. So attached are my on overlap and my end overlap for my trigger box, and then an example of one of my key mappings (there are 4) I’d be interested to know if there’s a solution you’d recommend based on this set up. Sorry in advance for my slightly messy blue prints.
typically in Rhythm games like what you are describing there can be a lot of “Notes/Beats/Targets”
I would strongly suggest looking into object pooling where constantly spawning, and destroying actors can lead to memory segmentation, and potential churn if the Garbage Collector is still batching destroyed actors.
the number of Actors in your pool would probably be like the Max number that could be visible to the player plus at least the number of potential misses and like 1 or 2 extra.
this will give a more consistent memory utilization while avoiding segmentation.
I guess I should also say that the actors themselves are being spawned from an event trigger that’s on a level sequence and the triggers fire at specific points along with the music track within that level sequence.
Ah interesting. I really appreciate the suggestion. I’ll for sure look in to that.