Uae4arm - randomization issue
-
Hi Folks,
I am not sure if this is a global emulator-wide issue or is it just local to the game. The thing is since I upgraded my RPi1 to RPi3 (and RetroPie from 3.8 to 4.0) I have noticed that the powerups in All Terrain Racing game don't appear as randomly/shuffled as they used to. It's not just a feeling as in every race a couple of times I see the same power-up 3-4 times or more in a row. I don't recall anything like that on my A500, and neither on any emulator I have run before. The issue might seem trivial, but in fact it impacts the gameplay quite a lot, as it really is based on powerups :)
Has anyone encountered anything like that elsewhere? Is randomization in uae anyhow tunable/fixable? Perhaps some CPU/chipset configuration changes could help?
Thanks!
-
Since I got no replies, I investigated this a little bit myself and this is what I have figured out.
By looking at the uae4arm source code, I learned it uses something like
uaerand()
, but this is nothing more but just a standardrand()
function from C's stdlib:
/src/include/uae.h:
#define uaerand() rand()
The
rand()
function, according to this thread on Stack Overflow is not "thread safe" and this causes issues like mine or the one described by the author of the post.As a workaround I have disabled 3 of 4 CPU cores by adding
maxcpus=1
to /boot/cmdline.txt. This definitely fixed the issue for ATR.So, to sum up. This appears to be a bug and it is global for UAE4Arm. Depending on how the game is built it can probably be more or less visible, but I believe it is present anyways.
Regards.
-
I still have a question related to this topic.
My workaround works, but it requires a reboot of my RPi which is not very convenient - does anybody know a way of disabling a CPU core online? On non-ARM CPUs it is possible by echo'ing
"0"
to /sys/devices/system/cpu/cpuX/online, but here it won't work.Thanks.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.