Sign in to follow this  
blueshogun96

Porting my game to Linux

Recommended Posts

blueshogun96    2265

Recently, I've setup a VM of Linux Mint for the purpouse of porting my game(s) to Linux.  My game is already cross platform between Windows Desktop, MacOSX, iOS and Android/Amazon Kindle.  Now, I am quite familiar with Linux, but I've never dev'ed anything for it either.  So I was hoping to get a bit of advice from those who have done this before.

 

1. Will g++ suffice as my compiler?  My game uses C and C++.  I'm also a bit of a noob to makefiles...

2. Since Linux Mint is based off of Ubuntu (and in turn, based off of Debian), what Linux distributions will my game run on then?

3. My game uses GLUT (and I plan on switching to freeglut), do I have to install anything extra or does Mint come with this?

4. Any other helpful bits of advice.

 

Thanks.

 

Shogun.

 

EDIT: Figured out how to install freeglut, and got it working with g++ already.  That's a load off so far.

Edited by blueshogun96

Share this post


Link to post
Share on other sites
SimonForsman    7642

1. Yes

2. It depends, if you stick to the LSB(you have to statically link any non LSB libraries, or replace them with a LSB equivalent) your game will run on all LSB compliant distributions (Using the LSB SDK is highly recommended), if you don't it is pretty difficult to say, it will most likely work on most debian based distributions atleast.

Edited by SimonForsman

Share this post


Link to post
Share on other sites
swiftcoder    18437

1. Will g++ suffice as my compiler?  My game uses C and C++.  I'm also a bit of a noob to makefiles...

Sure. Clang works well too, I'm not sure which is the default C/C++ compiler on Mint these days.

2. Since Linux Mint is based off of Ubuntu (and in turn, based off of Debian), what Linux distributions will my game run on then?

Technically it will run on any Linux with the same CPU architecture and a compatible set of runtime libraries. In practice, you should be fine on all the Debian variants (primarily Debian, Ubuntu and Mint). Any other distros need to be tested separately.

3. My game uses GLUT (and I plan on switching to freeglut), do I have to install anything extra or does Mint come with this?

You'll need the freeglut3-dev package, as well as a set of OpenGl drivers. Provided you have a supported video card, running [tt]sudo apt-get install freeglut3-dev[/tt] from the command line should pull in all the necessary dependencies.

4. Any other helpful bits of advice.

You'll want to learn how to package your game distribution up as a .deb package. This is by far the friendliest way for your users to install your game on Debian/Ubuntu/Mint.

Share this post


Link to post
Share on other sites
blueshogun96    2265

2. It depends, if you stick to the LSB(you have to statically link any non LSB libraries, or replace them with a LSB equivalent) your game will run on all LSB compliant distributions (Using the LSB SDK is highly recommended), if you don't it is pretty difficult to say, it will most likely work on most debian based distributions atleast.

Thanks, but what does LSB stand for?

 

 


4. Any other helpful bits of advice.

You'll want to learn how to package your game distribution up as a .deb package. This is by far the friendliest way for your users to install your game on Debian/Ubuntu/Mint.

 

Ah, so it's a .deb that is the package type.  I've gotten used to having the all in one functionality of Apple's .app package.

 

While I'm at it, Ubuntu has an app store, and I hear that it's not working (or harder than it should be to install) on Linux Mint 17.  One of my goals is to get this on that distribution channel.  Do Mint users commonly have this installed?

 

Shogun

Share this post


Link to post
Share on other sites
Geri    367

you can use codeblocks or any other ide, that compiles your object files, and links together the stuff, so  you dont need into makefiles, if you dont want makefiles.

also if you dont want to use ides, like the codeblocks, you can just give g++ main.c -o mystuff -lfreeglut -lwhatever.

i dont know, if mint has glut develop files, but usually you find the package with freeglut-devel, or with a name close to that

i dont suggest clang, its buggy like the hell, in reality, it compiles slower binary, and they refuse to even care about bugreports (or at least from my bugreports, they calim its not a bug, i doing it wrong, etc).

Share this post


Link to post
Share on other sites
Geri    367
Has it occured to you that they might be right? Link the bug report, and we can confirm/deny.

 

 

its possible in some case of certain financial conditions.

Share this post


Link to post
Share on other sites
Oberon_Command    6088

 

Has it occured to you that they might be right? Link the bug report, and we can confirm/deny.

 

 

its possible in some case of certain financial conditions.

 

 

Could you link the bug report? Or is this behind an NDA?

 

Were you by any chance using floating-point numbers to represent currency values?

Share this post


Link to post
Share on other sites
Erik Rufelt    5901


Will g++ suffice as my compiler? My game uses C and C++. I'm also a bit of a noob to makefiles...

 

I haven't done any extensive Linux development, but I ported a game to Linux using this IDE: http://codelite.org/

It feels reasonably close to VC++ and Xcode in general.

Share this post


Link to post
Share on other sites
SimonForsman    7642

 

2. It depends, if you stick to the LSB(you have to statically link any non LSB libraries, or replace them with a LSB equivalent) your game will run on all LSB compliant distributions (Using the LSB SDK is highly recommended), if you don't it is pretty difficult to say, it will most likely work on most debian based distributions atleast.

Thanks, but what does LSB stand for?

 

LSB = Linux Standard Base, it is a set of standards that most Linux distributions support, most importantly it provides a stable, backwards compatible ABI (which is quite important if you don't want to distribute your sourcecode).

 

If you do not use it there simply is no guarantee that your binaries will work on other distributions, or even future versions of the same distribution.

Share this post


Link to post
Share on other sites
swiftcoder    18437


LSB = Linux Standard Base, it is a set of standards that most Linux distributions support

Except that most popular linux distros don't actually support it in any meaningful way.

 

In particular, only a single Debian release was ever certified (way back in 2007), and they've been in pretty much open warfare with the LSB standards folks ever since, over the LSB not taking input from the distro maintainers. Which is a bit like if Khronos didn't take input from NVidia...

Share this post


Link to post
Share on other sites
TheChubu    9454

I'd say, make it work on Debian and Arch. Debian derivatives (not necessarely Debian itself) are the most popular distros out there (SteamOS, Ubuntu, Mint, etc). If there is any Linux gamer, it will probably be using one of those.

 

Now, I don't know exactly why, but Arch Linux and derivatives are very popular for Linux gamers too. ie, if you go to Steam forums, Linux people will say they use either Arch/Arch-based distro or Debian/Debian-based distro.

 

Although the actual point is: Don't try to "support Linux", just try to support most popular distros. Supporting all the Linux/BSD out there will lead you to madness and despair, and you dont want that.

Share this post


Link to post
Share on other sites
Brain    18906

Clang has much less cruft in it than gcc, being a newer project with a more straightforward design.

 

I don't know if this at all affects your decision but personally I always try to select the neatest written utilities for developing my games and apps, wherever I am able to see the source. This is because the simplest and better written code is less likely to contain bugs that might cause me problems.

 

Not that I'm raining on gccs parade at all, as I've never had problems with that either, but this is just advice I've found useful in the past.

Share this post


Link to post
Share on other sites
SimonForsman    7642

 


LSB = Linux Standard Base, it is a set of standards that most Linux distributions support

Except that most popular linux distros don't actually support it in any meaningful way.

 

In particular, only a single Debian release was ever certified (way back in 2007), and they've been in pretty much open warfare with the LSB standards folks ever since, over the LSB not taking input from the distro maintainers. Which is a bit like if Khronos didn't take input from NVidia...

 

 

Define "meaningful way", Debian provides full support for LSB 4.1, Ubuntu provides full LSB 4.1 support, Fedora provides full LSB 4.1 support, Mint provides full LSB 4.1 support.

 

Certification is pretty much irrelevant for non-enterprise users, and the enterprise distros are all certified (Most of them are only certified for LSB 4.0 though at the moment)

 

The fact that debian complains about the LSB is not relevant for the OP, Yes the LSB does suck, yes you will have to statically link a crapton of libraries to be compliant(since the LSB doesn't seem to want to include all that much in the spec) but the only real alternative is to target individual versions of individual distributions and then have your application stop working when the user upgrades his OS or to statically link absolutely everything.

Edited by SimonForsman

Share this post


Link to post
Share on other sites
Bregma    9214


While I'm at it, Ubuntu has an app store, and I hear that it's not working (or harder than it should be to install) on Linux Mint 17. One of my goals is to get this on that distribution channel. Do Mint users commonly have this installed?

The Ubuntu App Store only distributes Ubuntu click packages for the Ubuntu phone (it's actually pretty easy to get your app there, but not (yet) applicable to the Ubuntu desktop).  It might be you're thinking of the Ubuntu Software Center, which is just a GUI front end to the Ubuntu software archives (whence most software for Ubuntu and Mint comes).  Getting your software into the Ubuntu archives might be a little tricker:  it has to pass several technical and social challenges first.  They also prefer you get it into the Debian archives first, and that's a major challenge given the tight clique circle-jerk that is Debian.

 

Keep in mind most distros will build the binaries for your application from source: you only have to worry about "working on other distros" if you're distributing binaries.  If you're distributing binaries, you're not going to get in to the equivalent of an app store for a distro.

 

Also, Ubuntu accounts for about 80% of all installed Linux desktops out there, and Mint is just a copy of Ubuntu with the thin veneer of a different desktop shell lacquered on top.  Targeting Ubuntu 14.04 LTS is probably all you need to worry about.

Share this post


Link to post
Share on other sites
Bearhugger    1276


1. Will g++ suffice as my compiler?  My game uses C and C++.  I'm also a bit of a noob to makefiles...

 

Makefiles are a pain to use and maintain for any reasonably complex project. People use automake and autoconf script to handle them, but even with those I find it annoying to use them.

 

Personally I use CMake instead of bothering with those and that's what I would recommend. It allows you to describe your project using a simple scripting language, then you can tell it "Generate me a makefile for my project" and then you get your Makefile. What's really cool is that it's not limited to makefiles. If you're on OSX you can have it make you an XCode project, or if you're on Windows a Visual Studio solution. It also works with less popular IDE like Eclipse. Even better: Qt Creator will load directly from CMake scripts so you don't even have to type the commands.

 

I still have a Visual Studio solution I manually maintain because CMake doesn't seem to fully support C#. (No point since csproj are their own makefiles) so I don't really use CMake on Windows except to test the CMake scripts, but on Linux and OSX I find it very useful.

Share this post


Link to post
Share on other sites
dilyan_rusev    1360

I watched this a while ago and find it useful:
https://www.youtube.com/watch?v=Sd8ie5R4CVE

 

It explains what Valve recommends. Mostly, SDL2 libraries handle most of the OS/DirectX stuff, and OpenGL replaces Direct3D. Also, one advise I've found on my own: if your game is not too complex, you can do almost all the work on Windows. Booting to a Linux distro just to make sure it compiles and runs properly has been my strategy so far for small personal projects.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this