Overview
Usually, when playing games in RetroPie on a Raspberry Pi, you need a display, speakers, and a gamepad controller directly wired to a Raspberry Pi. With this tutorial, however, we want to show how to play any game with a completely headless Raspberry Pi from a remote PC/Tablet/Android device with display, speakers, gamepad controller connected to the latter. This tutorial is a special use case of this more generic tutorial, where you can also find link to the source code.
Hardware requirements
- optionally headless Raspberry Pi 3B+ running a fresh installation of RetroPie (no display, no speakers, no gamepad controllers are necessary to the Raspberry Pi)
- wired connection of the Raspberry Pi to the LAN. A gigabit ethernet is recommended.
- optionally wireless PC or Android smartphone or any other device with a stock browser (e.g. Chrome), no browser plugin is required. If wireless, using a 5GHz channel with no interference is preferable.
- joystick or gamepad controller plugged into the above PC or Android device. The controller can be wireless (e.g. via bluetooth). You can optionally load this page to see whether the controller is detected by the browser.
Software installation
pi@retropie:~ $ curl https://www.linux-projects.org/listing/uv4l_repo/lpkey.asc | sudo apt-key add -
pi@retropie:~ $ sudo bash -c 'echo "deb https://www.linux-projects.org/listing/uv4l_repo/raspbian/stretch stretch main" >> /etc/apt/sources.list'
pi@retropie:~ $ sudo apt-get update
pi@retropie:~ $ sudo apt-get install uv4l uv4l-raspidisp uv4l-raspidisp-extras uv4l-server uv4l-webrtc uv4l-demos -y
pi@retropie:~ $ sudo bash -c 'echo "snd-aloop" >> /etc/modules'
pi@retropie:~ $ sudo bash -c 'echo "options snd-aloop index=1" >> /etc/modprobe.d/alsa-base.conf'
pi@retropie:~ $ reboot
pi@retropie:~ $ rm ~/.asoundrc
pi@retropie:~ $ sudo wget https://www.linux-projects.org/home/wp-content/uploads/2019/03/asound.conf -O /etc/asound.conf
pi@retropie:~ $ sudo service alsa-restore restart
pi@retropie:~ $ sudo wget https://www.linux-projects.org/home/wp-content/uploads/2019/03/uv4l-raspidisp.conf -O /etc/uv4l/uv4l-raspidisp.conf
pi@retropie:~ $ sudo reboot
Let’s Play!
Note that this tutorial assumes you started with a fresh installation of RetroPie where there is no configured gamepad yet.
- plug-in your joystick in the PC or Android device (you could attach the controller to the RPi directly, if you prefer, but the purpose of this tutorial is to have a completely headless RPi)
- open Chrome from your PC or Android device and load the page at http://<your_rpi_address>
- from the Options menu in the same page select a reasonable small resolution like 800x480x30fps (the reported fps is inaccurate, it will be 60fps)
- click on the Start button in the page in and make the window fullscreen
- the emulastation welcome screen should appear in the window asking you to configure the joystick.
Demos
Happy playing.