Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flickering issue on Linux #2

Open
jberclaz opened this issue May 17, 2020 · 3 comments
Open

Flickering issue on Linux #2

jberclaz opened this issue May 17, 2020 · 3 comments
Labels
bug ui Related to the UI

Comments

@jberclaz
Copy link

There is a SDL rendering bug on Linux (not sure about the other platforms) that is causing the screen to flicker in game mode. The fix is simple and described below:

https://sourceforge.net/p/dunelegacy/bugs/75/

@henricj
Copy link
Owner

henricj commented Jul 13, 2020

I've been making some other changes to Dune focused on enabling better testability and to get the game engine off the UI thread. It is definitely a work-in-progress, but among other changes I've simplified the way the screen is drawn. Instead of rendering to a texture and then copying the texture to the screen, it now renders directly to the screen (it should still be double-buffered by the renderer). That change removes the extra SDL_RenderPresent() call.

Anyhow, if you'd still like to see if this solves the flickering problem and don't mind cmake, then grab the "merge2" branch and build with something like this:

git clone --branch merge2 https://github.com/henricj/dunelegacy.git
cd dunelegacy
git submodule update --init --recursive -j 8
IDE/VC/vcpkg/build_vcpkg.sh
mkdir -p out/build/x64-Release
cd out/build/x64-Release
cmake -G Ninja -DCMAKE_BUILD_TYPE:STRING=Release -DVCPKG_TARGET_TRIPLET:STRING=x64-linux ../../..
cmake --build .
ctest

That should resemble what I just used for testing on Ubuntu 20.04, as far as I can remember off the top of my head anyway.

After all that, then src/dunelegacy should be a working executable without screen flickering. If the vcpkg step is skipped, the required libraries should still be found if they are properly installed on the system, but I haven't tested this. In addition to the packages referenced in the build_vcpkg.sh script, The "ninja-build", "git", and "cmake" packages are also needed. If not, then try the version I just tested: 7312aef since I might have broken something since.

The code uses a lot of C++17, so a relatively recent compiler is required. I'm testing with g++9, clang++-10, and the MSVC that comes with VS2019 16.6. I don't know how much earlier one can go without trouble.

Adjust as appropriate for building on RPi. I have no idea how well--or at all--vcpkg works with ARM Linux ("Linux" is supported). It might work, one might need to add a triplet file, or one might want to let cmake find those libraries elsewhere.

There may still be rendering issues on the RPi since the code uses a zillion separate textures when drawing rather than a sprite atlas or two (I might do something about that in the near future, since it should improve rendering performance even on desktop GPUs).

I added an option to select the renderer in the .INI file (look in `~/.config/dunelegacy/``), so if the defaults still flicker, try adding "Renderer = software" under "[Video]" to let SDL do all the rendering work.

@Lestibournes
Copy link

Lestibournes commented Mar 5, 2021

I only get flickering when in full-screen mode. However the game won't let me set a resolution other than the native resolution of my screen, which means that in windowed mode there is always some part of the game's display that is cut-off. In 0.96.3 I didn't have a flickering issue and I could choose from many different resolutions, but I think the mouse movements felt sluggish. Maybe it's an issue with the system's pointer acceleration setting.

Using:
Renderer = software
in the [Video] section doesn't help.

On another note, why isn't there a 960x480 resolution? It would be the same height as the old monitors, but widescreen so that we would get the feeling of playing the original game on an old system, but it would look right for the common aspect-ratio of today.

Hasn't it been a long time since the release of 0.96.4? If the next release isn't coming soon, is it possible to at least do a bugfix release just for the flickering issue?

@henricj
Copy link
Owner

henricj commented Mar 19, 2021

Exactly which version of Dune Legacy did you try with (where did you get it, exactly which version, and on which platform are your running it on)?

I haven't been involved in any of the official Dune Legacy builds, so you'd have to direct such questions to the (admittedly quiet) forums. The Windows builds I have here are the ones I have some control over, when I've had have time anyway.

Note to self: I should see about updating to a new build with the updated SDL2 and ENet...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ui Related to the UI
Projects
None yet
Development

No branches or pull requests

3 participants