Enhancing Prince of Persia¶
Fullscreen mode¶
You can toggle between windowed and fullscreen mode at any time by pressing Alt+Enter. But what if you always want to play the game in fullscreen? Wouldn’t it be nice to make DOSBox start in fullscreen right away?
You can easily do that by setting fullscreen = on
in the [sdl]
section.
Modify your dosbox.conf
file so it has the following content, then restart
DOSBox Staging.
Toggling options
For configuration settings that toggle an option, you can use on
,
enabled
, yes
, true
or 1
for turning the option on,
and off
, disabled
, no
, false
or 0
for
turning it off.
Note we’ve also added the exit
command to the end of the [autoexec]
section; with this in place, DOSBox Staging will quit after we exit from the
game by pressing Ctrl+Q. Not strictly necessary, but it’s a nice touch.
Making configuration changes
Every time you modify dosbox.conf
, you need to restart DOSBox Staging
for the changes to take effect. We will not mention this every single time
from now on.
You can do this by closing the DOSBox Staging application and then starting it again. But there is a better way: simply press Ctrl+Alt+Home! This is a homage to the Ctrl+Alt+Del “three-finger salute” way of soft-rebooting IBM PCs.
If you’re on macOS, you’ll need to press Cmd+Option+Home instead, and if Apple has decided for you that your MacBook doesn’t need a Home key, Cmd+Option+Fn+Left should do the trick.
Graphics options¶
DOSBox emulates an SVGA (Super VGA) display adapter by default; this gives you good compatibility with most DOS games. DOSBox can also emulate all common display adapters from the history of the PC compatibles: the Hercules, CGA, and EGA adapters, among several others.
Although the VGA standard was introduced in 1987, it took a good five years until it gained widespread adoption. Games had to support all commonly used graphical standards during this transitional period. Prince of Persia, released in 1990, is such a game; it not only supports all common display adapters, but it also correctly auto-detects them. This is in contrast with the majority of DOS games, where you need to configure the graphics manually (we’ll discuss how to do that, too, in later chapters).
VGA¶
The art in Prince of Persia was created for VGA first, so quite naturally, the game looks best on a VGA adapter. Most DOS games from the 1990s use the 320×200 low-resolution VGA mode. This video mode allows up to 256 colours to be displayed simultaneously on the screen from a total palette of 16 million colours.
This is how the start of the game looks with the authentic CRT emulation feature, which is enabled by default. As mentioned previously, make sure to view all screenshots at 100% magnification to avoid weird artifacts caused by the browser rescaling the image.
But wait a minute, this doesn’t look like anything I’m used to from console emulators. Where are those visible thick scanlines?
VGA display adapters have a peculiarity in that they display not one but two scanlines per pixel in low-resolution video modes, which have less than about 350 lines of vertical resolution. This means the 320×200 VGA mode is really 640×400, just pixel and line-doubled. In fact, the vast majority of VGA monitors from the 1980s and ’90s are incapable of displaying “true” 200-line graphics, so it’s physically impossible to get the “thick scanline” arcade and home computer monitor look on a real VGA CRT.
Double-scanned VGA emulation looks stellar on a 4K monitor and even on 1440p, but on 1080p, there is simply not enough vertical resolution to accurately represent all those 400 tightly-packed scanlines. Therefore, the best thing the CRT emulation can do on 1080p and lower is to fake that double-scanned look so it looks approximately similar to the real thing.
Aspect ratio correction
Computer monitors were originally not widescreen but had a 4:3 display aspect ratio, just like old television sets. DOS games were normally designed to completely fill a 4:3 CRT screen. DOSBox Staging displays the emulated image in the correct aspect ratio by default, which means you’ll see pillarboxing (vertical black bars) at the two sides in fullscreen on modern widescreen displays. This is normal.
However, there is also letterboxing (horizontal black bars) above and below the image. We’ll explain why that’s necessary in the last advanced graphics options chapter. Feel free to take a detour if you wish to gain an understanding of these details now.
Alternatively, if you’re on a 4K (UHD, 3840x2160) or better screen, you
can put this into your [render]
section to get rid of pillarboxing
altogether:
EGA¶
The next graphics adapter the game supports is the EGA adapter, released in 1984. The EGA standard was quite popular until the early 1990s because VGA cards were initially prohibitively expensive for most hobbyists. The majority of games with EGA support use the 320×200 low-resolution EGA mode that has a fixed 16-colour palette.
To run Prince of Persia in EGA mode, you simply need to tell DOSBox to emulate a machine equipped with an EGA adapter. That can be easily done by adding the following configuration snippet:
This is how the game looks with the fixed 16-colour EGA palette. Unlike VGA, EGA monitors can display true 320×200 resolution with the well-known thick scanline look.
CGA¶
The notorious CGA adapter, the first colour graphics adapter created for the original IBM PC in 1981, is a serious contender for the worst graphics standard ever invented. In its 320×200 low-resolution mode, only four colours can be displayed simultaneously on the screen chosen from a small number of fixed palettes. Frankly, all combinations look pretty horrifying…
But no matter; the game supports it, so we’ll have a
look at it. Make the following adjustment to the machine
setting, and don’t
forget to put on your safety goggles!
Ready? Behold the formidable 4-colour CGA graphics—and what four colours those are! Similarly to EGA, CGA is capable of displaying true 200-line modes.
Tip
To compare how the game looks on different graphics adapters, click on one of the screenshots to enlarge it, then use the Left and Right arrow keys to switch between the images.
Hercules¶
The Hercules display adapter was released in 1982 to expand the text-only IBM PCs with basic graphical capabilities. It only supports monochrome graphics but at a higher 720×348 resolution. Can you guess how you can enable it?
Here’s how it looks. Oldschool! The slightly squashed aspect ratio is correct in this case; this is exactly how the game would look on a PC equipped with a Hercules card connected to a period-accurate monochrome monitor (but we’ll examine some advanced techniques on how to fix that).
Monochrome monitors come in different colours, and DOSBox Staging can emulate
all these variations via the monochrome_palette
setting. The available
options are amber
(the default), green
, white
, and paperwhite
.
You can also cycle between these while the game is running with the F11 key.
Only for masochists and archeologists!
The art in DOS games was usually created for the best graphics standard the game supported, and then variants for “lesser” standards were derived from that. If you were an unlucky person still stuck with a Hercules or CGA adapter in 1990, being able to play Prince of Persia with any graphics surely beat no game at all!
Although we’ve shown how to emulate these earlier graphics standards for completeness’ sake, there’s generally little reason not to play a DOS game with the best graphics. The list of possible reasons includes a) nostalgic feelings towards a particular display adapter, b) research purposes, c) you like your games to look like the user interface of an industrial CNC machine, and d) a strong preference for pain. But hey, who are we to judge?
In any case, preserving all relevant aspects of PC gaming history is important for the DOSBox Staging project, so these display options are always available at your fingertips, should you ever need them.
Sharp pixels¶
If you really prefer sharp pixels over authentic CRT emulation, you only
need to add a single line to the [render]
config section:
That’s it! Switching to the sharp
shader will also make the image fill the screen
vertically, so no more letterboxing. The reason for this (and a lot more) will
be explained in the advanced graphics options
chapter.
Keep in mind, though, that the rest of the guide assumes you’re using the CRT emulation.
Chorus & reverb¶
We’ve been discussing graphics at great length, but what about sound? Can’t we do something cool to the sound as well?
Yes, we can! DOSBox Staging has an exciting feature that adds chorus and reverb effects to the output of any of the emulated sound devices.
Create a new [mixer]
section in your config with the following content:
Now the intro music sounds a lot more spacious and pleasant to listen to, especially through headphones. There’s even some reverb added to the in-game footsteps and sound effects, although to a much lesser extent.
You might want to experiment with the small
and medium
reverb presets, as
well as the the light
and strong
chorus settings.
Purist alert!
To calm the purists among you, adding reverb and chorus to the OPL synthesiser’s output is something you can do on certain Sound Blaster AWE32 and AWE64 models, too, with the standard drivers.
Joystick support¶
Okay, so if we want to play the game with the keyboard, we need to press Ctrl+K to enter keyboard mode every single time we start the game. As mentioned, that’s because by default, DOSBox Staging either lets you use your gamepad as the joystick or emulates a PC joystick even if you don’t have a physical game controller plugged in. Either way, the game will always “see” a joystick at startup and will therefore auto-switch to joystick mode.
From this, it follows that if we disable the joystick in the config, the game will have no other choice than to default to keyboard mode:
But if you want to play the game with your gamepad instead, you can do that too! DOSBox Staging auto-maps most common game controllers, so you can control the game with the left analog stick and the X button out-of-the-box with most gamepads.
You’ll need to hit diagonals often to jump and crouch. If your left stick can only move in a circle, the following setting might make this easier:
You can also adjust the deadzone of your stick if you experience controller drift. It’s 10% by default, so let’s increase it to 15% instead:
The PC is not a console!
Note that Prince of Persia requires a lot of precise control, so playing it with the analog stick makes the game quite a bit harder and somewhat frustrating. This is a common theme with many DOS games; most of them were really optimised for keyboard controls or require you to use the keyboard anyway to perform some essential actions.
While playing DOS games from the couch with a controller in your hand might be cool, for the best results, just stick with the keyboard controls. Apart from some space and flight simulators, joystick support was often an afterthought in DOS games.
Issues with multiple controllers
You might get some weird behaviour or even crashes if you have multiple game controllers plugged in. If that’s the case, please disconnect all game controllers except the one you want to use and restart DOSBox Staging. We’re aiming to improve multi-controller support in the future.
Pausing the game¶
Prince of Persia can be paused by pressing the Esc key during the game. That’s nice, but not all games have such built-in pause functionality.
Luckily, DOSBox has a pause feature that you can activate in any game with the Alt+Pause shortcut (Cmd+P on macOS), then unpause by pressing the same shortcut again.
But wouldn’t it be convenient if DOSBox could auto-pause itself whenever you
switch to a different window? You can easily achieve that by enabling the
pause_when_inactive
option in the [sdl]
section.
Restart the game and switch to a different window—DOSBox will pause itself. Switch back to DOSBox—the game will resume. Nifty, isn’t it?
Pause gotchas
All input is disabled in the manually paused stateβthe only thing you can do is press the pause shortcut again to unpause the emulator. In windowed mode, the paused state is indicated in the DOSBox Staging window’s title bar.
Final configuration¶
Below is the full config with all the enhancements we’ve added:
[sdl]
fullscreen = on
pause_when_inactive = yes
[mixer]
reverb = large
chorus = normal
[autoexec]
c:
prince
exit
Configuration comments¶
Instead of deleting those lines, you can prefix them with a #
character
(Shift+3 on the US keyboard layout) to turn them into comments.
Comments are lines starting with a #
character; DOSBox ignores them when
reading the configuration. Normally, you would use them to add, well,
comments to your config, but “commenting out” a line is a quick way to
disable it without actually removing the line.
[sdl]
fullscreen = on
pause_when_inactive = yes
[joystick]
# if you prefer the keyboard; remove it if you want to play with your gamepad
joysticktype = disabled
# optional gamepad adjustments
#circularinput = on
#deadzone = 15
[render]
# for 4K+ monitors only
#integer_scaling = off
[mixer]
reverb = large
chorus = normal
[autoexec]
c:
prince
exit
Note we haven’t commented out the [render]
section itself. That’s fine;
empty sections are allowed and do no harm.
Inspecting the logs¶
What if you used a wrong value in your config, made a typo, or misremembered the name of a setting? How would you know about it? Having to triple-check every single character of the config when something goes wrong is not a good prospect… Fortunately, you don’t have to do that because DOSBox Staging can inform you if something goes wrong. It does that via the logs, which are just a continuous stream of timestamped messages in a separate window.
The behaviour of the log window is different on each platform:
Windows
The log window is opened by default when you start DOSBox Staging. You can
hide the log window by passing the --noconsole
argument to the DOSBox
Staging executable.
macOS
DOSBox Staging does not open the log window by default when started via its
application icon or with the Start DOSBox Staging icon you copied from the
.dmg
installer archive earlier.
To make the log window appear, you need to use another shortcut icon called
Start DOSBox Staging (logging), which you can copy into your game folder
from the same .dmg
archive (note the word “logging” in the name of the
icon).
Note
Remember, for the first time you’ll need to right-click or Ctrl-click on this icon, select the topmost Open menu item, and then press the Open button in the appearing dialog. After the first start, you can simply double-click on it.
Linux
Start DOSBox Staging from the terminal, and the logs will appear there.
Under normal circumstances, the logs contain lots of interesting technical details about what DOSBox Staging is currently doing, what exact settings it uses, and so on. For example, this is the start of the logs when running the game on macOS:
That’s all good and well, but what’s even better is if an invalid configuration setting has been detected, or something went wrong when running the game, DOSBox Staging will inform us about it in the logs!
Let’s now intentionally screw a few things up in the config to trigger some errors:
- Set
machine
tomcp
- Include a bogus config setting in the
[sdl]
section:no_such_config_param = 42
- Set
fullscreen
toblah
- Put the letter
x
in front of the shader’s name
This is how the freshly ruined parts of our config should look like:
As expected, we’ll see some warnings and errors in the logs after a restart:
Warnings are yellow; errors are red. Errors are generally reserved for more severe problems. In this example, we have the following:
-
The first warning tells us that
blah
is not a valid value for thefullscreen
setting, so DOSBox Staging has reverted to its default value offalse
. -
Then it reprimands us for the
no_such_config_param
that we made up. -
The third warning complains about an invalid
machine
value being used (sorry to disappoint, but DOSBox Staging can’t emulate the Master Control Program from Tron yet!) -
Then, we have an error because we’re trying to use a non-existing shader.
-
This is followed by yet another rather large warning block that very helpfully lists the names of all available shaders on our system. That’s pretty handy!
This is a common theme with the logs. When DOSBox Staging displays some warnings or errors, these messages often include suggestions and tips to help you resolve the issues. Note that these can appear not only at startup but also during running a game, depending on what DOSBox Staging is currently doing.
While you might prefer to hide the log window for aesthetic reasons, it’s wiser to just let it be so you can take a peek at it if something goes sideways. Without having access to the logs, your chances of fixing problems are significantly reduced, as, basically, you would be just stumbling in the dark. You’ve been warned!
Okay, we’ve pretty much maxed out Prince of Persia for demonstration purposes. Time to move on to another game!