dhewm3 icon indicating copy to clipboard operation
dhewm3 copied to clipboard

Exclude unnessesary stuff from dedicated server build

Open tyabus opened this issue 3 years ago • 11 comments

I've noticed that dedicated server build dosen't exclude client-related stuff that will be never used. (Even OpenAL check is present in cmake. (Tried with -DDEDICATED=1 only and -DDEDICATED=1 -DCORE=0)) I also think that dedicated server shouldn't have any external dependances (except for zlib) This will help dhewm3ded compile and run on platforms that are usually headless (there is actually android tablets on mips SoC's 0_o)

tyabus avatar Dec 22 '21 08:12 tyabus

Even OpenAL check is present in cmake.

because dhewm3ded needs a header from openal - it doesn't actually link it though (uses empty dummy functions instead)

I also think that dedicated server shouldn't have any external dependances (except for zlib)

That would be too much work - for example I'd have to add platform-specific reimplementations of all things we currently use SDL for.

I don't think dhewm3ded actually has any external dependencies except for SDL2 and zlib. OpenAL is only needed for a header, curl is optional - and apart from that it only uses standard system libs like libc, libstdc++, libpthread etc

DanielGibson avatar Dec 22 '21 19:12 DanielGibson

Even OpenAL check is present in cmake.

because dhewm3ded needs a header from openal - it doesn't actually link it though (uses empty dummy functions instead)

I also think that dedicated server shouldn't have any external dependances (except for zlib)

That would be too much work - for example I'd have to add platform-specific reimplementations of all things we currently use SDL for.

I don't think dhewm3ded actually has any external dependencies except for SDL2 and zlib. OpenAL is only needed for a header, curl is optional - and apart from that it only uses standard system libs like libc, libstdc++, libpthread etc

I've had error about missing glu/glu.h in some file... I'll check as soon as i arrive at home.

tyabus avatar Dec 23 '21 03:12 tyabus

Even OpenAL check is present in cmake.

because dhewm3ded needs a header from openal - it doesn't actually link it though (uses empty dummy functions instead)

I also think that dedicated server shouldn't have any external dependances (except for zlib)

That would be too much work - for example I'd have to add platform-specific reimplementations of all things we currently use SDL for.

I don't think dhewm3ded actually has any external dependencies except for SDL2 and zlib. OpenAL is only needed for a header, curl is optional - and apart from that it only uses standard system libs like libc, libstdc++, libpthread etc

About OpenAL, why not make own null include for dedicated or just exclude sound*.cpp files and maybe make some stub?

tyabus avatar Dec 23 '21 16:12 tyabus

@DanielGibson I've successfully managed to compile and run dhewm3 server on mipsle ;) https://youtu.be/TkuEuxGBv5E

The only strange thing i've noticed that input in server console is getting doubled visually, i guess that's an SDL2 bug. And for some reason engine threw sys_error telling that SDL2 was built without video, then joystick support.

tyabus avatar Dec 23 '21 18:12 tyabus

And for some reason engine threw sys_error telling that SDL2 was built without video, then joystick support.

setting the use of DUMMY video environment variable when you compile the ded server should solve this, there should be something for the JOYSTICK as well

paulwratt avatar Dec 25 '21 05:12 paulwratt

And for some reason engine threw sys_error telling that SDL2 was built without video, then joystick support.

setting the use of DUMMY video environment variable when you compile the ded server should solve this, there should be something for the JOYSTICK as well

I did exactly that, but why engine would throw error about that in the first place for dedicated server build

tyabus avatar Dec 25 '21 10:12 tyabus

@DanielGibson I've successfully managed to compile and run dhewm3 server on mipsle ;) https://youtu.be/TkuEuxGBv5E

Ha, nice! How is performance? Is this playable? (I noticed the FPS are low, but assumed it was due to the machine the client runs on, not due to the server?)

The only strange thing i've noticed that input in server console is getting doubled visually, i guess that's an SDL2 bug.

Weird, I'll have to check if that happens on normal Linux as well

And for some reason engine threw sys_error telling that SDL2 was built without video, then joystick support.

I guess the errors you're referring to are from https://github.com/dhewm/dhewm3/blob/5becb2d14d7b3b4eddd73edb5d9160d3dfa52fd9/neo/framework/Common.cpp#L2910-L2923 I guess the joystick error could be fixed by removing SDL_INIT_JOYSTICK (which only was a workaround for an old SDL2 bug anyway). But I have no idea why there's an error about video, after all the "SDL_VIDEODRIVER" environment variable is set to "dummy" right before SDL_Init(). When you built SDL2, was the dummy video driver enabled? To make sure, you can explicitly pass --enable-video-dummy to SDL2's ./configure (though it should be enabled by default).

DanielGibson avatar Jan 05 '22 03:01 DanielGibson

input in server console is getting doubled visually, i guess that's an SDL2 bug.

not sure what you mean, but I think I can't reproduce it on regular Linux. I doubt it's an SDL bug, because IIRC the server console doesn't use SDL for input/output but regular printf() etc

DanielGibson avatar Jan 05 '22 06:01 DanielGibson

input in server console is getting doubled visually, i guess that's an SDL2 bug.

not sure what you mean, but I think I can't reproduce it on regular Linux. I doubt it's an SDL bug, because IIRC the server console doesn't use SDL for input/output but regular printf() etc

I'd guess he gets a local and a remote echo in terminal.

j4reporting avatar Jan 05 '22 09:01 j4reporting

@DanielGibson I've successfully managed to compile and run dhewm3 server on mipsle ;) https://youtu.be/TkuEuxGBv5E

Ha, nice! How is performance? Is this playable? (I noticed the FPS are low, but assumed it was due to the machine the client runs on, not due to the server?)

The only strange thing i've noticed that input in server console is getting doubled visually, i guess that's an SDL2 bug.

Weird, I'll have to check if that happens on normal Linux as well

And for some reason engine threw sys_error telling that SDL2 was built without video, then joystick support.

I guess the errors you're referring to are from

https://github.com/dhewm/dhewm3/blob/5becb2d14d7b3b4eddd73edb5d9160d3dfa52fd9/neo/framework/Common.cpp#L2910-L2923

I guess the joystick error could be fixed by removing SDL_INIT_JOYSTICK (which only was a workaround for an old SDL2 bug anyway). But I have no idea why there's an error about video, after all the "SDL_VIDEODRIVER" environment variable is set to "dummy" right before SDL_Init(). When you built SDL2, was the dummy video driver enabled? To make sure, you can explicitly pass --enable-video-dummy to SDL2's ./configure (though it should be enabled by default).

No, i passed --disable-video, performance really impressed me, keep in mind that i used nfs for swap and game resources (router has 128mb ram 128 mb flash). Router started to struggle on ragdoll spawn after i killed other player.

tyabus avatar Jan 07 '22 05:01 tyabus

input in server console is getting doubled visually, i guess that's an SDL2 bug.

not sure what you mean, but I think I can't reproduce it on regular Linux. I doubt it's an SDL bug, because IIRC the server console doesn't use SDL for input/output but regular printf() etc

I'd guess he gets a local and a remote echo in terminal.

Probably, but i've never encountered something like that before... I wonder what causes that to happen

tyabus avatar Jan 07 '22 05:01 tyabus