The archeological research mission faced some unexpected difficulties. Your spaceship crashed. You are sure you have to escape this planet. But how? No one can help you. You are here all alone. Or not? At least you know what you should do next...


  • View media
  • View media
  • View media
  • View media
  • View media
  • View media
Post article RSS Articles

Сreating rhythm games

News

The first question every rhythm-game developer asks himself: “Should my gameplay actually be powered by music?” If the answer is yes and it’s not enough for the developer to have just visual scene feedback to playing music, the second question appears: “Should I give the player possibility to upload his own track to play”? Sure, you can have the same question in the first case too, but only if your gameplay is really affected by music the answer is crucial for you. Because giving player ability to upload his music means to spend resources on developing custom music analyzer and level generator and also on wide genre testing and tuning. Delegate-level creation to Steam Workshop community doesn’t seem like a good idea till you don’t have the community itself.



We understood that program sound analyzer is a rather popular task, though still not trivial and trying to solve it with our small studio is the responsible decision. And we still could not resist adding this killer-feature, allow a player to crush souls to the rhythm of his favorite song.

Rhythm is center of our gameplay. So-called BPM(beats per minute) with its frequency you move your head to cool track. But if you want to build your game around the rhythm you should get it first. Music for the game engine is only set of samples he can play and some information about them.

BPM extraction is not a new task - even if you ignore rhythm games, DJ equipment manufacturers and digital audio workstations developers have done a great job in this area. And still after all these achievements they often delegate rhythm detection to human.


- tap CUE button to the beat and CDJ will catch it


We reviewed a lot of materials before came up with the solution that worked for us.
Music is complex soundwave, the vibration of air in your room, in the club or between your headphones membrane and eardrum. Transformation of these vibrations to something melodic and rhythmic (what our brain does automatically) requires some calculations. Most part of these calculations is Fast Fourier Transform that converts the complex sound signal to the sum of sinusoids with certain frequencies and amplitudes. For those who can’t understand in what way curve from school connected to sound we will explain: the sound wave of sinusoidal form is the simplest timbre familiar to anyone. Phone line ringing for example. The frequency of this sine is sound pitch and amplitude is volume. Here are some FFT for different sound waveforms for illustrative purposes:



Of course for music resulting frequency spectrum will be much more complex - all over the range it will have some frequencies. If you remember any music spectrum analyzer (people often call it wrong: equalizer) you will understand what we are talking about. This is the clear picture of what sound look after Fast Fourier Transform.


- the loudness of frequencies from lowest to highest (left to right)


Thanks to the game engine that made this transform for us we can work with music like with the array of samples (number of these samples per second depends on quality and compression) that gives us information about all the sounding frequencies at every moment of the record.

So we have several tasks to solve with help of this data.

First and main task - BPM extraction. Almost every in-game parameters and values are linked to the rhythm - from enemies spawn and move speed to animations playback speed and combo behavior.

To extract rhythm we should first understand what it is. Usually, by beat we mean start point of the short repeated musical piece. Looping of this piece determines main song tempo. Classic rhythm-section consists of drums and bass (whether it rock or jazz, metal or dance music). This knowledge gives us approximate borders of the frequency range that we will scout for volume peaks. Our main goal is under 120Hz range, but besides it, we will also scan additional narrow range around 1kHz where often rhythm-section-supporters sit.

First, we should understand loudness range for these frequencies along all the song. These values are needed to make relative decisions. When we got minimum and maximum volume we can start the analysis. In short, this analysis is a iterating over samples from song beginning to its end and comparison of needed frequencies amplitude with min and max values and with siblings. By making kind of “low-frequency volume jumps map” we are trying to find periodical sequences - peaks, repeating with the same time period (luckily for music lovers and unluckily for music analyzers, bass and drum parts can be complex and different).
Most frequent value of this time period we are using as beat duration, which is used to calculate BPM.


Analyzer reacts different to various genres - of course, house music, where the clean beat is marked by kickdrum, is the simplest one to analyze. Dealing with aggressive metal genres, where the drummer can do incredibly fast and furious things, is much harder. In that case, we can ask additional frequency range for help. Searching for snare and electric guitar drops can help in beat determination. We should also remember about music genres with floating bar size, where musical phrases can be different size and duration - jazz, math rock and others.

Sound compression is one more thing that can hinder analysis. This way of post-processing music is used by many producers nowadays. Compression is all about narrowing difference between the loudest and the quietest frequencies (so-called “dynamic range”) through the song to make it sound louder without quality loss and extreme peaks. Obviously, extreme compression (which can often be heard in dance music) can be a barrier to drawing proper “low-frequency volume jumps map” and make analysis results wrong.



Bad overall record quality can be the problem too - big amount of noises at the wide range or bad mixing can cause frequency conflicts (garbage side frequencies emergence).

To provide some support for beat extraction algorithm we add sync during the playback. The pre-analyzed track gives us average BPM value. According to this value, we set beat duration and run main game timer. Then during song playback, we periodically synchronizing this timer to our “map of peaks”. If deviation is big, next synchronization is set to short period of time and gameplay in this period gets softer to protect player from system errors.

Add some small features to this analysis and we get working version of beat-sync mechanism. Now we can concentrate on interactive levels - spawn more difficult enemies sequences when music is intense, visual scene feedback, etc.

Anyway, to avoid the bad experience for a player who wants to play the game to old grandpa vinyl or arrhythmic metal of his friends' band, we honestly say after the attempt to upload song - sorry we failed to get this track tempo, please find something else.

Game Steam page - TERRORHYTHM

Star Story: The Horizon Escape is available on Steam (Early Access)!

Star Story: The Horizon Escape is available on Steam (Early Access)!

News

A few moments ago we hit that button. And it happened.

Space Shrimps are almost here!

Space Shrimps are almost here!

News

Star Story: The Horizon Escape will be released next week!

The workshop: generator, droids and you

The workshop: generator, droids and you

News

This time we decided to pay more attention to the in-game workshop...

Star Story: The Horizon Escape has been Greenlit!

Star Story: The Horizon Escape has been Greenlit!

News

Good news, everyone! We've been Greenlit! Few post-Greenlight thoughts and tips.

Add file RSS Files
StarStory _ Beta RU _ IndieCup Demo PC

StarStory _ Beta RU _ IndieCup Demo PC

Demo

"Star Story: The Horizon Escape" demo for Window (Russian language)

Comments
Guest
Guest

This comment is currently awaiting admin approval, join now to view.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Icon
Star Story: The Horizon Escape
Platforms
Windows
Developer & Publisher
Evil Corporation Games
Engine
Unity
Contact
Send Message
Release date
Game watch
Follow
Share
Purchase
Community Rating

Average

-

0 votes submitted.

You Say

-

Ratings closed.

Style
Theme
Sci-Fi
Players
Single Player
Project
Indie
Twitter

Latest tweets from @evilcogames

A typical employee of Evil Corporation Games on Friday night wishes a great weekend to everyone! T.co

Jan 12 2018

Here is our first TERRORHYTHM' gameplay video!!! If you like it, please add this game to y… T.co

Dec 27 2017

Wish Merry Christmas and Happy New Year to all our friends! We have a present - 4 Steam Keys to BIT.TRIP Runner2:… T.co

Dec 26 2017

Merry Christmas to all of our friends! We wish you all the best for this Christmas time! Merry Christmas and a very… T.co

Dec 25 2017

Just a little about our colleagues. L.A. Noir VR-edition: players got full control over the hands of the main chara… T.co

Dec 22 2017

Here'is our little article about the work with sound, when creating rhythm game Destructoid.comT.co

Dec 21 2017

Some steps in animation on #TERRORHYTHM project. Soon will be more broken enemies. Game Site:… T.co

Dec 18 2017

Embed Buttons
Link to Star Story: The Horizon Escape by selecting a button and using the embed code provided more...
Star Story: The Horizon Escape
Statistics
Last Update
Watchers
8 members
Files
1
Articles
9
You may also like
Shadows by the Waterhouse
Shadows by the Waterhouse Point and Click
Nando's World
Nando's World Point and Click
Luna City: Codename 39
Luna City: Codename 39 Point and Click
Apeiron
Apeiron Point and Click
Escape to Antesha
Escape to Antesha Point and Click
Neofeud
Neofeud Point and Click