Skip to Content

How to Play Split Screen Games on Linux using Xephyr

Split screen gaming is a popular way to enjoy multiplayer games with your friends or family on the same device. You can share the same screen and play together, or divide the screen into separate regions and compete against each other.

Problem

However, split screen gaming is not very common on Linux, as most games are designed for Windows and do not support this feature natively on Linux. Fortunately, there are some ways to achieve split screen gaming on Linux using some tools and tricks. In this article, we will show you how to play split screen games on Linux using Xephyr, a nested X server that can create multiple virtual displays on one screen.

How to Play Split Screen Games on Linux using Xephyr

What is Xephyr?

Xephyr is a tool that allows you to run multiple X sessions on the same physical display. You can use it to create separate windows that act as independent displays, each with its own resolution, color depth, and input devices. You can then run different applications or games on each window, and arrange them on your screen as you like. Xephyr is useful for testing, debugging, or experimenting with different X settings, but it can also be used for gaming purposes. You can use Xephyr to run two instances of the same game on one screen, and play it in split screen mode with another player. Alternatively, you can run different games on each window, and play them simultaneously with different controllers.

How to Use Xephyr for Split Screen Gaming on Linux?

Step 1: To use Xephyr for split screen gaming on Linux, you will need to install it first. You can do that by using your distribution’s package manager, or by compiling it from source. For example, on Ubuntu, you can install Xephyr by running the following command in a terminal:

sudo apt install xserver-xephyr

Step 2: Once you have Xephyr installed, you can use it to create two virtual displays on your screen. For example, if you want to create two displays with a resolution of 1920×600 each, you can run the following commands in a terminal:

Xephyr -br -ac -noreset -screen 1920x600 :1 &
Xephyr -br -ac -noreset -screen 1920x600 :2 &

The -br option sets the background color to black, the -ac option disables access control, the -noreset option prevents the server from resetting when the last client exits, the -screen option specifies the resolution and color depth of the display, and the :1 and :2 options specify the display number. The & symbol runs the commands in the background, so you can use the same terminal for other commands.

Step 3: You should see two windows on your screen, each acting as a separate display. You can resize, move, or maximize them as you wish. You can also use your mouse and keyboard to interact with them, but you will need to click on a window to make it active first.

Step 4: Now, you can run your games on each window, using the DISPLAY environment variable to specify which display to use. For example, if you want to run Terraria on both windows, you can run the following commands in a terminal:

DISPLAY=:1 terraria &
DISPLAY=:2 terraria &

This will launch two instances of Terraria, one on each window. You can then configure the game settings, such as resolution, graphics, sound, and controls, as you prefer. You can also join a multiplayer game, either online or locally, and play with another player on the same screen.

Tips and Tricks for Split Screen Gaming on Linux

Here are some tips and tricks to improve your split screen gaming experience on Linux using Xephyr:

1. You can use the -title option to give a custom name to each window, which can help you identify them easily. For example, you can run the following commands to create two windows with the names “Player 1” and “Player 2”:

Xephyr -br -ac -noreset -screen 1920x600 -title "Player 1" :1 &
Xephyr -br -ac -noreset -screen 1920x600 -title "Player 2" :2 &

2. You can use the -keybd option to specify a different keyboard layout for each window, which can help you avoid conflicts or confusion. For example, you can run the following commands to use the US keyboard layout for the first window, and the UK keyboard layout for the second window:

Xephyr -br -ac -noreset -screen 1920x600 -keybd "evdev,,xkbrules=evdev,xkbmodel=evdev,xkblayout=us" :1 &
Xephyr -br -ac -noreset -screen 1920x600 -keybd "evdev,,xkbrules=evdev,xkbmodel=evdev,xkblayout=gb" :2 &

3. You can use the -parent option to specify a parent window for each window, which can help you arrange them on your screen more easily. For example, you can run the following commands to create two windows that are children of the root window, and then use a window manager to tile them side by side:

Xephyr -br -ac -noreset -screen 1920x600 -parent root :1 &
Xephyr -br -ac -noreset -screen 1920x600 -parent root :2 &

4. You can use the -resizeable option to make the windows resizeable, which can help you adjust them to your preference. For example, you can run the following commands to create two resizeable windows:

Xephyr -br -ac -noreset -screen 1920x600 -resizeable :1 &
Xephyr -br -ac -noreset -screen 1920x600 -resizeable :2 &

5. You can use the -fullscreen option to make the windows fullscreen, which can help you immerse yourself in the game. For example, you can run the following commands to create two fullscreen windows:

Xephyr -br -ac -noreset -screen 1920x600 -fullscreen :1 &
Xephyr -br -ac -noreset -screen 1920x600 -fullscreen :2 &

Frequently Asked Questions (FAQs)

Here are some frequently asked questions about split screen gaming on Linux using Xephyr:

Question: Can I use Xephyr for any game?

Answer: Xephyr can be used for any game that runs on Linux and supports the X11 protocol. However, some games may not work well with Xephyr, especially if they use advanced graphics features, such as OpenGL or Vulkan. You may experience performance issues, graphical glitches, or crashes. You may also need to tweak some game settings, such as resolution, window mode, or input devices, to make them work properly with Xephyr.

Question: Can I use Xephyr for more than two windows?

Answer: Yes, you can use Xephyr for more than two windows, as long as you have enough screen space and system resources. You can create as many windows as you want, using different display numbers and resolutions. For example, you can run the following commands to create four windows with a resolution of 960×600 each:

Xephyr -br -ac -noreset -screen 960x600 :1 &
Xephyr -br -ac -noreset -screen 960x600 :2 &
Xephyr -br -ac -noreset -screen 960x600 :3 &
Xephyr -br -ac -noreset -screen 960x600 :4 &

You can then run different games on each window, using the DISPLAY environment variable to specify which display to use. For example, you can run the following commands to run Terraria, Minecraft, SuperTuxKart, and Doom on each window:

DISPLAY=:1 terraria &
DISPLAY=:2 minecraft &
DISPLAY=:3 supertuxkart &
DISPLAY=:4 doom &

Question: How can I exit Xephyr?

Answer: To exit Xephyr, you can use the kill command to terminate the processes associated with each window. For example, you can run the following command to exit all Xephyr windows:

killall Xephyr

Alternatively, you can use the ps command to find the process ID (PID) of each window, and then use the kill command to terminate them individually. For example, you can run the following command to find the PID of the first window:

ps -ef | grep Xephyr | grep :1

You should see something like this:

user 1234 5678 0 12:34 pts/0 00:00:00 Xephyr -br -ac -noreset -screen 1920x600 :1

The second number (1234 in this example) is the PID of the process. You can then run the following command to terminate it:

kill 1234

You can repeat this process for the other windows, using the corresponding display numbers.

Conclusion

Split screen gaming on Linux is possible using Xephyr, a nested X server that can create multiple virtual displays on one screen. You can use Xephyr to run different games on each window, and play them with another player on the same device. You can also customize the windows to your liking, using various options and commands. However, Xephyr may not work well with some games