sultim-t / xash-rt

Fork of the Xash3D FWGS with a real-time path tracing
1.09k stars 24 forks source link

Running Parabot with Xash-RT #29

Open tokariu opened 1 year ago

tokariu commented 1 year ago

I tried adding the latest Parabot for Xash3D to play LAN Multiplayer with bots. But it doesn't work.

Parabot for Xash3D: https://www.moddb.com/engines/xash3d-fwgs-engine/downloads/parabot-cb-092win32-linux

Xash-RT is: Xash3D FWGS 49/0.20 (win32-amd64 build 2882)

when trying to add parabot I get: Error: can't initialize addons/parabot/dlls/parabot_amd64.dll: FAiled to find library addons/parabot/dlls/parabot_amd64.dll

obviously because there is only parabot.dll. which is obviously 32-bit only and it looks for a 64-bit .dll variant.

I can't find a 64-bit version of parabot anywhere. is it possible to run the 32-bit dll with Xash-RT? which is obviously a win32-amd64 build?

a1batross commented 1 year ago

You can compile it from source code, looks like from https://github.com/nekonomicon/Parabot, as it has our AMD64 support extension.

Also cc @nekonomicon

tokariu commented 1 year ago

I don't have visual studio available atm. is anybody maybe able to compile a 64-bit version of the available old source code and link it?

nekonomicon commented 1 year ago

You need mingw-w64, not visual studio.

tokariu commented 1 year ago

@nekonomicon

You need mingw-w64, not visual studio.

i compiled with gnu and: make PB_64BIT=1, the output is a parabot64.dll, but it is still not working with Xash-RT.

I have the default 32-bit parabot.dll from the moddb release in /valve/addons/parabot/dlls/parabot.dll, it is linked correctly in the valve/liblist.gam file.

when I start the game, the game looks for a parabot_amd64.dllfile. the console tells me: Error: can't initialize addons/parabot/dlls/parabot_amd64.dll: Failed to find library addons/parabot/dlls/parabot_amd64.dll

Now, when I put the freshly build 64-bit parabot64.dll as parabot_amd64.dll in the same dir like: /valve/addons/parabot/dlls/parabot_amd64.dll the console tells me: Error: Can't initialize "/valve/addons/parabot/dlls/parabot_amd64.dll" %1 is no valid Win32-Application

so whatever I use, 32 bit or 64 bit, it always asks for the other option.

any help from hereon? or maybe you just want to release a the 64 bit version that works with Xash-RT?

tokariu commented 1 year ago

ah in all the hustle I didn't notice my box used mingw 32 bit, my fault..

trying the same with mingw64 now, and I get a lot of compilation errors like:

../bot/pb_weapon.cpp:96:30: error: narrowing conversion of '0.0' from 'double' to 'bool' [-Wnarrowing] 96 | { "", 0, 0.0, false, 0.0 }, { "", 0, 0.0, false, 0.0 }, { "", 0, 0.0, false, 0.0 }, | ^~~

I'm not too familiar with C and type conversions. either it's possible to fix it in the compile or it is a lot more to rewrite in the code. if you mind, let me know what to do from here.

Edit: I made it compile without errors by changing all the problematic values to bool 0. I get a parabot64.dll (AMD64) without errors now.

However, when I use this file in the game, I still get: Error: Can't initialize "/valve/addons/parabot/dlls/parabot_amd64.dll" %1 is no valid Win32-Application

nekonomicon commented 1 year ago

@tokariu try to remove -m32 flag from Makefile.

tokariu commented 1 year ago

@tokariu try to remove -m32 flag from Makefile.

I removed -m32 here:

CFLAGS += -m32
LDFLAGS += -m32

and compiled it again and still get the same error ingame: Error: Can't initialize "/valve/addons/parabot/dlls/parabot_amd64.dll" %1 is no valid Win32-Application

the dll output is identical.

I just had a 2nd look at the makefile.. and it's obviously not changing anything because with PB_64BIT flag and x86_64 check, it jumps over the -m32 flag already, see context:

ifneq ($(PB_64BIT),1)
MODULE =    parabot
ifneq (, $(findstring x86_64, $(SYS)))
CFLAGS += -m32
LDFLAGS += -m32
endif
else
MODULE =    parabot64
endif

I'm out of ideas here, this is something for the ones with more knowledge in C coding than me.

Edit:

I also changed the block to:

CFLAGS= -m64
CXXFLAGS=   -m64
LDFLAGS=    -m64
MODULE =    parabot64

..for testing, but it is the same result.

Beyond Compare confirms it's a 64-bit dll, with PE Header: Windows NT, AMD64. Maybe it's just Xash3D/RT that is not working with Parabot here at all, idk. If I use the 32-bit dll it asks for a 64-bit dll. when I use the 64-bit dll it complains it is no valid 32-bit application, makes no sense.

tokariu commented 10 months ago

I tried compiling it once again now and using it with an updated version of Xash-RT.

This time it seems I was able to compile a functional 64-bit version of Parabot with a different minigw-w64 build.

I compiled the latest parabot source (git files directly, not the release zip which is outdated) with make parameters: make PB_64BIT=1 LTO=0 DEBUG=0 AGGR_OPT=1 NO_EXCEPTIONS=1 after making some fixes to pb_weapons.cpp (see some posts above).

it's fine so far, I've got a working parabot64.dll that I can use as parabot_amd64.dll in the half-life-RT instance.

However, while it is now finally finding and loading a 64-bit dll correctly, it seems the parabot version is incompatible with the xash-RT version.

whenever I start xash3d-RT with the new 64-bit parabot.dll I'll get the following errors: hl-rt-parabot

i guess when the error reads something like "MODs .." it means either the xash3d-RT version or the /valve/ content folder as mod (I used the latest steam half-life (non-source) version that's been updated recently)

@nekonomicon maybe you can find a fix more easily?

nekonomicon commented 10 months ago

Parabot trying to find 64-bit hl.dll. If you didn't rename hl_amd64.dll it will not work.

after making some fixes to pb_weapons.cpp (see some posts above).

You can avoid errors with -std=c++98 in CFLAGS

tokariu commented 10 months ago

Parabot trying to find 64-bit hl.dll. If you didn't rename hl_amd64.dll it will not work.

after making some fixes to pb_weapons.cpp (see some posts above).

You can avoid errors with -std=c++98 in CFLAGS

thanks for the cflags hint, will try next time.

the original \valve\dlls\hl.dll comes as hl.dll not as hl_amd64.dll. that's the one we copy from the steam folder I don't compile anything new there.

I've got: \valve\dlls\hl.dll (nothing changed here, directly from steam) and \valve\addons\parabot\dlls\parabot_amd64.dll (the file that I compiled as parabot64.dll)

this combination gives me the errors from the screenshots above.

renaming parabot_amd64.dll -> parabot.dll and the console tells me it wants to have parabot_amd64.dll file. renaming hl.dll -> hl_amd64.dll and using parabot_amd64.dll gets the same results.

it's probably a 32-64 bit version mismatch then I guess?

xash3d (without RT) works with the original parabot.dll (32-bit), as it is running as 32-bit application (shown in task manager) xash-RT asks for parabot_amd64.dll (and runs as native 64-bit app in task manager)

I can't compile hl.dll as 64-bit - obviously, I don't have the HL source ;)

but then.. how is xash-RT as 64-bit application using 32-bit hl.dll and still working...?

any other ideas?

nekonomicon commented 10 months ago

but xash-RT has hl_amd64.dll in rt/valve/dlls directory

tokariu commented 10 months ago

that was the golden hint! I got it workin!

it's not solely done with renaming the rt/valve/dlls/hl_amd64.dll because parabot.dll is only looking for it in the non-RT valve folder!

I'll try to sum things up tomorrow. But for now, bots are joining in a path traced multiplayer map FINALLY, yey! (too bad the classic multiplayer maps haven't been modded yet to fix the lightning - flashlight FTW!)

tokariu commented 10 months ago

well, I don't have the time to write a detailed install summary, but it's essentially like:

if anybody wants me to upload the compiled 64-bit parabot version let me know or tell me where to upload.

I also converted the lighting in all the standard multiplayer maps to work with HL-RT. If anybody wants them I could upload them too. Or you can just follow sultim-t's guide on how to convert custom maps and do it yourself.

good luck and have fun :)

Thanks @nekonomicon for making Parabot and the helping hands. Thanks @sultim-t for this path traced project!

nekonomicon commented 10 months ago

@tokariu I'm not original Parabot author. I only made some changes in existed code.

maxresd3fault commented 5 months ago

@nekonomicon Hey I don't mean to bump an old thread and this is somewhat unrelated but I don't know how else to reach you since the Parabot repo is locked.

I'm trying to compile on Linux, got the same Wnarrowing errors but used the cflag to ignore them. It compiles fine and I get the parabot.so file, but as soon as I try and run it on a server a get an error along these lines:

LoadLibrary failed on am/s���: am/s���: cannot open shared object file: No such file or directory Host_Error: Couldn't get DLL API from am/s���! FATAL ERROR (shutting down): Host_Error: Couldn't get DLL API from am/s���!

In this build I didn't make any changes to the code yet, I tried both the latest release tarball and a git clone with the latest code. Again sorry for the somewhat off topic reply but I really don't know where else to go to get help, this is the only thread that talks about building this thing.

nekonomicon commented 5 months ago

@maxresd3fault I'm always available in FWGS discord conference anyway. For which architecture this binary was compiled? And what are you trying to load? Also, if you use GoldSource will be better to use metamod because I made some mistakes into initialization code. It was already fixed, but only into private branch.

maxresd3fault commented 5 months ago

@nekonomicon Compiled for just normal 32bit. I tried just loading it through liblist, but only after loading it through meta mod where it also didn't work.