Open jepotter1-archive opened 4 years ago
+1
Though already has an issue created by the maintainer at #47 for an x86 version.
Yes please, a Linux version would be much appreciated.
I don't see a Linux version being possible, it makes use of -hijack
which is, as far as I'm aware, Windows-only and not reproducible.
I tried running TF2 with the -hijack
command line argument on linux just like you would on Windows (./hl2-linux -game tf -hijack
) and indeed, it doesn't appear to work. In fact I can't even launch the game from the command line at all. Maybe you need to run the hl2.sh
script, but I've got no idea how that works.
After looking within the leaked TF2 source code, it does seem that the code responsible for the -hijack
argument is within a #ifdef WIN32
block. So even if it is possible to start TF2 from the command line somehow, I don't think that this argument will work.
https://github.com/PazerOP/tf2_bot_detector/pull/58 eliminates the use of -hijack, which could resolve that roadblock to having Linux support.
The thing is, from what I can tell -hijack
works internally by sending a message to the game window through the Win32 SendMessage
function. The PR simply proposes that this is done directly from this program instead of by launching TF2 with the -hijack
parameter. It still relies upon Windows API functions.
Agreed, TF2 is pretty much the only game i play actively and I play it on Linux.
Hijack command is being removed and replaced with rcon which is platform agnostic. There is more to be done for linux support but that was the big dependency.
Hijack command is being removed and replaced with rcon which is platform agnostic. There is more to be done for linux support but that was the big dependency.
Hey I looked through the project and I am currently studying how it works. So, I have a question abount RCON. Isn't it only for servers? https://wiki.vg/RCON
How can I communicate with my local hl2 with RCON? I've already downloaded rcon client but unfortunately I didn't had success.
Answering @aggserp4
Maybe you need to run the hl2.sh script, but I've got no idea how that works.
You can run in bash by:
cd ~/.local/share/Steam/steamapps/common/Team\ Fortress\ 2
export LD_LIBRARY_PATH="$(pwd)"/bin:$LD_LIBRARY_PATH
./hl2_linux -game tf -hijack test
I discovered that by taking a look at hl2.sh
:
elif [ "$UNAME" == "Linux" ]; then
# prepend our lib path to LD_LIBRARY_PATH
export LD_LIBRARY_PATH="${GAMEROOT}"/bin:$LD_LIBRARY_PATH
fi
But guess what?
After looking within the leaked TF2 source code, it does seem that the code responsible for the -hijack argument is within a #ifdef WIN32 block.
This is 100% true, the command simply doesn't exists in Linux.
@MatMercer you need to provide the -usercon argument on the command line. This is why you need to start TF2 through the tool in the latest version.
Also make sure you are listening on the correct ip (ip 0.0.0.0
) and manually start up the networking if you want to issue commands before you are in a game (net_start
).
Rcon is designed for servers but is not exclusive to it. I'm not sure if this is the same for the linux client but the windows client does accept connections when launched with -usercon
, you do need to set the rcon password or it will deny all requests
Note: ip 0.0.0.0 is a meta address that just listens on all available addresses. Can be a concern in some environments.
@ClusterConsultant is correct about IP. While you should obviously have a firewall set up, TF2BD randomizes the rcon password and port every time tf2 is launched to provide an extra layer of security. If you are just using -usercon by itself, the rcon password defaults to an empty string and the port defaults to 27015.
I'm having trouble remembering, but am empty rcon password may mean that nobody can connect. Not sure.
@PazerOP @ClusterConsultant
It worked, thanks for the help, this are the steps for anyone interested:
You need to install a command line RCON client. It is available in AUR if you use Arch Linux.
cd ~/.local/share/Steam/steamapps/common/Team\ Fortress\ 2
export LD_LIBRARY_PATH="$(pwd)"/bin:$LD_LIBRARY_PATH
./hl2_linux -game tf -console -nologo -usercon
ip 0.0.0.0
rcon_password pass
net_start
rcon -H localhost -p 27015 -P pass plugin_print
It should output:
Loaded plugins:
---------------------
---------------------
@PazerOP @ClusterConsultant
Now I have another question:
When using ping
and status
the output of these commands only appeared in the ingame console. But the command plugin_print
I used as an example above outputted to the rcon
stdout. That's why I used it as an example.
Is ping
and status
not outputting through rcon normal behavior?
It is not. In our case the output is put in a log file and parsed by the application
It is normal for those to not come back through rcon. Those commands need to be passed to the server in order to get a response, and the pseudocode for rcon looks something like this:
BeginCaptureConsoleOutput();
RunCommand();
EndCaptureConsoleOutput();
SendCapturedOutputToRCONClient();
The problem is that RunCommand()
in this case just sends status
or ping
to the server. It doesn't wait for the reply, which takes some amount of time to come back.
plugin_print
(and the commands the TF2BD uses, tf_lobby_debug
/tf_party_debug
) are implemented entirely on the client, and as such their responses are instant and are captured successfully and sent back over rcon.
see https://developer.valvesoftware.com/wiki/Source_RCON_Protocol#Requests_and_Responses for lots of details
@PazerOP @ClusterConsultant
Thanks so much about the explanation! It makes sense, so a limitation is that we can only use commands that doesn't rely in the external server response. I was concerned that there would be differences on the Linux version that could make outputting game status to a external file impossible. But tf_lobby_debug
and tf_party_debug
do work.
Tomorrow I want to take a look about some strategies we would need to make to enable Linux compatibility. In my opinion, maybe create a command line MVP executable, without a gui, would be interesting and wouldn't require too much work. Since we already have a "common lib/api" that both Windows/Linux/Wathever versions could use. As said above, the rcon library is multi-platform. The code needs some refactors but not a lot. The logic is actually very separated from the GUI, and that's great.
Again, thanks for the fast responses.
Theoretically it shouldn't be that much work to just have the whole GUI running on linux, since all of the platform specific stuff related to it should be handled by SDL2. The main blockers for linux right now are probably the missing implementations of these functions: https://github.com/PazerOP/tf2_bot_detector/blob/master/tf2_bot_detector/Platform/Platform.h. I just haven't had a chance to look into how to implement them, but they should be fairly straightforward. The only ones that I'm a bit dubious about are:
ExploreToAndSelect
(not strictly necessary, only used for highlighting the generated debug_report.zip
),BrowseForFolderDialog
(used for the "Browse..." buttons, not essential but quite desirable)OpenURL
(supposedly you can just use system()
but I would hope there is a saner way)Checking in on any progress being made.
Also @PazerOP how do we build for Linux?
Checking in on any progress being made.
Also @PazerOP how do we build for Linux?
@danhab99 Answering your first question, theres definitely progress made but not sure if it works yet (https://github.com/PazerOP/tf2_bot_detector/tree/linux)
No progress has been made since August 5th. Pazer has been busy with non TF2 things for a while. There will be a small announcement made with the release of 1.2 explaining future development priorities which should help explain when the linux version will be coming.
There will be a small announcement made with the release of 1.2 explaining future development priorities which should help explain when the linux version will be coming.
Hasn't 1.2 been released?
Correct. See the "Release Themes" section for relevant information. https://github.com/PazerOP/tf2_bot_detector/releases/tag/1.2.0.798
I sure hope it will be worth the wait for the Linux update
When work begins on this there will probably end up being a ton more issues generated since this is a big project. As they are made they will be added to the linux milestone.
I've been using this in the meantime https://github.com/Googe14/tf2-bot-kicker-gui
I have made some adjustments to another bot detector, it's very hacky and ugly, but it works just fine :) feel free to contribute :) https://github.com/DeWolfRobin/tf2-bot-kicker
Please! People play TF2 on Linux too :)