Frets On Fire - FOFix Help

Discussion in 'Games' started by booman, Jun 18, 2020.

  1. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    I posted a guide years ago on running Frets On Fire FOFix in PlayOnLinux with Xbox Guitars.
    My family and I would play it from time to time and I even migrated the virtual drive (wineprefix) from one computer to another computer.

    I played it recently and found a problem... the song starts in time with the notes but quickly goes out-of-sync.
    This has never happened before in PlayOnLinux/Wine so I start troubleshooting the problem.
    Tried several versions of Wine and configurations. Even tried settings in game that delay the notes, but nothing worked.

    So now I'm stumped and wonder if recent updates are hurting the synchronization?
    The game it-self runs great, no slow-down or anything...

    In my research I was reminded that a Linux version is available from source, so it has to be compiled.
    Not the end of the world, but I've only tried compiling something two times in the many years of Linux gaming.
    I can't find any available binaries online, so should I compile it?

    https://code.google.com/archive/p/fofix/
    https://github.com/fofix/fofix
  2. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    I'll look into this and get back to you on what is needed, most likely during the weekend.
  3. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Sure no problem. I don't mind compiling if it actually works...
    Take your time... I'm in no hurry
  4. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    Since Arch packages all development headers in the normal packages, I decided to install Mint in VirtualBox so I could make sure I know which packages are required. First off, you will want to install the following packages in your mint:

    • build-essential
    • ffmpeg
    • python-dev
    • freeglut3-dev
    • libsdl2-dev
    • libsdl2-mixer-dev
    • libogg-dev
    • libvorbis-dev
    • libtheora-dev
    • libsoundtouch-dev
    • libswscale-dev
    • python-virtualenv
    • virtualenv
    • portaudio19-dev
    Or if you just want a line to copy into your terminal:

    Code:
    sudo apt install build-essential ffmpeg python-dev freeglut3-dev libsdl2-dev libsdl2-mixer-dev libogg-dev libvorbis-dev libtheora-dev libsoundtouch-dev libswscale-dev python-virtualenv virtualenv portaudio19-dev
    Now you want to download the source code from github, the latest stable release is actually quite old so it's probably best to just download the master branch:

    https://github.com/fofix/fofix/archive/master.zip

    unzip it and enter into the folder. Now you want to open up a terminal in the extracted archive's directory. Running this program will require some python libraries, and I could not find all of them as system packages in Mint, so we will use pip to install them. However, we don't want pip to install stuff system wide as that can lead to breakage, so we will create a virtual environment for python. Do make sure you are in the directory for the extracted archive before you run the following commands.

    First we create the virtual environment:
    Code:
    virtualenv -p python2 venv
    All the following commands must be run from the same terminal without exiting, so don't close the terminal before you have done the following commands. First we enter into the virtual enviroment:
    Code:
    source venv/bin/activate
    Then we install the python requirements in the venv:
    Code:
    pip install -r requirements.txt
    Then we build the required modules:
    Code:
    python setup.py build_ext --inplace --force
    Generate translations:
    Code:
    python setup.py msgfmt
    Lastly you can run the game to test that everything works:
    Code:
    python FoFiX.py
    In order to launch the game in the future, you will need to enter into the virtual environment, the most convenient way to do that would be to use a launch script, so create a launch script with the following content. Make sure to replace /path/to/fofix/directory with the actual path.

    Code:
    #! /bin/bash
    cd /path/to/fofix/directory
    source venv/bin/activate
    python FoFiX.py
  5. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Wow!!! This is exactly why I don't compile anything. That is a lot of steps!
    Any down-side to installing all of these packages and compiling FOFix?

    I will try this today!

    Thank you Daerandin!
  6. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    The packages you install are just that, packages. The only downside is that they will take up a little bit of hard drive space.

    Compiling FoFiX itself does not install anything system-wide, everything is contained within the directory. The pip install command will also only install the python packages in a virtual environment contained within the directory of FoFiX.

    Normally it is not this much of an involved process to compile software, but the more external libraries and other software something relies on, the more complicated the process becomes.

    The process above is basically just three steps. First install the required dependencies, which was listed in the readme on github. It is important to get the development headers for the packages, hence the -dev ending on the packages.

    Next we need some specific python dependencies, and FoFiX wants specific versions, so we use pip for that. Installing through pip system wide is a bad idea, so we create a virtual python environment in which to install the python packages.

    Third step, we compile some of the modules for FoFiX that are written in C or C++, that was all done in a single command. And after that, we can run the program.

    Since the program relies on some python packages that we installed in a virtual environment, then we must ensure we always enter the virtual environment before we attempt to launch the game. It will simply not run if we don't. That is what the launch script is for, saves us having to type out all the commands to enter the environment before launching the game.

    EDIT: Do let me know if some of the steps are unclear or something goes wrong on your end.
  7. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Will the virtual environment effect performance?
  8. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    Not at all. All the virtual environment does is ensure that Python loads and installs libraries within the venv instead of the default system-wide location.
  9. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Oh, so the game isn't running in the virtual environment.
    Do any of these packages require a 64-bit version?
  10. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Also, can you add apt update before the first step.
    I'm trying this on a spare computer and it couldn't find all the packages because I didn't do an apt update
  11. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    Oh yes, do make sure you perform a full system update first. Just do "apt update", and I would suggest you also do "apt full-upgrade" next so that your system is fully updated.
  12. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    I followed your steps and IT WORKED!
    Awesome!

    Now are there any residual files I should remove from the compiling?
    I would like to install some mods and songs, which are basically folders and you can point the game to the songs in-game.

    Last, I'm going to test with an Xbox controller to make sure support is there as well.
  13. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    In most cases you will not need source files, but this program is primarily written in Python, so you will need all the source files. There are probably a few files that can be removed at this point, but they are not taking up any significant space so I would not bother.
  14. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    I messed it up somehow...
    I copied modded themes to the themes folder and tried to switch to them in-game, but now the game doesn't run.
    I'm getting a bunch of Alsa errors.
    Going to compile again and just play a few songs.
  15. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Nevermind, I figured it out. There are Alsa errors every time I launch it, but the audio works fine.
    What happened is the other themes are having a problem and crash the game. I found a .fofix directory under my /home/booman so I deleted it because there were settings in it. Now the game runs again.

    I'm having another problem...
    Frets On Fire will not see my songs. After some troubleshooting, turns out the files in each song directory all need to be lowercase.

    Now I can play a song, but I'm going to have to edit every directory and every file to make it all lowercase.... ugh. At least I only have to do it once.
  16. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Now my next question is... how do I copy this compiled version of Frets On Fire FoFix to another computer?
    When I copy the folder, it errors about symbolic links having to do with then virtual environment.
    Do I need to create another virtual environment on the next computer?
  17. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    Seems like lazy coding on the developers part if having uppercase characters in song names causes a problem. Do keep in mind that this is not the original Frets on Fire, this is a forked version. On the top of the github page it says: "Frets on Fire X: a fork of Frets on Fire with many added features and capabilities"

    As for copying this over to other machines, I would suggest just redoing the process. After all, it only takes as long as typing the commands. Actually, that inspired me to automate the process.

    Code:
    #! /bin/bash
    
    echo "Installing Frets on Fire X, this is intended to be run on Linux Mint 19.3"
    echo "Your system should be fully up to date before doing this, but this installer will update the package database before proceeding just to be sure"
    echo -e "\nYou will be prompted for your password once as it is needed for installing packages\n"
    
    sudo apt update && sudo apt install build-essential ffmpeg python-dev freeglut3-dev libsdl2-dev libsdl2-mixer-dev libogg-dev libvorbis-dev libtheora-dev libsoundtouch-dev libswscale-dev python-virtualenv virtualenv portaudio19-dev
    
    cd ~
    mkdir FoFiX
    cd FoFiX
    curl -L https://github.com/fofix/fofix/archive/master.zip -o master.zip
    unzip master.zip
    rm master.zip
    cd fofix-master
    virtualenv -p python2 venv
    source venv/bin/activate
    pip install -r requirements.txt
    python setup.py build_ext --inplace --force
    python setup.py msgfmt
    deactivate
    
    echo -e "\nCreating a launch script in your home directory named 'FoFiX_launcher' which you can use to launch the game\n"
    
    echo -e "#! /bin/bash\ncd $(pwd)\nsource venv/bin/activate\npython FoFiX.py\n" > ~/FoFiX_launcher
    chmod +x ~/FoFiX_launcher
    Copy all this into a file which you can call FoFiX_installer or something like that. Put it in your home directory, make it executable and run it from terminal. It will handle everything, including the creation of the launch script to actually run the game.
    Last edited: Jun 20, 2020
  18. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Wow! Thank you Daerandin!

    After initially copying the game to another computer and it not running, I went ahead and compiled it on "said" computer and it worked. That script will work much better anyways!

    So at this point I'm renaming all the songs to lower case prefix and extension. It works perfectly!
    Next is configuring both of my guitars so my family can play co-op together.
    The only thing missing is a cool Theme. The basic Metalight theme is so boring.

    I'm doing a bit of research and will report here which themes work in the native Linux version.
    This is awesome! I will have to post some screenshots and videos once I'm done.
  19. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Check this out!
    I was able to program both Xbox controllers, copy our profiles from the old version in PlayOnLinux and migrated my 50 songs.
    Turns out all of the songs audio files need to be lowercase. They are all .ogg files so I had to rename them manually. Then I found that you can add the album art by finding an image online for the band/album and then convert it to .png and rename it: label.png
    If that album art is in the appropriate folder, it will appear as a CD in-game next to the song.
    In fact, it even remember all the previous statistics for who played which song and how many times.

    The only thing I'm having issues with is Themes.
    Right now I'm using the generic theme that comes with the game, but there are a bunch of modded Themes that look amazing! Great features like custom buttons, menus, backgrounds, fretboards and animated buttons.

    Unfortunately most of the themes are no longer available for download and they only support older versions of FoFix.
    I have version 4 which is the last update from 2010 or so...

    I may have to start investigating how to do my own theme. Its kinda like creating a website which I have done plenty of in the past.

    This could be fun or a pain in the butt
    Daerandin likes this.

Share This Page