🕐🕐🕐 Duration: up to one day
🔧🔧 Difficulty: Medium
🌟🌟🌟 Interest: InterestingHere are various tricks to improve your gaming experience performance-wise and comfort-wise.
Performance
Will your Raspberry Pi run as fast? |
Cherish your pi, it will return it!
Lots of people tell you that overclocking will bring you more for your money. While this might be true in the absolute keep in mind a few things:
- The manufacturer has designed their chipset for one maximum frequency, there is a reason for that. Overclocking is a bit like pushing your car engine RPM to the switch. You will get more power but your car won't like it. Just follow one rule: overclocking should be the last thing you'll do in order to get a better performance. You can sometimes run a game perfectly fine if you look at the other aspects.
- Overclocking (or pushing constantly your Pi to max frequency) will increase your SBC temperature. Make sure to dissipate heat well (fan) and monitor your CPU heat. If it goes a little too high just quit being an sorcerer's apprentice and let it cool down. Most modern versions of the Raspberry Pi have a software temperature monitor which will force your CPU to run slower when it is getting too hot.
- Twister OS and PiKISS both give you an easy way to overclock your Pi. Hereafter we will browse the other ways to gain performance.
Soft performance gains
Trust me: soft performance gains will be your best performance gains. Do hard performance gains only afterwards.
When you look for performance, the first thing to do is to look "Where do I lose performance?". There are a few pointers here:
- Interpreting and transformation: the more you put layers and emulate code, the slower it will get
- Always try to run a native port when possible (example: Diablo 2 - libd2game_sa_arm.exe.so)
- Running a native direct draw game with ddr=opengl will first translate direct draw to OpenGL and then back to direct draw and finally will make Wine translate to linux in opengl. To avoid this kind of translation trial and error with Wine is often a solution. Always try games with both
- winetricks ddr=gdi
- winetricks ddr=opengl
- More winetricks performance gains can be found here
- Wine is very compatible with OpenGL mode and GL4ES altogether. Performance will be meteoric.
- Chroot will usually digest ddr=gdi better.
- Driver settings
- GL4ES and mesa drivers have switches that help them run faster without giving too much quality. As information, the best setting in GL4ES is twice faster than a typical slow setting. You can that way expect 8 to 9 average FPS on HoMM4 with the good GL4ES settings, while a poor configuration would give you 2 to 3 FPS.
- Legacy drivers do not have these settings.
- Emulating a whole system is always slower than using emulated bridges
- qemu-system is slower than chroot+qemu-user-static
- qemu-user-static is slower than box86
- Shaders: disabling shaders will make you gain performance. Winetricks can do that
- Rendering: the program itself can sometimes gain performance by giving up some rendering. If you disable or decrease some renderings you will usually be able to make your application run faster.
- Running with GL4ES:
LIBGL_SHRINK=6 LD_LIBRARY_PATH=/path/to/gl4es/libGL.so.1 $RUNNABLE
Gl4es is a good candidate for performance improvement when you are playing OpenGL Games |
- Filling your computer and memory with processes and things to manage will most likely make it slower. It is called a bottleneck.
- That will especially be true if you have a small /etc/dphys-swapfile or little memory
- TwisterOS is slower than plain Raspberry PI OS 32 bits standard
- Raspberry PI OS 32 bits standard is slower than Raspberry PI OS 32 bits mini with RPD manually installed on.
- Raspberry PI OS LXDE is slower than console mode (plain Raspberry PI OS 32 bits mini with minimal startx/xserver or Retropie with the same settings)
- Console mode can always become faster if you remove bloatware
- IO speed
- Executing a game on a slow SD card will obviously make it slower. Don't neglect the speed of your SD card when buying it. Look for A2 cards.
- Executing a game on an external hard disk is even slower.
- Voltage
- Voltage drops will cause freezes in your game and sometimes loss of memory data. Make sure your power is sufficient. If you haven't bought a powered USB hub yet, you could start by unplugging your power creeps: unnecessary remote devices (keyboard/mouse/gamepad), wifi, external hard drive. If it is not enough this hub might be a good starter.
Hard performance gains
I won't hide it, I am not fond of overclocking (cherish your pi). But if you are here, it means your game is playable but not really enjoyable. You feel it would be also really nice if it was just *a little* faster. This can be the case, for example, with Heroes of Might and Magic IV on a Raspberry Pi 3B+.
Before going further it is strongly advised to install a heat monitor on your computer. Pushing your CPU to the limits is like playing with fire.
Be also aware that changing things like max CPU speed, CPU governor or I/O scheduler might make your system more unstable (unexpected crashes or random reboots).
CPU-Governor
Before overclocking, first try clocking: Learning what a CPU-governor is and does. There are a lot of governors that have been released, each of which have different features. Not all are availlable on Raspberry Pi 3. You can for example choose performance as governor.
This will make your PI constantly run at max CPU speed. It will consume more power, produce more heat but will be faster. If you want to change your CPU settings inline, you can install cpufrequtils:
sudo apt-get install cpufrequtils
sudo cpufreq-set -g performance
Or: sudo cpufreq-set -g userspace
sudo cpufreq-set -f 1400Mhz
It would be advisable to unset perfomance governor once your game is finished.
sudo cpufreq-set -g ondemand
I/O Scheduler
Here we are talking about priority: how your Pi will handle requests. On old computers you had first in first out and it is usually what happens when you go to the butcher and wait in line. I/O schedulers will allow you to overtake everyone and be the first to get your meat.
Deadline is the default scheduler is often enough for all purposes. Some people use BFQ as scheduler.
Since schedulers are set in a config file and assuming there is no command to switch it inline, you will have to reboot to test your new I/O scheduler.
Nice
Nice is a soft performance gain but I put it in hard performance gains because it can make your system unstable and crash.
Nice can give a very high priority to your game process.
Be careful: if you give high priority to your game process, the priority for your sound handler will go down and your sound manager will stutter and go slowly and in the end... your game will be slower! Advise: never use nice below -15. Syntax:
nice -15 /home/pi/wine/bin/wine /path/to/somegame.exe
Overclocking
Overclocking will force your CPU run faster than its manufacturer speed.
I do not use overclocking.
If you want to explore that track, the easiest way to get a quick overclocking settings is to install PiKISS, run it, go to Tweaks > CPU etc. and there will be at some point an option to do a simple overclocking in config.txt.
A quick try on José's settings has shown that my test game (Heroes 4) ranked up playability/enjoyability from "fair" to "good". However, I had a dead freeze at some point, problem which I never met before overclocking. It might be due to heat or voltage. If you try overclocking, make sure to have a stable voltage (powered usb hub) and your CPU heat monitored.
If you want more detail on overclocking, go there. Please be careful that if you do homemade overclocking, you risk burning your computer. So proceed with caution and I am not responsible for your burnt device.
Non-performance related gaming experience
Fake KMS or Virtual Desktop
Fake KMS will allow Raspberry Pi to stretch native 800x600, 1024,768, 1280x1024 resolutions to your screen which supports 1920x1080. If you don't activate this option, emulators and window managers like Wine will not detect the resolution properly and will be forced to run in virtual desktop mode. This will also degrade performance.
sudo raspi-config
- 7 (advanced options)
- A6 (GL Driver)
- G2 (Fake KMS)
Fake KMS also gives OpenGL support using GL4ES.
Be informed that EmulationStation will not start within a KMS configuration (fake or full). Wishing to play fullscreen with legacy driver will request you to use tvservice (see here)
Overscan
If you are experiencing black borders while gaming full screen:
- Disable overscan in /boot/config.txt. Look for and uncomment:
#disable_overscan=1
No sound on HDMI
This can happen if you connect your Pi to a PC monitor or to a whole 5.1/7.2/... sound system,
- Uncomment hdmi_group and hdmi_drive in /boot/config.txt:
#hdmi_group=1
#hdmi_drive=2
- Might be uncompatible with tvservice (hdmi_group=2)
Mods and renderers
Some fanmade mods make artificial high resolution from old 1280x1024, 1024x768 and 800x600 resolutions. This can make the game more beautiful without giving up performance. Some mods are also native OpenGL and decrease the amount of the transformations of the game emulation.
Hope this post will have helped you getting a better overall performance from your Raspberry Pi!
The pi gamer
No comments:
Post a Comment