Writing Linux Launch Scripts for Fun and Profit

15 Mar 2013

It is somewhat traditional, when writing games for Linux, to have a small shell script which launches the game. This script will typically change to the game's directory, set up any required library paths and run the correct binary for the user's machine

If you're not familiar with Linux shell development, this can be a wee bit daunting. So, because I'm a nice guy, I've put my launch script template up on the web. You're all free to use it (consider it in the public domain), and you can email me if you've got any questions.

If you've only got a 32-bit binary, then you can easily get rid of everything in the if-then block except the contents of the final else section. If you're putting your game on Steam, then you're probably better off doing this, too, as Steam is 32-bit only at the moment. You can also get rid of the 'cd' at the beginning if you d want: Steam will start the game from the right directory.

If you're not a fan of shell scripts, there are other ways of doing most of what this script does. You can use the -rpath linker option in place of LD_LIBRARY_PATH and binreloc to change to the right path, but these are a bit trickier, so you're best off starting with the shell script if you're not sure of what you're doing.

Have fun, and best of luck with Linux game development,