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

(MoHAA/Spearhead/Breaktrough) The soldiers aren't displayed correctly in a Release mode #337

Closed
gbudny opened this issue Aug 7, 2024 · 11 comments

Comments

@gbudny
Copy link

gbudny commented Aug 7, 2024

Hi

I want to inform you that all soldiers aren't displayed correctly only in a Release mode in all levels.

Tooltip_035

https://gist.github.com/gbudny/a86604e5fb49f07344b3529de3a6e661

Can you fix it?

@smallmodel
Copy link
Collaborator

I tried MSVC, Clang and GCC in release mode and the only compiler that causes openmohaa to have strange issues is GCC. This bug comes from GCC itself when it optimizes code for release mode and it cannot be fixed in openmohaa.
There are also a lot of other crashes when using the GCC optimizer, this is why a more stable compiler (like clang) is used for the project instead

@gbudny
Copy link
Author

gbudny commented Aug 8, 2024

Hi

Thank you for the answer.

I tried MSVC, Clang and GCC in release mode and the only compiler that causes openmohaa to have strange issues is GCC. This bug comes from GCC itself when it optimizes code for release mode and it cannot be fixed in openmohaa.

Is there any workaround for it?

I don't have this issue in Debug mode, so I don't know what is causing it, but it reminds me of this:

#307

I can switch to Clang, but I have doubts about dropping the support for GCC in OpenMoHAA. It's the popular compiler used by many regular users on Linux and many other operating systems.

I suspect this change could negatively affect the availability of OpenMoHAA for other operating systems in the future. I don't know if Clang is actively maintained on systems like MorphOS, but many users are expecting this port to be released:

https://morph.zone/modules/newbb_plus/viewtopic.php?topic_id=13819&forum=10
https://www.ppa.pl/forum/strefa-gier/46915/medal-of-honor-allied-assault-war-chest-dla-amigaos-i-morphos
https://www.meta-morphos.org/viewtopic.php?topic=2382&forum=54
https://www.youtube.com/watch?v=bG_lrdkFVxQ

I hope that users working on the unreleased ports of OpenMoHAA can share their opinions about it.

There are also a lot of other crashes when using the GCC optimizer, this is why a more stable compiler (like clang) is used for the project instead

I have to admit that I haven't tested the Release mode for many months. On the other hand, I can say that OpenMoHAA in the Debug mode is very stable.

For example, I had played the base version (the default sound system) from the beginning to the end without cheat codes, and I only had two random crashes. It's more stable than many other commercial games.

I don't know if OpenMoHAA builds with GCC on Linux are less stable than builds with MSVC on Windows. I saw issues reported on Windows that I have never encountered on Linux.

I hope you reconsider it because it looks like a big change in this project.

@smallmodel
Copy link
Collaborator

smallmodel commented Aug 8, 2024

It's not a big change, the Linux binaries in the Release page of the project are produced by clang (since the beginning), GitHub actions use clang to compile the project. The only rule is that the project must compile with all 3 compilers, GCC, Clang and MSVC.
Currently for release/optimized binaries, MSVC/Clang must be used to avoid those bugs, unless there are specific parameters that can be used for the gcc compiler to remove some kind of buggy optimizations.

@mohabhassan
Copy link
Collaborator

It's an out-of-hand issue when only GCC has weird behaviour like this, @gbudny your Debug build worked most probably because optimizations are disabled in debug.
A quick-and-dirty fix would be to disable all optimizations for GCC on release (would need a new release configuration probably), but there's no telling how it will affect performance.
I'm wondering if ioq3 has/had this problem and how'd they solve it.

@Cowcat5150
Copy link

Dhewm3 uses "-fno-math-errno -fno-trapping-math -ffinite-math-only" for gcc anf g++ "-ffp-contract=off".

Way to enable/test those options in Cmakelists ?

@smallmodel
Copy link
Collaborator

These parameters don't work after trying, the current issue is the way that GCC optimize loops

@gbudny
Copy link
Author

gbudny commented Aug 12, 2024

Hi

Thank you for the answers.

I know this issue should exist in both versions:

cmake .. -DCMAKE_BUILD_TYPE=Debug -DDEBUG_DROP_ASSERT=1 -DDEBUG_MEMORY=1

Unfortunately, I only have this issue when I build it this way.

cmake .. -DCMAKE_BUILD_TYPE=Release

@Cowcat5150
I added these parameters to a file: CMakeLists.txt. I'm not sure if I did it correctly because I still have this problem:

https://we.tl/t-gYRua0Diud

Can you check my file?

@gbudny
Copy link
Author

gbudny commented Aug 13, 2024

@smallmodel
PtitSeb is developing OpenMoHAA for OpenPandora and has a question about
Clang.

It looks like GCC is more common on MorphOS and OpenPandora.

@ptitSeb

Clang (an old version) can be available on the OpenPandora, but I don't really maintain it anymore... Why would Clang be needed?

https://pyra-handheld.com/boards/threads/medal-of-honor-allied-assault-war-chest-on-pyra-openpandora.100011/page-4#post-1719478

@smallmodel
Copy link
Collaborator

Anyone can use whatever compiler they want, but must be aware of stability issues when enabling optimizations with GCC

@smallmodel
Copy link
Collaborator

It should be fixed now, there were 2 issues that caused GCC optimizer to behave strangely

@gbudny
Copy link
Author

gbudny commented Aug 13, 2024

Thank you.

It works now!

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

No branches or pull requests

4 participants