This article was originally posted on my blog.
Well as of a few days ago, Chuck Jones is now working on Android and iOS is in the works. Lets talk about how we got here.
People often ask me that since I’m writing a game for an ancient OS, how will they play it? A couple of weeks ago I began trying to tackle an important problem: How to package the game in a way that it can be played easily by people in the 21st Century. As the game runs on DOS natively, the obvious solution would be to do what GOG.com does and bundle DOSBox with an optimal configuration file. This is a pretty good solution but as good as DOSBox is, it has some issues. In my opinion DOSBox’s scaling is not very good, you will usually not get sharp pixels (not everyone’s preference but this is the way I want Chuck Jones to look), especially not on a modern 1080p monitor, this makes sense because most DOS games had non-square pixels which can’t usually be sharply scaled. Another issue is the lack of V-Sync which makes sense because most DOS games run at 75Hz and most modern Monitors refresh at 60Hz. One more thing needs to be addressed, DOSBox has no official port to mobile devices and the unofficial ones that exist are unsuitable for distributing my game.
So how did I tackle this? Easy. I forked DOSBox and modified the code to make a version that is designed specifically to run one game. Because Chuck Jones runs at 60Hz and has square pixels due to some tricks I described previously, I was able to add the features I wanted as well as making the experience of launching the game as smooth as possible. The average player will probably not realize that the game is not a native game for their platform (assuming the don’t recognize the DOSBox splash screen). In order to get the mobile version working I modified DOSBox to use the SDL2 Library which has better mobile support than SDL1.2 which DOSBox was using before. The way I improved the scaling was pretty simple. I first do a scale with no interpolation from the games native 320×240 resolution to the nearest integer multiple which is smaller than the display. For a 1080p display this is 1280×960 and from there it scales up to the monitor’s resolution bilinearly. I have been pretty happy with the results, its not quite a pixel perfect scale (unless you have a monitor with an integer multiple of the source such as 1280×1024, height doesn’t matter because it will letterbox).
As for the process of porting, it was not without trouble as the Android development tools are not the best (a slight understatement), especially for C/C++ which I needed to use to compile DOSBox but are my goto languages anyways. I used Visual Studio as my IDE for both Windows and Android which it doesn’t have perfect support for but I found it far less painful than Android Studio. Something that seems obvious first, converting between touch input to the mouse input in Chuck Jones, is not. A touchscreen tap happens at an absolute position while mice actually function by reading relative motion, the absolute position of the mouse is an illusion created by your OS (try moving your mouse to a point on your desk, move it away, then move it back, it should be in a different position on the screen now). Basically the code I wrote to translate taps only works if it knows were the game has the mouse initially and uses some math from there, since Chuck Jones always starts with the mouse at the center of the screen this is no problem. The next step is to add some buttons to the app to replace the keyboard keys in the PC version and then our next stop is iOS.
So now I have a cross platform solution to run the game on at least 6 operating systems (MS-DOS, Windows, Linux, Mac OS, Android and iOS) using a single binary, ensuring a consistent experience across devices. I’d say that’s enough to ensure that pretty much any 21st century player should be able to play Chuck Jones: Space Cop of the Future.
Extra bit for nerds:
My Fork of DOSBox on GitHub: Github.com