Baeldung Pro – Linux – NPI EA (cat = Baeldung on Linux)
announcement - icon

Learn through the super-clean Baeldung Pro experience:

>> Membership and Baeldung Pro.

No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with.

Partner – Orkes – NPI EA (tag=Kubernetes)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

1. Introduction

While Linux distributions such as Ubuntu have been extremely popular among engineers and open-source enthusiasts, the gaming scene has been pretty dull.

The number of games natively supported on Linux has been increasing steadily, but the most popular games, new or old, still don’t provide Linux versions, and the user base of Linux is still too small to be making games for.

The good news is that we don’t necessarily need Linux versions of a game to be able to play it on Linux. This is because there are plenty of emulators and compatibility layers that will run games designed for Windows, Android, PlayStation, and even Nintendo consoles on our Linux systems. Hence, this should suffice for most light-to-medium gamers.

In this tutorial, let’s look at how we can use some of these tools to run non-Linux games on Linux.

2. Playing Windows Games Using Wine

Windows is the most widely used desktop operating system, and naturally, most games have a Windows version. We can run Windows games (or any Windows application) on Linux using a compatibility layer called Wine. Using Wine, we can run most .exe files on Linux systems. Let’s see how to install Wine and run a Windows game on it.

2.1. Installing Wine on Ubuntu 24.04

Before we install Wine, we need to enable 32-bit architecture support on our system (assuming it’s 64-bit):

$ sudo dpkg --add-architecture i386

Next, we’ll add the key for the WineHQ repository:

$ sudo mkdir -pm755 /etc/apt/keyrings
$ wget -O - https://dl.winehq.org/wine-builds/winehq.key | sudo gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key -

Subsequently, we can add the WineHQ repository itself:

$ sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/noble/winehq-noble.sources

Note that the above command contains the distribution codename (‘noble’ for 24.04), and for other versions of Ubuntu, we need to substitute the corresponding codename. Finally, we can proceed to install the latest stable version of Wine:

$ sudo apt install --install-recommends wine-stable

Once the installation is complete, we can run Windows programs from the terminal using the wine command.

2.2. Running a Windows Game Using the wine Command

For demonstration, let’s run the game Little Fighter 2, a free game released in 1999, using the wine command:

$ wine lf2.exe

Let’s see what this opens up:

Running Little Fighter 2 on Linux Using Wine

The above screenshot shows the start screen of Little Fighter 2 running with Wine on Ubuntu.

2.3. Wine Front-Ends and Other Options

If we’d like to avoid the command line, we can also use one of the GUI front-ends for Wine, which include Heroic Launcher, Lutris, and Bottles. Another option is to use the Steam client with Proton, which uses Wine under the hood.

3. Playing Android Games Using Genymotion Desktop

Genymotion is an Android emulation product that’s available as a cloud service and a desktop application. It’s not open source, but there’s a free plan for personal use. To use this plan, we need to install Genymotion desktop from the link, create an account, log into the desktop application, and select ‘personal use’ when we use it for the first time.

3.1. Setting up a Virtual Android Device

Once we’ve downloaded and logged into the desktop application, we’ll see the opening screen:

Genymotion Initial Screen

To run Android games, the first thing we’ll need is a virtual device, which can run the Android OS inside it. To do this, we’ll click the plus button in the top right corner. This will open up a list of devices to choose from:

Genymotion Devices List

Let’s pick a device, say Google Pixel 9, and complete the setup process. Once the installation is complete, we can boot the virtual device to see a phone screen running inside a desktop window.

3.2. Installing and Playing Games Using APK Files

The simplest way to install a game on this virtual device is to drag an APK file from the PC’s file browser into the Genymotion window. Let’s try this with an APK of the 2048 game downloaded from F-droid:

Installing an APK on Genymotion

Once we drag the APK into the device window, Genymotion automatically installs and opens the APK in the virtual device:

Running 2048 Android Game on Linux Using Genymotion

The above screenshot shows the 2048 game running inside a virtual Android device on a Linux system.

3.3. Other Options for Android Games

The only other feasible option to run Android apps/games on Linux systems, as of now, seems to be Waydroid. It’s open source and uses a container-based approach. However, it’s supported only on Wayland desktops and doesn’t work well on X-based desktop environments. There are other commercial Android emulators, such as Bluestack and Noxplayer, but they don’t support Linux.

4. Playing Console Games Using Mednafen

Mednafen is a multi-system emulator that bundles emulators for multiple gaming consoles into one neat package. The emulator also supports mapping keyboard keys or even a joystick to console controls. Let’s look at the list of systems it emulates, as mentioned on the project home page:

  • Apple II/II+/IIe/Enhanced IIe
  • Atari Lynx
  • Neo Geo Pocket (Color)
  • WonderSwan
  • GameBoy (Color)
  • GameBoy Advance
  • Nintendo Entertainment System
  • Super Nintendo Entertainment System/Super Famicom
  • Virtual Boy
  • PC Engine/TurboGrafx 16 (CD)
  • SuperGrafx
  • PC-FX
  • Sega Game Gear
  • Sega Genesis/Megadrive
  • Sega Master System
  • Sega Saturn (64-bit only)
  • Sony PlayStation

To play console games using Mednafen, first, we’ll need the ROM files for the games we want to play. Assuming we have some game ROMs obtained through legal means, let’s go ahead and see how this works.

4.1. Installing Mednafen on Ubuntu 24.04

Mednafen is available in the default Ubuntu repositories. Therefore, it can be installed using apt:

$ sudo apt install mednafen

We typically use the mednafen command-line tool with a GUI front-end called Mednaffe, which is also installed by the above command. So, we can simply launch the GUI now.

4.2. Configuring and Running Games

Once we launch the Mednaffe app, we see four tabs, shown in the picture below:

Run Console Games On Linux Using Mednaffe

First, we have the game list. Here, we can add folders containing ROMs and launch any of these ROMs. Subsequently, we can configure settings globally or for each system separately. Finally, there’s a tab that shows logs.

5. Conclusion

In this article, we looked at how we can play non-Linux games on our Linux system. While Linux isn’t the best OS for a hardcore or professional gamer, it does suffice for most recreational and occasional gaming with a suite of emulators and compatibility layers that can run games originally made for Windows, Android, and other gaming consoles, such as Nintendo, PlayStation, and Sega.