Battle Brothers on box32
Hi @ptitSeb, I'm opening this issue because I believe you might be my last hope to get this game running decently on my smartphone.
Device specifications: OnePlus 12R - SD8Gen2 - 16GB RAM - Android 15 (OxygenOS) Videogame: Battle Brothers, a 2D OpenGL 3.3 32-bit game
Problem: Severe frame rate fluctuations; FPS on the world map vary between 10 and 40, and in battles between 15 and 50, making the game playable but with a noticeably poor experience.
Apps through which I used Box64/Box32:
Winlator Official by brunodev85 (latest build - Winlator 10 Final (hotfix))
Winlator Box32 Mod by alexvorxx (https://github.com/alexvorxx/winlator/releases/tag/v7.1.5-mod3)
With Winlator Official, I tried running the game with Box64 and WOW64. I kept the default "Intermediate" settings, only changing the parameter BOX64_DYNAREC_FORWARD to 1024. I did this because leaving it at 128 made the game run with such low FPS that it was practically unplayable. As the graphic driver, I initially used Turnip and the DXVK wrapper. I also tried all other combinations, but even when the game managed to start (not all configurations did), the issue persisted.
With Winlator Box32 Mod, I obviously used the only configuration that allows Box32: Turnip and WineD3D as the DX wrapper. In this specific case, besides the aforementioned BOX64_DYNAREC_FORWARD, I also modified other variables:
BOX64_DYNAREC_BIGBLOCK set to 3
BOX64_DYNAREC_WAIT set to 0
BOX64_RESERVE_HIGH set to 1
With this latter setup, I got about 5 or 6 more FPS compared to the one achieved with Winlator Official. So, it's likely that Box32 emulates this game better than Box64. However, the FPS instability issue persists: it's as if during certain screen transitions or specific moments, FPS drops sharply for several seconds.
I'm attaching all the logs I was able to produce with Winlator Box32 Mod, hoping you might give me some guidance or find them useful in case there’s something that needs fixing.
Looking forward to your feedback, and I want to sincerely thank you for everything you do. If needed, I’m available for any kind of testing. I truly hope to get Battle Brothers running decently because it's a fantastic game that fits the mobile context extremely well.
You should keep DYNAREC_WAIT to 1. 0 means it will use interpreter instead of waiting for the Dynarec compiler to be ready. You can try to use DYNAREC_DIRTY to 1 also, just in case.
As I have not tried this game, I don't know why it's not faster, what is the bottleneck, so it's difficult to fix the issues blindly.
You should keep DYNAREC_WAIT to 1. 0 means it will use interpreter instead of waiting for the Dynarec compiler to be ready. You can try to use DYNAREC_DIRTY to 1 also, just in case.
As I have not tried this game, I don't know why it's not faster, what is the bottleneck, so it's difficult to fix the issues blindly.
Thank you! I've tried what you said and I've got another little improvement. The FPS fluctuation however still persists during the transition between one screen an another. For example when I enter in a town, in a market or in the inventory. Or when I zoom out on the map, or sometime while in battle.
I'm completely aware that it is difficult to fix the issues blindly: is there anything I can do in order to provide you more info or something useful to fix the issue? I can try do any test you need or provide any files/infos you may require, even in private.
Hello @ptitSeb , hoping not to disturb you too much, I wanted to tell you that, taking advantage of the Winlator mod created by @alexvorxx , I am testing Battle Brothers both with box32 and with wow64 as you release new builds. Compared to what was written previously, the situation has remained more or less unchanged. The only thing I noticed is that now the performance of wow64 has become practically the same as what I get with box32. The FPS still fluctuates, although I noticed a slight improvement since the last time I wrote.
The configuration with which I was able to achieve the best performance without compromising stability is this: BOX64_DYNAREC_SAFEFLAGS=0 BOX64_DYNAREC_FASTNAN=1 BOX64_DYNAREC_FASTROUND=0 BOX64_DYNAREC_X87DOUBLE=1 BOX64_MMAP32=1 BOX64_DYNAREC_WEAKBARRIER=1 BOX64_DYNAREC_BIGBLOCK=3 BOX64_DYNAREC_FORWARD=1024 BOX64_DYNAREC_CALLRET=1 BOX64_DYNAREC_WAIT=1 BOX64_MAXCPU=0 BOX64_AVX=2 BOX64_UNITYPLAYER=0 BOX64_RESERVE_HIGH=1 BOX64_DYNAREC_DIRTY=1 BOX64_DYNAREC_ALIGNED_ATOMICS=1
With this configuration, the FPS never drops below 15. In particular, BOX64_DYNAREC_FORWARD=1024 (i don't think it is possible to go up to 2048) seems to be the one that provides the greatest performance improvement. In addition to the fluctuations in terms of FPS, especially during transitions from one screen to another, the only issue encountered is a kind of flickering when moving the cursor over any of the buildings that make up the settlements.
I wanted to ask you:
- Is there still any variable that I can try to modify?
- Is there any log that I can send you or, more generally, is there anything I can do to allow you to investigate further and hope for further performance improvement in the future?
I am perfectly aware that it is difficult to fix this game blindly, and that is why I make myself completely available to you for debugging. If necessary, I can also find a way to allow you to perform a direct test.
Thank you again for everything you do. To me, you are a kind of hero :-) the ability to play Battle Brothers anywhere from my phone without the need for a network or to carry a handheld PC is truly priceless!
You can try BOX64_DYNAREC_X87DOUBLE=2 wich might improve things. Else, I'm surprised that BOX64_DYNAREC_X87DOUBLE=1 is better than default BOX64_DYNAREC_X87DOUBLE=0 (unless it's needed to avoid glitches).
There isn't much parameters to tests. Nothing to improve speed anyway.
Note that MMAP32 might also help with Wow64 mode if using OpenGL.
On Winlator, I don't think BOX64_RESERVE_HIGH=1 has any effect (as I assume it's only on 39bits of user address space).
With BOX64_DYNAREC_MISSING=1 check in the logs if you see some message about "Dynarec stopped because of opcode xx xx". There is probably not, but it's still worth checking.