OpenBagTwo / FoxNap

A survival-, multiplayer- and copyright-friendly mod for adding custom music discs to your world
GNU General Public License v3.0
2 stars 1 forks source link

Example Format for Spec Config File #61

Open MattyF25 opened 1 month ago

MattyF25 commented 1 month ago

I'm not a coder so I have no idea how to layout the spec config file, in any format. An example file in any format would help just so myself and anyone else can easily edit and use, as I've been trying to change the disc colour and I'm lost lol.

OpenBagTwo commented 1 month ago

Sure. The easiest option is probably a CSV (you can make it in Excel, Google Sheets or LibreOffice, then just export as CSV), which should look something like this:

num path_spec hue
8 key.mp3 291
9 door.mp3 41
10 subwoofer_lullaby.mp3 140

where you can figure out the desired hue value (between 0 and 360) using a tool like this.

Sorry—I know the documentation for this is pants, so:

MattyF25 commented 1 month ago

I tried the csv suggestion above and it's still giving errors, it's saying that the value for hue should be a Boolean. I'll add an image to help image_2024-07-08_151919046

OpenBagTwo commented 1 month ago

Oh noo... that's definitely a bug (and I've marked it as such).

The issue is that "hue" will always be read in as a string from a CSV, and consequently, it's erroring out first trying to convert it to True/False.

Your best option is going to be to go with a JSON config, which will look something like this (taking my example from above):

[
    {
        "path_spec": "key.mp3",
        "num": 8,
        "hue": 291
    },
    {
        "path_spec": "door.mp3",
        "num": 9,
        "hue": 41
    },
    {
        "path_spec": "subwoofer_lullaby.mp3",
        "num": 10,
        "hue": 140
    }
]

Let me know if that works for you. I'll try to get a patch out in the next few days.

MattyF25 commented 1 month ago

The code works! I've tried it with 10 different songs and the colours change with them. However, the colour code is kinda weird, it lets me input very large numbers such as 255255255. On top of this, due to the base colour of all disks seeming to be purple, any colour that I try has purple mixed in. This is not a major issue for me personally, however it will require a lot of trial and error to find the desired colour which is not user friendly or time conscious. The image I have attached shows the hue values 100-1000 going up in increments of 100 just to give a bit of a scale, as well as an image with 10-100 in increments of 10. disk colours 100-1000

10-100

image_2024-07-09_164654753

OpenBagTwo commented 1 month ago

it lets me input very large numbers such as 255255255.

That's expected behavior—there's a modulo-360 in the logic

due to the base colour of all disks seeming to be purple, any colour that I try has purple mixed in

Hmm... the base HSV is 260° / 46% / 45%. I'd assumed that shifting the hue would be sufficient to vary the color consistently while maintaining the textured gradient.

Here's the spectrum that that HSV color-picker gives me when fixing saturation and brightness:

color spectrum for hue shifting from 46% saturation, 45% brightness

If every color is looking purply, I'd be happy to swap out the template for one with a more neutral base color, but I'll definitely need your help in choosing a good one—I have a mild red/green color deficiency, so I'm not the best judge of these things.

Thank you so much for the feedback, btw! If you're having these issues then I'm sure others are as well.

MattyF25 commented 1 month ago

If every color is looking purply, I'd be happy to swap out the template for one with a more neutral base color, but I'll definitely need your help in choosing a good one—I have a mild red/green color deficiency, so I'm not the best judge of these things.

The purple base isn't too bad, it might be hard to get bright colours such as orange or yellow but for Minecraft I think it suits. I'd be happy to try and help see what a different base would produce if you wanted to try it but it's not that necessary.

Thank you so much for the feedback, btw! If you're having these issues then I'm sure others are as well.

That's all good mate, I'm always happy to help, you've got a great mod here and I'm sure that over time it'll get even better.

OpenBagTwo commented 3 weeks ago

This should not be closed until the example spec files are in The Wiki