u/Gruffet_Spider

Best way to add multiple languages for my situation?

So I definitely should've looked into this earlier, but it could still be worse- I've looked into the csv and ini file methods of adding localization, but with how much dialog I'm going to have, I'm not sure what my best approach is. Currently I have all my dialog stored in a script, which is just one massive switch statement. It checks a global variable, and based on that, sets an array of dialog lines. At first I thought I could just store it all in a csv file, but because each set of dialog has multiple array slots, I don't think that'll work anymore. The amount of array slots is also inconsistent, so I don't see a feasible way of doing this. Would it just be easier to copy paste the script at this point? Have one script for each language and then just control which script is called. That feels like the best approach here. I could still use csv files for general UI and settings text, but I think dialog is just too much to handle externally like this. Am I wrong?

reddit.com
u/Gruffet_Spider — 1 month ago

So I'm finally starting to wrap my head around shaders, and I'm ALMOST at the point I can write my own. I finally understand how vecs work, at least somewhat. I'd say I've got the basics down. So I wanted a way to invert the colors of a sprite. I looked it up and the google AI summary instantly spat out a shader for me, but I wanted to try and do it myself. It's not that hard, all I have to do is take 1.0 and subtract the RGB values from v_vColor. So I tried it, but it didn't work... It just made everything black. So I checked what the AI did, and it looks almost identical to what I did. I tried the AI one and it works perfectly. I've got a working shader now, but if I'm ever gonna make my own, I should probably learn where I went wrong. So what did I miss that the AI didn't?

This was mine:

void main()
{
    vec4 base_col = vec4(1.0 - v_vColour.r, 1.0 - v_vColour.g, 1.0 - v_vColour.b, v_vColour.a);

    gl_FragColor = base_col * texture2D( gm_BaseTexture, v_vTexcoord );
}

And this is the AI:

void main()
{
    vec4 base_col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );

    gl_FragColor = vec4(1.0 - base_col.rgb, base_col.a);
}
reddit.com
u/Gruffet_Spider — 1 month ago