
# [ffxiv](https://youtu.be/Lrnz2c_D03U)

I am an avid player, and it is a benchmark for me as to how decent linux has become for gaming.

This document aims to describe the installation process, and any fine-tuning that can be done.

_Some steps within may vary depending on your installation, such as your window manager._


## [lutris](https://lutris.net/games/final-fantasy-xiv-online/)

Installing the game has never been easier, but it's easy to accidentally download the normal installer and encounter problems.

_If you are using the normal installer you may have to make many changes to reach a working state, and even then the default launcher that comes with the game is broken and will spout errors and erratically crash depending on how you click through it._

The lutris installer using the XIVLauncher is an amazing improvement, since it not only downloads the game much faster, but it works without any of those errors.

> I highly recommend using the lutris XIVLauncher installation, and the later steps on this guide will assume you did.

My installation location is:

	export WINEPREFIX="$HOME/games/pc/ffxiv/lutris"

_Commands used in this guide will be written assuming you used the same, so adjust them accordingly._

Additionally, the current version of Lutris XIVLauncher will install Wine 6.10, which can be added to your path for manual execution like so:

	export PATH="$HOME/.local/share/lutris/runners/wine/lutris-6.10-7-x86_64/bin:$PATH"

If you are worried you can create a copy of your installation at any point with this command:

	cp -a "$WINEPREFIX" "${WINEPREFIX}.bak"

Finally, you can launch the game through lutris with a terminal via:

	lutris lutris:rungame/final-fantasy-xiv-online

_This can be useful when scripting._


### [gshade](https://gposers.com/gshade/)

Custom GPU processing can be added to further improve the graphic fidelity of the game, and the results can be very impressive.

To add them, simply clone the repository, set your exports, and run the script:

	export PATH="$HOME/.local/share/lutris/runners/wine/lutris-6.10-7-x86_64/bin:$PATH"
	export WINEPREFIX="$HOME/games/pc/ffxiv/lutris"
	./gshade_installer.sh

Afterwards when you launch the game, you can open gshade settings with shift+f2, which will allow you to tweak the configuration.

> You may experience some stuttering when using the gshade configuration menu, so bear with it, the results will be worth it.

Some recommended presets:

- OMGEorzea
- Espresso Glow Shadowbringers Gameplay
- Witch's Moon Gameplay
- Shenova Gameplay
- Neneko Adventurer Gameplay
- Maya Happiness Gameplay
- okami gameplay

_So far my favorite has been Espresso Glow's Shadowbringers Gameplay configuration._


### [act](https://advancedcombattracker.com/download.php)

The Advanced Combat Tracker does work on linux, but it takes some tinkering for best results, and it is far from perfect.

> Using ACT can be helpful to improve your own gameplay, but it is against FFXIV TOS and should never be used to judge or tell other players they are doing poorly.  **Use it at your own risk.**

By default ACT will run, but only memory parsing will work, which is said to be inaccurate.

You can use the [ffxiv-tools](https://github.com/valarnin/ffxiv-tools) scripts to modify your installation, which takes out the hard parts and gives you scripts to launch things with.  _If you do not feel comfortable applying changes yourself, this is absolutely recommended._

Or you can run these commands manually to apply the patches:

	export PATH="$HOME/.local/share/lutris/runners/wine/lutris-6.10-7-x86_64/bin:$PATH"
	export RPATH="$HOME/.local/share/lutris/runners/wine/lutris-6.10-7-x86_64/lib64:$HOME/.local/share/lutris/runners/wine/lutris-6.10-7-x86_64/lib:$HOME/.local/share/lutris/runtime/lib32:$HOME/.local/share/lutris/runtime/steam/i386/lib/i386-linux-gnu:$HOME/.local/share/lutris/runtime/steam/i386/lib:$HOME/.local/share/lutris/runtime/steam/i386/usr/lib/i386-linux-gnu:$HOME/.local/share/lutris/runtime/steam/i386/usr/lib:$HOME/.local/share/lutris/runtime/lib64:$HOME/.local/share/lutris/runtime/steam/amd64/lib/x86_64-linux-gnu:$HOME/.local/share/lutris/runtime/steam/amd64/lib:$HOME/.local/share/lutris/runtime/steam/amd64/usr/lib/x86_64-linux-gnu:$HOME/.local/share/lutris/runtime/steam/amd64/usr/lib:"
    patchelf --set-rpath "$RPATH" "$(which wine)"
    patchelf --set-rpath "$RPATH" "$(which wine64)"
    patchelf --set-rpath "$RPATH" "$(which wineserver)"
	sudo setcap cap_net_raw,cap_net_admin,cap_sys_ptrace=eip "$(which wine)"
	sudo setcap cap_net_raw,cap_net_admin,cap_sys_ptrace=eip "$(which wine64)"
	sudo setcap cap_net_raw,cap_net_admin,cap_sys_ptrace=eip "$(which wineserver)"

> To summarize: Specific `setcap` options will cause the wine binaries to ignore the `LD_LIBRARY_PATH`, which can be worked around by explicitly setting the `RPATH` on those binaries.

Since `setcap` provides special permissions to the binaries it requires root access.  _As such, this can be potentially dangerous, and could also break other lutris titles sharing that wine version._

As with the wine prefix you can backup the lutris wine version with:

	cp -a "$HOME/.local/share/lutris/runners/wine/lutris-6.10-7-x86_64" "$HOME/.local/share/lutris/runners/wine/lutris-6.10-7-x86_64.bak"

You can also use `getcap` on the `wine`, `wine64`, and `wineserver` binaries to verify whether the `setcap` command worked.  _If it did not they will return nothing._

While `ffxiv-tools` will automate downloading ACT and embedding it into your `WINEPREFIX`, it can be run from anywhere so long as you have these exports:

	export WINEDEBUG=-all
	export WINEESYNC=1
	export PATH="$HOME/.local/share/lutris/runners/wine/lutris-6.10-7-x86_64/bin:$PATH"
	export WINEPREFIX="$HOME/games/pc/ffxiv/lutris"
	cd "$(dirname $WINEPREFIX)/act"
	wine64 "Advanced Combat Tracker.exe"

_While `WINEDEBUG` is not required, setting it will reduce load by getting rid of unnecessary verbosity._

Finally, ACT will crash if you try to use `wine` and not `wine64`, because it will attempt to run in 32-bit mode.


#### overlays

The default overlay for me does not work, but the overlay plugin does.

However, these are not flawless, can crash requiring you to try a few times to load them, and can introduce significant latency and require custom configuration dependent on your desktop environment.

For me using openbox if the game is taking up the entire dimensions of my desktop then the overlay will be moved behind it.  I can only get the overlay to stay ontop by adding a custom override to `rc.xml` and changing to windowed mode with 1 pixel shy of the maximum height.  _This can create further performance degradation as the game is no longer in full screen mode._

Finally, ACT may lock up when parsing lots of data and if it does resume it may warn you about it being too slow to process synchronously.  _I have not yet found a solution to this._

Adding this line to my `$HOME/.config/openbox/rc.xml` was needed to get the overlay on top, and required me to name it `Overlay`:

	<application name="advanced*" title="Overlay"><layer>above</layer></application>


## scripts

Since I prefer using `gmrun` with the super+space hotkey to launch programs, here are some scripts you can use!

`/usr/local/bin/ffxiv`:

	#!/bin/bash -ex
	lutris lutris:rungame/final-fantasy-xiv-online

`/usr/local/bin/act`:

	#!/bin/bash
	export WINEDEBUG=-all
	export WINEESYNC=1
	export PATH="$HOME/.local/share/lutris/runners/wine/lutris-6.10-7-x86_64/bin:$PATH"
	export WINEPREFIX="$HOME/games/pc/ffxiv/lutris"
	cd "$(dirname $WINEPREFIX)/act"
	wine64 "Advanced Combat Tracker.exe"
