Balatro (fun card vidya game) had it's source code leaked and it's all if/else statements lmao (EDIT: it's actually packaged with since it's written in Love2D :marseysigh: )

https://old.reddit.com/r/balatro/comments/1bt7agy/exploit_balatros_source_code_is_exposed_easy_to/?sort=controversial

hello~ idk if this has been discussed in the community yet, but there's a really easy exploit to cheat in balatro --- you can right-click the .exe file, go to "Open Archive", and modify the source code directly. i made a video so you can see how it works:

i'm bringing it up because if the editor is smart, there's no way to tell if a game has been modified or not --- you can, for example, increase the droprate of powerful jokers or legendaries and cheat in a speedrun category

i've sent a message in the speedrunning groomercord that they should probably modify the rules so that runners have to verify their game files on Steam before they submit a run. and more generally, i think ppl should be aware that this exists so they can call out suspect videos and runs

i almost didn't want to publicize this because the more well-known this gets, the easier it will be for ppl to cheat in speedruns and tournaments and stuff, but at the end of the day i think it's better if more ppl know and can establish rules to stop it when it matters

63
Jump in the discussion.

No email address required.

It never leaked, it's literally just written in Love2D so they have to package the source code with the thing so it can be interpreted

Jump in the discussion.

No email address required.

:marseyshook:

Jump in the discussion.

No email address required.

It'd be like saying a python script leaked or something. Anyway if I recall, while the meme about yandev tier if/elses came about because of his massive ifelse's, they're not actually inefficient or nonoptimal in lua, because lua doesn't have switch statements in the first place. Even for the yandev it wasn't the fact he had a chain of if/else, either, it was the fact that he was making his code harder to read for no reason and also rendering everything at the same time, even things that're meant to be offscreen. But naturally this was easier to push as the meme.

Jump in the discussion.

No email address required.

generally if you have massive if/else chains, there's a far better (and sane) way of doing it.

Which is 100% the case with yandaredev lol Unity has LOADS of way to properly structure shit like that.


Give me your money and I'll annoy people with it :space: https://i.rdrama.net/images/16965516366194396.webp

Jump in the discussion.

No email address required.

It's not about performance lmao. Switch statements that aren't on tightly-packed integers (like enums) are implemented as if-else cascades in virtually all programming languages anyways (some will use a hash table but that's often not the best in all scenarios so it's uncommon). And switch statements in "fancy" languages with pattern matching and destructuring syntax are also implemented as if-else cascades.

It's just that writing spaghetti code like this makes it so much more difficult to change, refactor, or debug your code. It's also a good measuring stick for incompetence because it typically comes about because the programmer isn't good enough to come up with a better way of implementing whatever feature.

Jump in the discussion.

No email address required.

Yeah but I already said this part

Jump in the discussion.

No email address required.

Also the entire game was a single gigantic script that called various functions

Homie didn't break anything up. Instead of the game controller calling different game files, which unity handles natively and really well, he just added functions to a gigantic script.

So a single error causes insane cascades of faults that were almost impossible to find because ofc it was not designed w/debugging in mind

The error logs are legitimately like a parody because he's fighting against unity to do things wrong

Jump in the discussion.

No email address required.

https://i.rdrama.net/images/17139276893848178.webp

Jump in the discussion.

No email address required.

My meme post is ruined now :marseygiveup:

Jump in the discussion.

No email address required.

You can stick all your function pointers in a table and then just index into that

This guy isn't even using else statements tho, he's checking the ability string a million times more even after he finds a match

Jump in the discussion.

No email address required.

He probably didn't see a point in doing else statements since he probably thought that players might somehow use two abilities at once. So he went the 400 independent if statement route. Because he's a game developer and they're taught to do r-slurred shit like this since they don't actually know how to program.

Jump in the discussion.

No email address required.

ill tell you where else you can stick your function pointers

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.