PixelGuys / Cubyz

Voxel sandbox game with a large render distance, procedurally generated content and some cool graphical effects.
GNU General Public License v3.0
430 stars 53 forks source link

Song Playlist and Chances System #732

Open ikabod-kee opened 2 days ago

ikabod-kee commented 2 days ago

Instead of biomes having one looping song, reference a .json file that has a collection of music. These playlists can be referenced during events such as biome music, boss music, raid music, etc. Each song in the playlist has a specified chance of playing.

If specified, the chance for a song to play can be set to zero if it's already been played. This resets after each consecutive song or the chance increases based on how many songs are in the playlist.

Optionally, you can choose what song plays after another, called a "sub-song." These could be used as a nuanced way to bridge the different musical styles the game has. Again, optional!

IntegratedQuantum commented 1 day ago

Instead of simple playlists I would propose a more complex system. I think the main problem with playlists is that you end up looking for a lot of playlists for many different combinations of biome type + day/night + hostility. Additionally it seems more difficult to add new music to an existing biome.

That's why I instead propose a system based on keywords (tell me what you think about this):

Each music track gets a list of keywords associated with it. These keywords could be for example "day", "night", "danger", "building", "grass", "sun", "desert", "water", "cave", ... You can add new keywords in each addon as well.

Each biome also gets a list of keyword + weight (can be negative) pairs associated with it. Music is then selected as follows:

For each music track the biome weight is determined by adding all the biome weights of the keywords that it has together. From the music tracks above a certain threshold (maybe the threshold would be biome specific as well?) a song is chosen randomly, maybe also based on a parametrisable chance.

Some of these keywords can be tied to game functions. For example during the night, all songs that have the "day" keyword, but not the "night" keyword are automatically disabled (unless of course the given biome specifies the day keyword in which case it would always play day music).

Addons could also easily define new keywords, to make sure that their music only plays in certain biomes.

ikabod-kee commented 1 day ago

(I like this idea)