tomatenquark / code

The code that powers Tomatenquark
https://tomatenquark.github.io/
Other
34 stars 5 forks source link

Suppport for gamemode on Linux #37

Open stephanlachnit opened 4 years ago

stephanlachnit commented 4 years ago

It would be cool if Tomatenquark could add support for gamemode. Basically what it does it changing the CPU gov for the game (and some other performance tricks), and resetting it afterwards, so it should increase performance a bit for some users. It can be integrated in three ways:

  1. Include a header in the main function
  2. Statically link libgamemodeauto (basically the same as 1.)
  3. Dynamically link libgamemodeauto

Since Make isn't exactly very flexible when it comes to build options (it's possible but ugly), I would wait for #22 to be resolved. In Meson, it would be quite simple to give all these three options. At least having both 1. and 3. is nice because that means that one can simply add it for a Steam build without worrying if gamemode is installed, but also Distro shipping Tomatenquark (maybe I'll go for it in Debian if I find the time) can simply link against the system installation of libgamemodeauto.

Calinou commented 4 years ago

Considering Tomatenquark's low system requirements, would enabling GameMode help meaningfully? I guess it doesn't hurt to do it, but we should weigh in the maintenance cost of integrating GameMode.

stephanlachnit commented 4 years ago

Considering Tomatenquark's low system requirements, would enabling GameMode help meaningfully? I guess it doesn't hurt to do it, but we should weigh in the maintenance cost of integrating GameMode.

I don't think it would make a huge difference, but the client integration is really really simple and failsafe (tries to load gamemode if installed on the system, else it does nothing). It's possible to do it in two lines:

#define GAMEMODE_AUTO
#include "gamemode_client.h"

With a build option that would extend to

#ifdef USE_GAMEMODE
#define GAMEMODE_AUTO
#include "gamemode_client.h"
#endif
Fohlen commented 4 years ago

I'd say, given #22 would be merged, I don't see why we should not go for it.

Fohlen commented 4 years ago

@stephanlachnit with #40 becoming merged would you like to do the following:

All the best

stephanlachnit commented 4 years ago

create a vcpkg port for gamemode

I don't think that is necessary, but maybe I'll look into adding a build option. After all, it's literally just one header and four lines.

Fohlen commented 4 years ago

@stephanlachnit I do not like including "just one header". It becomes messy quickly. If gamemode uses CMake we can also use the FetchContent module like so: https://github.com/tomatenquark/code/blob/master/CMakeLists.txt#L71. Anyways. Could you create a PR for this?

stephanlachnit commented 4 years ago

I'm sorry right now I don't really have time for this