How to play Pharaoh city-building game on HD screens in Linux

Updated: February 28, 2025

Without exaggeration, this is one of the sweetest tutorials I've ever written on Dedoimedo. Back in the late 90s and early 2000s, I used to play Sierra's fabulous Caesar III and Pharaoh (and Cleopatra) RTS titles for many an hour. The experience was phenomenal. With time, it became harder and harder to enjoy these games on modern machines, due to various compatibility issues. And yet, I persisted.

Just a few days ago, I showed you how to set up Caesar III, bought from GOG, in Linux. While technically the game isn't supported on Linux, it works great. Not only that, you can also use the amazing, amazing Julius program to run Caesar III in HD. You get to enjoy one of the finest games ever made on modern hardware, you get to do it with style. But Pharaoh does not have its Julius equivalent. So what then? Well, let me show you.

Teaser

Step 1: Install the game via WINE

We will configure Pharaoh in its own prefix. This means we can use different settings just for this game, and not affect any other program installed via WINE. Indeed, by default, Pharaoh will only run with DPI set to 96, and if you use more than that, on say HD/UHD screens, it won't work. Let's begin.

WINEPREFIX=~/.wineph wine "installer exe"

You can use any which prefix you like, something like ~/.pharaoh, ~/.wine-pharaoh, etc.

Install game

Once it's installed, close the wizard. Do not run it. Technically, yes, if everything works fine, Pharaoh will start in a fullscreen mode, and you should be able to enjoy it right away. But if you Alt+Tab out of the game, everything will get messed up, and you will need to restart your desktop (X11, of course), or the whole machine.

Configure WINE for Pharaoh

Launch the winecfg utility, in the correct prefix:

WINEPREFIX=~/.wineph winecfg

Here, under the Graphics tab, tick the box that says "Emulate a virtual desktop", and set its size to that of your native resolution. In my case, 2880x1800px on my Slimbook Executive. When you click OK, the utility will close. On subsequent runs, it will open in its own blue-background desktop, as if on a separate system.

Winecfg, virtual desktop

Xephyr

Remember this amazing tool? I wrote about it in 2010! It allows you to create nested X sessions. We will actually do that. Create a session onto which we will then display a SCALED view of the game, and then connect to this session with VNC. Sounds crazy, and it is. But it works. Get it:

sudo apt install xserver-xephyr

The idea is to start a session with a resolution that matches the game's. By default, this is only 640x480 px. If you use a dimension lower than that, the game won't open correctly. Don't use more than your actual desktop size. If you use a non-4:3 ratio, there will be empty black bars on the sides of the spawned session windows once you launch the game. No biggie. Just an aesthetic thing.

Also, if you want to change the in-game resolution, the session resolution must be equal or bigger than that. So if you start a session with 640x480 px, you will not be able to change this to say 1024x768 px inside the game unless you spawn a Xephyr with allowed pixel width and height. Please remember this to avoid tiny glitches. Thus, it's best to start Xephyr with Pharaoh's maximum allowed resolution:

Xephyr -once -screen 1024x768 :1

Start VNC server - X11VNC

Now, in a separate console window, we will start a VNC server (x11vnc). We will scale it to our desktop size, and this will also match the virtual desktop size we want to use for Pharaoh. You should read the documentation on x11vnc, but it has the -scale option, where you can use numerical multipliers, including fractions, like 2, 3, 2/3, etc, or actual resolutions, like say 1920x1200 or similar. This is somewhat similar to what I did with the DOS-era F-16 simulator in DOSBox. Very nice, I like.

If x11vnc is not installed, btw, install it first:

sudo apt install x11vnc

Then we shall do the following:

x11vnc -localhost -display :1 -scale 2880x1800:nb -repeat

The command will spawn the server on localhost (port 5900 by default), as a display number :1. Your own actual display will be :0, as it happens. Then, we scale the display to match the laptop's resolution, with no fancy rendering (nb), and we repeat the display creation, so it does not time out.

Run the game on VNC server's display

Now, in a separate console window, launch Pharaoh, to the relevant display:

DISPLAY=:1 WINEPREFIX=~/.wineph wine path-to-Pharaoh.exe

This could be something like:

DISPLAY=:1 WINEPREFIX=~/.wineph wine /home/igor/.wineph/drive_c/GOG\ Games/Pharaoh\ Gold/Pharaoh.exe

The game will run inside the Xephyr session. It will be tiny, for now.

Game running, small window

Game running

If you use a Xephyr session proportions that do not match the game size, then, it will look like below. Also, you will see a black band when you first start Pharaoh in a 1024x768px session as it runs with a 640x480px resolution by default, but once you change it in the game, the window will be fully and correctly filled, with no black bars.

Wrong size

Game resolution

Connect to the VNC server

Now, we will connect to the VNC server using a VNC viewer. We need a tool for that, and TigerVNC should do the trick, as it's available in most Linux distributions, and in the worst case, simply needs to be installed. For example, in my Slimbook's Kubuntu 22.04:

sudo apt install tigervnc-viewer

Vncviewer

Start the program, and click Options. Under Compression, untick Auto select. Then, use the Tight encoding, and most importantly, under Color level, change from Full to Medium. With Full, the VNC server and viewer will often lose communication, due to 32-bit vs. 24-bit color space conflicts.

VNC options

You may seen an error like:

VNC crash

Save the options, type localhost in the address field, and Connect.

Connect to localhost

Now, the game will run in a scaled up mode, across your entire desktop. Hit F8 and switch to full screen. Sweet. Then, if needed, optionally, change the in-game resolution, if you haven't done so already. You can find this under options, Display settings. And that's it. You can enjoy yourself!

Full screen mode

Game screenshots & old saves

And now we're having real fun. In fact, I grabbed my old game saves from 2001. I simply copied them into the Save sub-folder inside the game's installation folder (whatever WINE Path, GOG Games/Pharaoh Gold), and I was able to dive straight into where I left the action a quarter of a century earlier. Simply fantastic.

Excellent 1

Excellent 2

Excellent 3

Excellent 4

Quick recap ...

Just to quickly summarize what I did. Basically, you need four terminal windows open, and in each one, you need to execute a separate command. Using my own example:

Xephyr -once -screen 1024x768 :1
x11vnc -localhost -display :1 -scale 2880x1800:nb -repeat
DISPLAY=:1 WINEPREFIX=~/.wineph wine /path/to/Pharaoh.exe
vncviewer

You can also run vncviewer localhost directly from the command line, but only after you set the correct options, and/or if you pass the correct options to the program using its flags.

vncviewer localhost

What about Wayland?

Oh, if you're wondering how to do this with Wayland, most likely you can't. VNC support in Wayland is meh, another reason why you should keep using the stable and good X11 and not the new beta-quality stuff. If you care about old games, then you will use X11. As I remarked in my 2024 article on the topic, Wayland is simply not there yet, and probably never will be. I simply care about functionality, and that's it.

How's this relevant, you ask? Well, it is. Linux. Hence, the desktop.

Conclusion

I am utterly happy that I was able to figure this out. It took me a few long hours playing with Xephyr, with x11vnc, different scaling ratios and resolutions, VNC options, and then some. But there you go. And of course, this lovely solution can be extended to any which game, as I will write in a separate tutorial. This also goes nicely with my mega-tutorial on HD scaling for Linux. Yet another sweet obstacle overcome.

The best part is, I didn't need to rely on the HD binaries for Pharaoh. Yes, there are implementations of Pharaoh.exe that can run on HD screens, but these are not official game files, so to speak. Also, for me, Pharaoh works BETTER in Linux than it does in Windows! Recently, I wasn't able to get the game running in Windows 7. But here we are, everything is top-notch in Kubuntu 22.04. I should add this to my checklist as part of the migration away from Windows. There's the original list, my 2023 Steam list, and now this, too. Fantastic. All of this is just lovely jubbly. And I guess I will need to dedicate huge chunks of my time to replaying these sweet titles, both Caesar III and Pharaoh. Twenty-five years later, they are still as cool and compelling as they were back in the day. Time hasn't changed my perception, or appreciation. See ya.

Cheers.