#Custom Card Back Support 2.1.0!!

59 messages · Page 1 of 1 (latest)

lucid flicker
#

Hi everyone,
I made a simple module that loads every card back file you prepared and batch load them into the game, free for selections.
Currently the module is based on SMODS, as a way to load this module as well as directory lookup. You can name your card back in format "b_{cardbackname}.png" in your mod's assets folder and it will automatically load every file of that format to card back assets. You can look up the position of your cardback via {cardbackname} so ideally this makes multiple mods using the same convention compatible.
This is more of a tool for modders. You can find more instructions as well as the files themselves through the following github link:
https://github.com/Ken-Shi/Balatro_CardBackInjection
Hopefully this is useful for the community! I haven't get into balamod yet but I think as long as you know what you are doing you can easily modify this to support balamod. Special thanks to @regal merlin and @ornate dirge for supporting the development! Any feedback is welcomed!

Note: Version 2.0 is released and it should be extremely robust!!

GitHub

A Balatro mod dedicated to adding customized card backs to the game in ease - Ken-Shi/Balatro_CardBackInjection

lucid flicker
#

You can also just download this package and unzip it in the folder where you put all the mods. Newest Version here: #1219099261883519046 message

lucid flicker
#

Any feedback is welcomed!!

edgy bison
#

this works fine with things that replace base game textures right? i'm not sure what could go wrong with that but i'd still like to ask since i like playing with skins on the base decks and special enhancement visuals

lucid flicker
#

^ to add to that, i think it's a pitty that it does not read Enhancer.png right away, it was mainly because we don't have directory libraries that allows the code to locate your game correctly

radiant glacier
#

This is really cool, thanks for figuring this out. Is it ok to borrow parts of this code for reuse in my deck creator mod? It could allow me to implement a system where users can upload their own deck backs for each deck through the UI

lucid flicker
radiant glacier
#

Will do! Much appreciated!

ornate dirge
# lucid flicker Any feedback is welcomed!!

ok so couple of things

  • put it in the readme that the cardback assets should be in the cardback injector asset folder and not the original mod folder so that the mod makers can reflect it in their readmes (or more preferably an instruction on how to copy assets from original mod folder to cardback injector mod folder during runtime to remove the burden from the people who install mods as they often dont even know how to unpack an archive and copying assets around is probably too much to ask) (or even better rewrite the mod so that it crawls through all mod directories and grabs the b_whatever assets from their respective mod folders)
  • put the exact dimensions the cardback assets must be in the readme (i assumed it was the exact dimensions of the card but i was off by 2 pixels as a result, it turns out it should include one empty pixel to the left and right (and probably top and bottom? no idea, would like an elaboration)
  • mod seems to break if you enable "pixel art smoothing" in the games options which im assuming makes balatro use 2x assets
ornate dirge
#

also seems like the G.cardback_info["deckname"] is broken, it doesnt return the correct x and y pair

#

seems like the mod appends the images by alphabetical order, not by their actual names

#

ok tested it, b_garbagefile should be appended but its x and y coordinates should never be recalled

#

but instead it gets appended and its coordinates seem to get assigned to "ksrjkrdeck" name

#

no its something even weirder

#

i swapped two name assuming then the garbage sprite will swap to another deck but it didnt

#

so it seems like the thing doesnt even look at the name, it just first appends stuff by alphabetical order and then returns stuff by the order in which it was appended every time you call it

#

yep tested in conclusively by just doing this, which should return the same thing (or crash) but instead it returns backs in the same order they were appended in

ornate dirge
#

ok i think i got to the bottom of this

#

its some weird scope shenanigans

#

ok so when im calling InjectCardBack() from inside the init function, it does return the table with names and pairs of coordinates

#

but when im trying to access it in the mods body to get the coordinates, it thinks G.cardback_info doesnt exist/is empty

#

so it does the first part of the if statement thats meant to set the positions how i have them in enhancers.png when the cardback injector mod isnt there

#

so the mod probably does (and as far as i understand the code after reading it, it does) create a table with names and coordinates correctly, its just that the table disappears for some reason that im yet to figure out and thats probably related to how lua handles scope, or something, and this is where my very limited programming knowledge hits its end

#

as a hotfix, just shoving my entire mod into the init function seems to have worked

#

unless you come up with how to go around the weird scope thing (i sure wont), you should put it in the readme that the whatever parts of the mod depend on accessing G.cardback_info should be inside the init function

ornate dirge
#

a template for whoever is trying to update their mod to be compatible with this, so that you can keep your assets in your asset folder

ornate dirge
#

oh also, you should probably insert some kind of check whether the file youre appending has already been appended
since the function loops over all asset files in the injector mods directory and appends everything that starts with b_ and ends with .png from what i understand, calling it multiple times in multiple mods will bloat the file with copies of the same cardbacks

#

might do something funky to lookup table too since itll have multiple entries with the same name, but i dont know how lua handles that

#

just adding lookup[file:sub(3, -5)] == nil here would probably do the trick

#

ah no nvm, it always starts from the OGEnhancers.png anyways so while its a bit of a sisyphean task its gonna do if you have 50 deck mods and each of them calls the function, its not gonna mess anything up

lucid flicker
lucid flicker
lucid flicker
ornate dirge
lucid flicker
#

And do the lua file exist in mod1/mod2?

ornate dirge
#

yeah

#

basically separate mods have separate subfolders

lucid flicker
#

I see, let me see what I can do

lucid flicker
lucid flicker
#

@ornate dirge Sorry for ping but good news, I have found solutions to ALL of the issues above and will push a solution soon. The only downside is it is if not completely rewritten. However, it will ideally go through all the folders automatically now and you can just call one of the function to get the table and you will be good to go!

lucid flicker
#

Custom Card Back Support 2.0!!

lucid flicker
ornate dirge
#

also this seems like functionality that would be nice to have in the steamodded api itself, any plans to merge the two?

woeful carbon
#

Heads up I get this error code and crash at startup after adding your latest release to my mods folder.

ornate dirge
proven cobalt
ornate dirge
lucid flicker
lucid flicker
lucid flicker
#

2.1.0 is out on both github and Thunderstore to match Steamodded 0.8.1!

#

Custom Card Back Support 2.1.0!!

agile venture
#

Hello @lucid flicker , I'd like to bundle your mod in a modpack. To ensure that I can update the version of your mod easily and without copying your code directly in my repository, I'd like to use a git submodule. Like that, it would just be a link to your repo. Would you mind if I add your mod in my modpack ?

lucid flicker
#

is there anything i have to do on my end?