The working of Catch the Stars! and why it wasn't that hard, actually


Hello everyone. In the recent stream by Fun Base Alpha (update: the replay isn't available anymore), I was praised by both the streamer and someone in the chat (subwoofer, who made the adorable Love at first Meow) for how well-made my game was, especially given how hard rhythm games are to make and the time restriction of the jam. Many thanks to both of you, but while I do love a compliment, I must admit one thing.

Making Catch the Stars! wasn't nearly as hard as making a usual rhythm game. You see, in most rhythm games, you have music, and some kind of pellets appear synced with the beat. And any good music has a complex rhythm, and by that I mean it has variations: it could have two beats in a second, four beats in the next, only one in the following, and so on. Catch the Stars! however does not have a complex rhythm. In fact, it doesn't have any music! It's just a perfectly regular, simple rhythm: one beat every half a second, and one star every beat. That means I don't have to care about when the stars appear, only where. And that actually made me skip most of the difficulty of making a rhythm game.

The levels in Catch the Stars! are just a small series of numbers, like [1, 2, 5, 6]. That's the second level. On the first beat a star appears in the first position (top-left), then one in the second position (top-right), one in the fifth (bottom-left), and so on. As simple as counting to six. One star will appear exactly every half of a second (on normal speed) and that's it, no variation, no complex rhythm. This is actually hard-coded into the game: if I wanted variation within a level, I would have to change everything. That's how simple my system is.

Now, how do the said system work? It's pretty simple, actually.

The game works with ticks: every 50 milliseconds, one tick occurs; that's 20 ticks per second. Every ten ticks, one beat occurs. When a beat occurs, the game decides what to do depending on the current phase and step. The phase is "waiting" when no level is being played, "spawning" when the stars are appearing, "readying" when the "palam, palaa, lam, go!" is playing, and "playing" when it's time for the player to catch the star. Every beat increases the current step by one, and when all steps are completed, the current step is reset to 0 and the game is set to the next phase. The "readying" phase has 4 steps, respectively playing "palam", "palaa", etc. The "spawning" and "playing" phases have as many steps as the current level has stars, and the "waiting" phase obviously goes indefinitely until the player starts a level. Actually, the game does not tick in the "waiting" phase. It starts ticking when the player starts a level and stops as soon as the "playing" phase ends.

To know when it should consider a star to be caught, the game has a hit interval, that is the number of ticks before and after the beat when you can hit the next star. In normal difficulty, the hit interval is 3 ticks, which means you can catch the star up to 0.15 seconds before the beat, and up to 0.15 seconds after (it's 5 ticks in easy —meaning there always is a target in easy mode!— 2 ticks in hard and just 1 in impossibru). When the game ticks, it runs a bunch of instructions checking what it should do. First, it will compute what I called the instant, that is the number of ticks that elapsed since the last beat. If it is hitInterval ticks before the next beat, it will set the current target, that is the star the player is supposed to catch at this moment. When the instant is 0, a beat is played. When it is hitInterval ticks after the beat, it resets the current target to null, meaning no star can be caught; also, if the target wasn't already null but no hit was registered, the player gets a "missed" penalty.

When the player clicks on a star, the game first checks if there currently is a target, and gives the player an "out of beat" penalty is there isn't. If there is, but the wrong star was clicked, the player gets a "wrong star" penalty. If the right star was clicked, the player is awarded a "good" or "perfect" hit, depending on how close the hit was to the beat; the hit interval for a perfect hit is half of the global one.

And... That's it! There is no problem with synchronising the game since the system handling the "targets" is the same handling the beats.


TL;DR: The game was not that hard to make because it does not use music, only a simple and perfectly regular beat.

Leave a comment

Log in with itch.io to leave a comment.