Repository navigation
Add music track registry and biome mood - #3679
Conversation
|
I think an artist opinion would be nice here @ikabod-kee @careeoki |
|
Oh holy shit. Let me check this out |
|
This looks very good to me! I'm not sure if Quantum actually wanted the mood system like that so he'll have to give you some feedback on this- but this is a very good start and I'm excited to see some implementation. |
IntegratedQuantum
left a comment
There was a problem hiding this comment.
Instead of just adding these values, please also outline how you intend the system to work, also check out some criteria I added in #732 (comment)
| addon.readAllZon(allocator, "items", true, &self.items, &self.itemMigrations); | ||
| addon.readAllZon(allocator, "tools", true, &self.proceduralItems, null); | ||
| addon.readAllZon(allocator, "structure_tables", false, &self.structureTables, null); | ||
| addon.readAllZon(allocator, "music_tracks", true, &self.musicTracks, null); |
There was a problem hiding this comment.
I think the metadata should be put in the same folder, like we did for models.
| pub const migrations = @import("migrations.zig"); | ||
| pub const models = @import("models.zig"); | ||
| pub const mood = @import("mood.zig"); | ||
| pub const musicTracks = @import("musicTracks.zig"); |
There was a problem hiding this comment.
Please don't make a new root-level files for this. This clearly is only used for music, thus belongs in the audio file and folder.
| @@ -0,0 +1,12 @@ | |||
| pub const Mood = struct { | |||
There was a problem hiding this comment.
This could also be declared locally in the MusicTrack struct
| } | ||
|
|
||
| pub fn registerTracks(tracksZon: *Assets.ZonHashMap) void { | ||
| anyTag = Tag.find("any"); |
There was a problem hiding this comment.
For any comptime-known tags, just declare them in the Tag enum
| subBiomeTotalChance: f32 = 0, | ||
| preferredMusic: []const u8, // TODO: Support multiple possibilities that are chosen based on time and danger. | ||
| baseMood: main.mood.Mood, | ||
| musicTags: []const Tag.WeightedTag, |
There was a problem hiding this comment.
My idea was to have tags be hard restrictions. If we add weights to them I think the resulting vector space may get too big to be able to produce good matches on the mood and the tags (e.g. a few tags on a track that doesn't match the mood at all may outcompete any tracks that do match the mood and vice versa).
Also tags should not be specialized, to allow one system (e.g. music) to make use of the tags of another system (e.g. .oak).
|
The way I wanted this to work was:
When the current song finishes playing, the system does a weighted random pick of the next track, excluding the last few played unless that would leave no candidates. If the player travels to another biome whose tags don't match the current song, it immediately fades to a new one. |
|
Now I guess if we want hard filtering tags, that would mean that for a track to be considered a candidate, all of its tags have to be among the current biome's tags. In that case, the |
IntegratedQuantum
left a comment
There was a problem hiding this comment.
Please also add at least one example to a biome, and make a PR with an example music track to Cubyz-Assets (note that you'll also need to touch the release CI script to copy the file over)
Thanks for working on this by the way, this is quite important, and something I've been neglecting for quite a few release cycles.
| energy: f32, | ||
| sanity: f32, | ||
|
|
||
| pub fn loadFromZon(zon: ZonElement, isCave: ?bool) Mood { |
There was a problem hiding this comment.
Bools in functions signatures are hard to read.
| pub fn loadFromZon(zon: ZonElement, isCave: ?bool) Mood { | |
| pub fn loadFromZon(zon: ZonElement, options: struct{isCave: bool = false}) Mood { |
Example music track file for PixelGuys/Cubyz#3679
|
Replaced |
IntegratedQuantum
left a comment
There was a problem hiding this comment.
I can't wait to see how this turns out.
Progress toward tag-based music selection as outlined in #732. This PR is just the data model and changes no behavior.
Each
zig.zonfile in themusicfolder declares tags, a mood target, a tolerance and a chance for the song of the same id. AddsMood, a point in anxiety/energy/sanity space. Biomes and tracks are positioned in this space. Biomes can now declare abaseMood. Cave biomes default to a higher baseline anxiety.Example music track file:
.{ .tags = .{ .peaceful, .day, .surface }, .moodTarget = .{.anxiety = 0.2, .energy = 0.3, .sanity = 0.8}, .moodTolerance = 0.6, .chance = 1.0, }