Balatro

Balatro

Nicht genug Bewertungen
Run Balatro natively on Linux
Von Enderteck
This guide is to show how you can get Balatro running on your Linux computer natively and even natively through Wayland
2
2
   
Preis verleihen
Favorisieren
Favorisiert
Entfernen
Easy method: Bash script
Making an executable of the game for Linux is very easy and requires two things:

Balatro.exe (the game scripts), it's actually a .zip file renamed to .exe that contains all of the game's code in lua, it requires the Löve framework to run.

The compiled Löve2d framework, that provides libraries and a framework to let thoses scripts run on your machine.

So you're gonna need:

The game (Balatro.exe), which is downbloaded on your computer if you play it on Steam

A love executable

I recently created a bash script that will do almost everything for you, skipping the whole guide, however, this script assumes that:

You have pasted a löve 11.5 executable in it's folder
Your Balatro install directory is ~/.local/share/Steam/steamapps/common/Balatro/


How to get a löve 11.5 executable ?

Method 1: Official Appimage:

Go to https://love2d.org/,
when it suggest to download löve 11.5, click on "AppImage x86_64"

Or

Go to https://github.com/love2d/love/releases,
click show all assets and download "love-11.5-x86_64.AppImage"

After you download love-11.5-x86_64.AppImage, open a terminal in the same folder as that downloaded appimage

Make that appimage executable, by either,

- on Gnome, right clicking it > clicking Properties > Checking "Allow executaing file as program" at the bottom
- running in a terminal in that folder :

sudo chmod -x love-11.5-x86_64.AppImage

Once it is executable, you can verify that it woks by executing it (Right clicking it and pressing launch if it doesn't work)



Method 2: Compiling it

Go to https://github.com/love2d/love/releases,







You can directly download it here (you can see the code before doing so):

Generate executable.sh on Google Drive[drive.google.com]

Or you can copy this and paste it in a .sh file (Generate executable.sh for Example):

#!/bin/bash

BASEDIR=$(dirname "$0")
if test -f "$BASEDIR"/love; then
cp -r ~/.local/share/Steam/steamapps/common/Balatro/Balatro.exe "$BASEDIR"/Balatro.love
cat love Balatro.love > Balatro-for-Linux
sudo chmod 777 Balatro-for-Linux
echo "[Desktop Entry]
Type=Application
Icon=/home/pc-enderteck/Images/Balatro.png
Name=Balatro
Exec=env SDL_VIDEODRIVER=wayland /home/pc-enderteck/Documents/Love/Balatro/Balatro-for-Linux
Hidden=false
NoDisplay=false
StartupNotify=false
Terminal=false" > Balatro.desktop
sudo chmod 777 Balatro.desktop
rm Balatro.love
else
echo "There is no love executable in this folder"
fi

Here is my script wit hcomments explaining what each line will do:

#!/bin/bash <- This specifies this file is a bash script

BASEDIR=$(dirname "$0") <- This tells the script to remember the folder it's currently in as BASEDIR (so that it works everywhere)

if test -f "$BASEDIR"/love; then
cp -r ~/.local/share/Steam/steamapps/common/Balatro/Balatro.exe "$BASEDIR"/Balatro.love
cat love Balatro.love > Balatro-for-Linux
sudo chmod 777 Balatro-for-Linux
echo "[Desktop Entry]
Type=Application
Icon=/home/pc-enderteck/Images/Balatro.png
Name=Balatro
Exec=env SDL_VIDEODRIVER=wayland /home/pc-enderteck/Documents/Love/Balatro/Balatro-for-Linux
Hidden=false
NoDisplay=false
StartupNotify=false
Terminal=false" > Balatro.desktop
sudo chmod 777 Balatro.desktop
rm Balatro.love
else
echo "There is no love executable in this folder"
fi
Get the Game Scripts
The first step to being able to play the game on another platform than windows is to get the game's code. Thankfully the game is made in the Lua scripting language and isn't compiled.


  • 1. Install the game:

    Install the Balatro Version you want to play on your computer natively, you can also use the experimental version of the game if you wish. To do so, right click on th game in your Steam Library and select the Browse Local files button under the Manage category.













    This should open your file manager and you should see the Balatro game files.


  • 2 Move the files:

    Copy the Balatro.exe file in the folder and paste it in a folder you can find easily.

    I will call that directory gamedir in this Tutorial including in the commands and paths (mostly for other chapters)


  • 3.Test if the game works :

    To Simply play the game without doing too much, install love2d from your distros's package or the unofficial flatpak and rename Balatro.exe to Balatro.love. If you don't know how or want to package it, skip to the next chapter.

    Congrats, you can now play the game using Love natively.


  • 4.(Optional) Transfer save data:

    Your Steam Save data is located at:

    /home/<yourusername>/.steam/steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/Application Data/Balatro

    You can copy the save to and from

    /home/<yourusername>/.local/share/love/Balatro

    This is assuming your .love executable is Balatro.love, if it isn't, replace Balatro in

    /home/<yourusername>/.local/share/love/Balatro

    by the executable name you used.


To:

  • use native Wayland + a dedicated GPU,
  • make it a Linux Executable,
Follow the next Chapters
Get Love 11.5 and make an executable
This part is done using the löve wiki about distribution with appimages[love2d.org] you may have to scroll down to find it. Everything you need to do is here though.

Balatro as of 1.0.1c uses the LÖVE Framework version 11.5, so we have to download that.

  • 1.Trying the Balatro.love method:

    Install Love from yout repo or Flathub (unofficial)

    Fedora: sudo dnf in love
    Debian: sudo apt-get install love
    Flathub: https://flathub.org/fr/apps/org.love2d.love2d

  • 2. Open the game:

    Double click Balatro.love or open it with löve.

    The rest of this tutorial is of you want to make a Balatro Linux Executale or Appimage so that you don't need to install love.

    Depending on your distro's SDL version, the game might already run natively on Wayland.

  • 3. Download the AppImage

    You can use the link here to donwload the love appimage: https://github.com/love2d/love/releases/download/11.5/love-11.5-x86_64.AppImage

    Or just go to love2d.org and download the Appimage

    Finally make it executable. You can right clikc and go to file properties and allow it to be executed or just use the chmod command like this:

    chmod +x love-11.5-x86_64.AppImage

  • 4. Extract the appimage

    To extract the appimage to insert you game into it, add the --appimage-extract to the appimage execution command.

    You need to be superuser to do that so the whole cmmand looks like this:

    sudo ./love-11.5-x86_64.AppImage --appimage-extract

    Once done, a squashfs-root folder will appear where you had the appimage downloaded.

  • 5. Merge the Balatro code with the love framework for Linux binary

    After copying the squashfs-root folder contents, paste them in your gamedir folder (easy to find later folder you create and choose the name of, I put mine in Documents/Balinux).

    If you followed Chapter one correctly and this chpter from now on, there should be multiple folders and files in the gamedir folder. Open you trminal app here (right click > Open Terminal here or do cd /pth/to/your/gamedir). And do the following command to merge Balatro.love and the love binary located in the bin folder:

    cat /bin/love Balatro.love > /bin/Balatro

  • 6. Launch the Game

    The AppRun file will not launch the game anymore as it's been renamed. YOu can edit it so that executing it will launch the Balatro executable at line 29-33:

    if [ -z "$FUSE_PATH" ]; then
    exec "$APPDIR/bin/Balatro" "$@"
    else
    exec "$APPDIR/bin/Balatro" --fused "$FUSE_PATH" "$@"
    fi

    You might have to use chmod -x on the Balatro binary and the AppRun script for them to work. You can also right click them > go to Properties > turn on to allow execute (File manager dependant)

You should now be able to run the Linux Balatro Executable either by double cliking/execting in terminal or using the AppRun script. This solution will not support Wayland as the SDL version used out of the box by love isn't new enough. The executable will use X11 or XWayland but the next chapter is dedicated to fixing that.
Wayland Support and Fixes
if you have followed the previous steps correctly, there should be a "lib" folder in your gamedir.

These are the libraries Löve uses to run and show a window.

Unfortunately, the SDL version shipped with Löve 11.5 (libSDL2-2.0.so.0) isn't Wayland ready. You can test that by doing:

SDL_VIDEODRIVER=wayland ./bin/Balatro

in yout gamedir folder.

Here's the example of my output:


To use Wayland:

  • 1. Get libSDL 2.30.2 (latest SDL2 version)

    You can compile it yourself with these instructions:

    https://wiki.libsdl.org/SDL2/Installation

    Or download the version I compiled myself on Fedora 39 86_64:

    https://cdn.discordapp.com/attachments/1080631091750244412/1229174728506212372/4tb2g66.0?ex=662eb92c&is=661c442c&hm=cc9c6ac42b57fba42c972ccbfd9188f58371361775bfa774a3f7a87d62ce6ab5&


  • 2. Replace the libSDL2-2.0.so.0 by the latest

    After compiling or downloading or getting in any way a Wayland ready SDL.so library, replace the libSDL2-2.0.so.0 in gamedir/lib by yours.

    You should rename SDL library obtained to the default libSDL2-2.0.so.0 as it probably won't recognize it if you don't (the version I compiled has it's name randomized).


  • 3. Test the game now

    Use this command to launch the game using Wayland natively.

    SDL_VIDEODRIVER=wayland ./Balatro

    If you feel like there is low FPS you can use manguhud to see your FPS:

    SDL_VIDEODRIVER=wayland mangohud --dlsym /Balatro

    You have to have manguhud installed


  • 4.Force using dedicated GPU if it isn't

    If you indeed have low FPS, SDL might be using you integrated GPU, as it was doing in my case.

    This should only be an issue on Laptops or Computers with 2 GPUs (the processor integrated one + dedicated)

    I used Nvtop (terminal task manager specialized in GPU) and saw my GPU 0 (Nvidia dedicated gpu) wasn't used.

    You need to add these argumatns befora the command:

    AMD dedicated GPU:

    DRI_PRIME=1

    Nvidia dedicated GPU:

    __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia

    Here's the whole command for Wayland + Dedicated Nvidia GPU:

    __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia SDL_VIDEODRIVER=wayland mangohud --dlsym /path/to/your/gamedir/bin/Balatro

The last chapter will be dedicated to Link your savefiles.

Sync your progress through Steam
There are now 3 ways of playing Balatro:

  • On Steam with Proton
  • With Löve installed execution Balatro.love
  • With the extracted appimage/self sufficient executable

Unfortunately, the saves for these versions aren't saved to the same places.

The Steam Balatro Save is at:

/home/you/.steam/steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/Application Data/Balatro
19 Kommentare
Damglador 16. Apr. um 10:41 
Google ValveSoftware Proton
CsyeCok The Soldier of Sykhiv 16. Apr. um 2:39 
Wait, this has to be compiled? Doesn't Balatro run natively on Steam Deck which is comes with a Linux system?
Damglador 15. Apr. um 11:14 
Thanks, saved me a lot of time on research.
yxk 29. Jan. um 8:38 
Settings -> Compatibility -> Enable Steam Play for all other titles
Idk whats happening under the hood, but you can download through the library and play it without any issues.
cetaceanHandiwork 19. Jan. um 23:09 
Useful tip if you're experiencing freezes: Balatro *really* prefers to run in LuaJIT rather than any other Lua implementation. If you're on a Linux distro that lets you pick what Lua implementation is used for Löve2d, be sure it's set to LuaJIT.
Fox 11. Jan. um 13:40 
Actually I did a different thing.

I made a github repo for it -- you can install it as a Compatibility Tool, and it will run Balatro (and any other Love game) natively from Steam, directly, no messing around.

Still requires manual work; download file, make executable, place in folder, edit launch.sh file, etc -- should be within reach and I'm open to PRs to make it more automated!

https://github.com/codefaux/steam-compat-love
Fox 11. Jan. um 12:48 
Also you can symlink native Balatro save file location to where Steam expects it, for native gameplay with cloud save support.
Fox 11. Jan. um 11:30 
I found an easier way for you.

Download the love AppImage. Copy Balatro.exe to the same location.

Run `./love-11.5-x86_64.AppImage Balatro.exe`

Love does the rest of the magic for you.
Enderteck  [Autor] 9. Dez. 2024 um 14:46 
I'm also gonna revamp this guide a lot, making it way easier (I hope)
Enderteck  [Autor] 9. Dez. 2024 um 14:45 
Or ask Yusamika