NOTE: If you are a game developer with access to two or more monitor and an extra PC or laptop, this post may interest you.
Cross-platform game development is a wide topic.
This post is not about the technical aspects of it.
It is about doing your best to offer a very similar experience on all the platforms you are targeting. It is about keeping platforms in sync before it is too costly to make changes. It is about not introducing too much overhead in your already tight schedule.
Three platforms, one
Each platform has its idiosyncrasies.
Whether you are using an off-the-shelf engine with a “Publish to X” button or are a proponent of the Handmade Manifesto, testing your target platforms early and often is important to ensure no crazy platform specific bugs are slipping through the cracks.
No one wants nasty surprises that force you to double back on design/architectural decisions because of platform differences late in the development cycle.
If you are lucky enough to have the resources to allocate specific team members to cross-platform duty you probably don’t need to read the rest of the post, but if, like me, have to juggle multiple roles, read on.
The magic of Synergy
The way I’m handling cross-platform testing/development on my current project is based on a software called Synergy.
Synergy is a fantastic piece of software that allows seamless mouse, keyboard and clipboard sharing between multiple computers. It is available as both a $10 paid version to help support development, but also as open source (GPL) from their official GitHub repo that you can compile yourself.
You can find the guide on how to compile Synergy on the project Wiki.
Synergy also offers nightly builds for all supported platforms if you don’t mind using an unstable version.
My Synergy setup
I have two PCs and a Mac (Windows 8, Ubuntu 15.10, and OSX 10.11) on the same wired network and I use Synergy to control all three with just one keyboard and mouse.
I have them setup like so:
The main terminal is in the middle: a 27” iMac to which the keyboard and mouse are connected. I spend most of my time looking at this screen, as this is where I code. I describe my workflow further down this post.
To my left is my game testing terminal: a PC running Windows 8. I use it to interact with the game proper that I launch while debugging since it has the most horsepower (a Radeon R9 290x). The keyboard/mouse are replicated by Synergy and I have an Xbox 360 controller directly connected to the Windows machine, in case I need to mash some buttons.
To my right is my debugging/build terminal: an old PC running Ubuntu 15.10. I use it mostly for building and cross-compiling whenever I commit. I sometimes launch the game on this machine as well, just to test the low res path, as the graphics card on this is quite old.
Since I have no keyboard attached, I set Windows and Linux to auto-login and start the Synergy daemon on startup.
This are the setting I use for Synergy on the three platforms:
Synergy on OSX
Synergy on OSX requires assistive devices, so you must run it from the
.app bundle on the latest versions of OSX. To start it automatically when the Mac boots, enable automatic login and add
Synergy.app to your Login Items like so:
Synergy on Windows
Synergy on Windows is automatically configured by the installer. You only need to enable automatic login for the account you want to share in case you are using the Windows machine as a client.
Synergy on Ubuntu
On Ubuntu I chose to start Synergy as a start up application, but you can add it to your
lightdm configuration as a startup session as described here.
This is the command I use:
/opt/synergy/synergyc --daemon --log /var/logs/synergy.log SERVER_IP
The minor downside of using Synergy, is that you have to learn how to deal with the mental context-switches that happen when you pass from an OS to the other.
For example, keyboard shortcuts are often different, particularly from OSX to Windows/Linux: I sometimes press
Win+C when I intended to press
Ctrl+C or vice-versa, especially if I’m quickly swapping between monitors.
I could probably remap the modifier keys to be more uniform between platforms, but I’d rather not deal with that can of worms.
Using Synergy with an off-the-shelf engine
As long as you have two or more computers (or laptops) in your network you can link them up with Synergy, install a copy of the editor on each computer and iterate faster on changes.
You could setup a shared network folder and keep all your project files on there, so all changes are reflected immediately on all the clients.
Unfortunately I don’t have personal experience with the workflows used by any of these engines so your mileage may vary.
Using Synergy with a in-house engine
If, like me, you are using an in-house engine for your game I think this approach is invaluable.
You can write custom functionality that interfaces your engine with Synergy using the Plugin API.
Something I’m working on is an event system that automatically coalesces logs from all the clients in a centralized location so I can better debug from my main terminal.
Another useful plugin could allow your artist to quickly iterate on models or graphics by working on their primary workstation, and seeing updates reflected on all clients simultaneously.
A concrete exemple: My coding workflow
For Rival Fortress, the game I’m developing, I’m using a workflow that is very terminal centric.
- I start on my iMac by opening three iTerm windows.
- In one of the terminal windows launch my main Tmux session. This it what it looks like:
- I ssh into both Windows and Linux, from the two remaining
iTermwindows using the following command:
ssh HOSTNAME_OR_IP -t "tmux new-session -t gamedev || tmux new-session -s gamedev"This command connects to the host and attaches to the
gamedevTmux session if present, otherwise it creates a new one. You can add the
-Yif you want to forward your X11 (This only applies to OSX/Linux).
I have Cygwin installed on Windows. This allows me to run Tmux, terminal VIM, and all the other *nix tools I use on a daily basis.
- Once I’m in, I restore my Tmux layout using Tmux Resurrect (a fantastic plugin by the way). The Tmux layout I use on the client machines is almost identical to the one I use on my main machine.
- Whenever I want to debug the game on any of the platforms I launch it from lldb or gdb.
Other ways to do cross-platform development
Synergy is not the only way to do cross-platform game dev. What follows is not meant as a comprehensive list, just a general summary.
The needs of each team (or solo developer) are different and often the “best” solutions are ad-hoc hybrids of the ones I’m about to outline.
The simplest approach is to develop on the main platform (usually Windows) and wait until the end of the development cycle before porting to other platforms.
A more sophisticated approach is to use Continuous Integration, and automatically run builds on all of target platforms when code is committed to source control. This strategy is essential for mid-to-large teams, but I think that for most micro teams or solo Indie developers the overhead of setting up and maintaining a CI toolchain is too high.
VMs and Containers
Another common approach is to use Virtualization or Software Containers with target platform images that you can spin-up when you want to test a build. Unfortunately graphics support on most VMs is minimal, and to my knowledge the best you can get while running inside a VM is OpenGL 3.2. This may be enough if you are developing a game with modest graphical requirements, but if you are squeezing every pixel from the graphics card this approach won’t cut it.
Finally, there is what I call “the platform farm” approach, where you either have several desktop PC/Macs or multi-boot many installs on the same machine. This works well, as it allows you to periodically swap between platforms to test the game, but I personally don’t like the mental context-switch required when you bounce from a PC to the next or when you dual boot.
Some AAA studios outsource platform porting to other studios that are specialized in doing this kind of thing (common practice in console development), but that is outside the scope of this post.
Wrapping it up
In conclusion I think Synergy is a very useful tool for game development, especially Indies. No matter what tools you are using, having quick access to another platform can really improve the long term polish of your game.