How to install the Hammer Editor on Linux

Hurricane Pootis

L1: Registered
Mar 15, 2019
10
8
If you want to use CSGO's sdk, follow this: https://andrealmeid.com/post/2020-05-28-csgo-hammer-linux/

  1. First, open up steam through terminal with -console (steam -console)

  2. You will now see a console tab next to your other tabs on the top bar.

  3. Then, go to the website https://steamdb.info/ and look at your game.

  4. For example, let's look at TF2, who's steam id is 440.

  5. If you go to the depots of 440 (https://steamdb.info/app/440/depots/) you will see a depot with the ID 232251 which provides all of the windows binaries, and the sdk for TF2.

  6. With this now, go back to your steam console and type download_depot 440 232251

  7. This will download that depot into your ~/.local/share/steam/ubuntu12_32/steamapps/content/app_440/depot_232251/

  8. You will want to copy all of the files in the bin folder from the depot into your own bin folder already installed with the linux binaries.

  9. You know have hammer installed. You must now configure wine.

  10. DXVK works for most versions of hammer, but watch out for hammer++.

  11. First, make sure you have winetricks installed. To install on arch, type sudo pacman -S winetricks If you are on another distro, I can't help you there, for I use arch.

  12. If you want to, you can create a separate prefix to manage your winetrick dlls, but I use hammer out of my normal wine prefix, so it's up to your system/configuration.

  13. To open up winetricks, type winetricks into your terminal. If are using another prefix, do WINEPREFIX=.<prefixname> winetricks

  14. Select your default prefix

  15. Select Install a Windows DLL or component

  16. Install MS .NET 4.8, vcrun2003, vcrun2005, vcrun2008, vcrun2010, vcrun2012, vcrun2013, vcrun2015, .NET 2.0

  17. After everything is done installing, navigate to the bin folder where you copy and pasted the windows files into.

  18. Open up a terminal there. If you created a new wine prefix, type WINEPREFIX=~/.<newprefix> wineconsole hammer.bat. If you are using your normal prefix, type wineconsole hammer.bat
    1. After running hammer.bat once, I believe you can just run the exe from here on on, which is reflected in my bash script down below.
  19. Congrats! You now have hammer running on linux. If you want to increase compile times, I would suggest using an esync/fsync enabled wine binaries, alongside using the patched vrad with multi-threaded support.

  20. Here's a picture for proof: View: https://imgur.com/a/aSNLAkd
Extra Info:

This is good enough, but I would also recommend using Lutris. Lutris's version of wine supports fsync, and Lutris itself allows you to customize wine settings much easier than using winetricks itself. Make sure to point Lutris to the wineprefix you made (i.e. ~/.hammer), and to launch from the .exe instead of the .bat.
I have stooped using Lutris, and you should just use a normal wine prefix with wine-tkg-git. If you still want dxvk, you can install dxvk in your wineprefix. On Arch, you install the aur package dxvk-mingw-git, then install it with the command setup_dxvk install

Since some versions of hammer don't work well with DXVK, and I am in love with bash scripts, I made this script that automatically uninstalls dxvk before running hammer, then re-installs after hammer is done running. If you want to use it, modify it for your own system paths :]. This also requires for the dxvk-mingw-git package to be installed.

EDIT:
So, if you run hammer and your 2d viewports are all black, and there is a lot of general flickering within your UI and windows, I highly recommend uninstall DXVK from your wine prefix. If you find it a hassle to use this script to uninstall and reinstall DXVK every time you want to use hammer, you could use a separate wine prefix.

Bash:
#!/bin/bash
#This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
#This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
# Created by HurricanePootis (the license is overkill lol)

_wineprefix=.wine
_tf2install="$HOME/.local/share/Steam/steamapps/common/Team Fortress 2/"

cd "$HOME/$_wineprefix/drive_c/windows/syswow64"
if test -e d3d9.dll.old
then
    setup_dxvk uninstall
else
    :
fi

cd "$_tf2install/bin"

wine hammer.exe
wait

cd "$HOME/$_wineprefix/drive_c/windows/syswow64"
if test -e d3d9.dll.old
then
    :
else
    setup_dxvk install
fi

Edit again: So, it has been a while since I ram hammer, and as of DXVK version 2.2, it looks like both vanilla hammer and hammerplusplus works with DXVK. Therefore, I think it is safe to use DXVK now.


Also, Slammin tools hammer (which I recommend using with the multi-thread vrad) works on Linux too. If you are going to use Slammin, you must and an argument to your launch command. You most add -game (path\to\game\directory\in\wine) If you don't point to your game directory using slammin tools, blended textures don't work. For example, even though I am on Linux, for my argument I have: -game "D:\SteamLibrary\steamapps\common\Team Fortress 2" If you want to find your path to your game reliably, you can type into your terminal wine explorer.exe and copy the path that you get when you go to your tf2 folder. Here's image proof that it works: View: https://i.imgur.com/vt424DX.png

Heads up with hammer++, it segfaults when opening the settings gui. Therefore, I change settings in the text files. ficool2 said it was occuring in the windows kernel, which would be wine in this case. Obviously, this isn't a problem in hammer and slammin' tools hammer, so who knows ¯\(ツ)/¯. Maybe it has changed sine the last time I tried hammer++, it has been a while.
With the latest version of wine-tkg-git it seems like the segfault has been fixed, as I was able to open and edit the menu in hammer++. Edit: Normal wine works too, as of Wine 8.13

Sorry if these seems like a mess, I just wanted to get this info out because I have seen plenty of poor guides for hammer on Linux. If you guess have questions, leave a comment, and I will try to respond
 
Last edited:

Pawlakov

Deliberately incoherent
aa
Jun 1, 2013
189
41
I once tried to run Hammer on my Fedora PC without any success.
I'll try to follow these steps and maybe this time I'll succeed.
Thanks!
 

beeP 2

L1: Registered
Jan 11, 2021
1
0
Hey,

I came across this post wondering how to get hammer working on Linux and your guide has helped me get hammer working for HL2, Thanks a bunch!
 

Vermelho

L1: Registered
Aug 4, 2018
12
1
i do not understand the "You will want to copy all of the files in the bin folder from the depot into your own bin folder already installed with the linux binaries."

Copy what? The Team Fortress 2 folder? Or only TF2 binaries?
And i have errors with hammer: Missing Files is hte problem.
 

Kube

Not the correct way to make lasagna
aa
Aug 31, 2014
1,342
1,849

Copy all the files from the depot "/bin/" over to the "/bin/" folder in your default installation.
Unfortunately I can't help with any Hammer missing files errors :(

Also: I've got HL2 Hammer working on Kubuntu thanks to this tutorial!

upload_2021-6-8_15-24-46.png
 

dblxer

L1: Registered
Jun 16, 2021
6
2
Adding another big thanks! These instructions work for Hammer++ too and Ubuntu MATE.

The only minor thing I've noticed so far that doesn't work is auto-launching TF2 after the map is done compiling. Thankfully it does copy over the *.bsp correctly, so manually launching TF2 through Steam and running `map my_map_name` works as intended.

Screenshot at 2021-06-16 23-42-54.png
 

Hurricane Pootis

L1: Registered
Mar 15, 2019
10
8
A note abote DXVK: I remember DXVK working fine on stock hammer and that one custom version of hammer released before hamemr++ whose name I've forgotten.

However, DXVK gave me microstutters on my system whenever running it with hammer++, so I wrote a simple bash script that will check your wine prefix to see if you have installed dxvk, and it will remove it during the duration hammer is running (this script is written assuming you installed dxvk with a system package using the setup_dxvk command).

Code:
#!/bin/bash
#Created by HurricanePootis
#=================================
cd "$HOME/.wine/drive_c/windows/system32/" || exit

if fd *9.dll.old 1> /dev/null
then
setup_dxvk uninstall > /dev/null #You need to replace the "setup_dxvk" with the/path/to/setup_dxvk if you don't have setup_dxvk in your /usr/bin or /usr/local/bin
else
echo bruh > /dev/null
fi
#=================================
#This section is to check if I am using DXVK, and if I am, to remove it; hammer++ doesn't work with DXVK

cd </path/to/your/steam/library>/steamapps/common/Team\ Fortress\ 2/bin || exit
wine hammerplusplus.exe
wait
setup_dxvk install > /dev/null #You need to replace the "setup_dxvk" with the/path/to/setup_dxvk if you don't have setup_dxvk in your /usr/bin or /usr/local/bin
#This reinstalls dxvk
 

Kube

Not the correct way to make lasagna
aa
Aug 31, 2014
1,342
1,849
For folks who stumble upon this guide, looking to install Portal 2's Hammer Editor on Linux:

1. Install the Portal 2 Authoring Tools from Steam.

2. Right-click Portal 2 Authoring Tools > Properties > General > Launch Options. Set to PROTON_USE_WINED3D=1 %command%

3. Portal 2 Authoring Tools > Properties > Compatibility > Force the use of a specific Steam Play compatibility tool > Proton Experimental

4. Portal 2 > Properties > Compatibility > Force the use of a specific Steam Play compatibility tool > Proton Experimental

5. Launch Portal 2 Authoring Tools

Pro-tip: If you system automatically maximizes new windows, disable that functionality for WM_CLASS(STRING) steam_app_629
 

Kyno

L1: Registered
Nov 3, 2021
13
1
i really didn't want to bump this post, but i've been looking for over 2 hours for a solution to no avail, when i browse textures in hammer, it immediately closes, some people said to check material exclusions in the tf.fgd file in the bin folder, nothing was wrong with that, and i checked tools > options > materials, exclusions were completely empty, so i clicked add but when i went to my tf2 folder nothing was a valid file type, it only let me select folders

if it helps at all, my distro is linux mint and i've installed all the DLLs with no errors
i also tried using hammer++ and it worked, but there was only one entity
 

Hurricane Pootis

L1: Registered
Mar 15, 2019
10
8
You don't need to install any of these
If you're going to install hammer, you're probably going to end up installing tools like GCFScape of vtfeditor, which require/work properly using visual c++ runtimes or .NET (not mono)
 

rafradek

L2: Junior Member
Aug 25, 2018
60
22
If you're going to install hammer, you're probably going to end up installing tools like GCFScape of vtfeditor, which require/work properly using visual c++ runtimes or .NET (not mono)
You don't need any of that to run vtfedit or gcfscape either
 

Hurricane Pootis

L1: Registered
Mar 15, 2019
10
8
You don't need any of that to run vtfedit or gcfscape either
GCFSCAPE, as listed on an archive of Nem's Tools Site, lists Microsoft .NET and Microsoft Visual C++ 2010 SP1 Runtime.
VTFEDIT, as listed on the same archive of Nem's Tools Site, lists Micrososft .NET 2.0 and Microsoft Visual C++ 2005 SP1 Runtime.

Now, as for the .NET, wine comes with a program called wine-mono which is a FOSS implentation of the .NET programming language, and GCFSCAPE, as it's programmed against .NET 4.0+, works perfectly fine with just installing the visual c++ runtime through winetricks. VTFEDIT, however, errors out running with wine-mono, and requires installing .NET 2.0, which in turn uninstalls wine-mono for the entirity of the wine prefix. Henceforth, the .NET 4.0 as well.

Now, I didn't list .NET 2.0 on the post, so I am going to fix that now. My apologies.
 

Redstonemacanic

L1: Registered
Oct 12, 2022
1
0
Thank you so much :)

By the way, if anyone is using SteamOS you type "steam steam://open/console" in Konsole for step 1.
 

suspiciouslyBee

L1: Registered
Jan 5, 2023
1
0
I ran into the issue where Steam was not letting me input commands in CLI, even with using -console. I found a workaround in an unrelated reddit post with using the URI steam://nav/console that brings up the Steam console interface in the client's UI. Other than that, I was able to get thew program to start. Posting this here in case anyone else has this issue. Happy Mapping!
 

turbulence

L1: Registered
Oct 22, 2023
1
0
i have an issue where the 2d views completely break, this happens on both hammer and hammer++