在Linux中部署C ++游戏 [英] Deploying C++ game in Linux

查看:77
本文介绍了在Linux中部署C ++游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是在Windows平台上工作的独立游戏开发人员,但实际上我对Linux和为其部署应用程序的经验很少。我正在基于Windows的其他几个跨平台依赖项(例如AngelScript或PugiXML)完善基于SDL 2.0的C ++’11编写的游戏,我也想在Linux上发布它,对此有一些疑问。该游戏是商业的,封闭源代码,当前在Steam的GreenLite上,但是我想分发可从我的网站下载的免费alpha版本,而不管GreenLite的状态如何。

I am indie game developer working on Windows platform, but I have actually little to none experience with Linux and deploying apps for it. I am polishing my game written in C++'11 based on SDL 2.0 with several other cross-platform dependencies (like AngelScript or PugiXML) on Windows and I want to distribute it over Linux too and have a few question about that. The game is commercial, closed source which is currently on Steam's GreenLite, but I want to distribute free alpha version downloadable from my website regardless of GreenLite status.

1。)是与Linux发行版的主要ABI(应用程序二进制接口)兼容吗?还是我需要在每个受支持的发行版/平台上编译我的游戏?

1.) Are the main Linux distributions ABI (application binary interface) compatible? Or do I need to compile my game on every supported distribution/platform?

2。)如果是这样,哪个发行版/平台是可以支持的合理选择?

2.) If so, which distributions/platforms are reasonable choices to support?

3。)安装应用程序的最佳方法是什么,它是Linux上的依赖项?我已经读过有关deb和rpm系统的信息,但仍然令人困惑-有没有办法自动为各种发行版生成安装程序包?

3.) What is the best way to install an app and it's dependencies on Linux? I've read about deb and rpm systems, but it's still confusing - is there any way to automatically generate setup packages for various distributions?

4。)Steam如何工作使用Linux?我应该如何准备要通过它分发的应用程序?

4.) How does Steam work with Linux? How should I prepare my app for distribution via it?

如果问错了问题,请问好,Linux的整个世界对我来说都是新事物,我迷失了阅读各种文章和手册页...

Excuse me if I ask wrong questions, the whole world of Linux is pretty new to me and I got lost reading various articles and manual pages...

推荐答案


  1. 这取决于导出的分布从。通常,只要代码保持不变,就无需在Fedora下的Ubuntu之类的程序上重新编译程序。由于Ubuntu和Fedora必须使用相同的库(尽管可能位于不同的位置),并且与OpenGL相关的任何问题都将成为驱动程序问题;因此,几乎不需要重新编译软件。如果您不得不重新编译软件,我将感到非常惊讶,因为所有发行版都使用几乎相同的一组库/ got bash /使用Linux内核,但具有不同的程序包管理器。最后一部分是变得复杂的地方:

  1. This depends on what the distribution is derived from. Generally, there's no need to recompile a program on something like Ubuntu under Fedora so long as the code remains unchanged. Since Ubuntu and Fedora would have to be using the same libraries (albeit in different locations perhaps) and anything OpenGL-related would be a driver issue; therefore it is hardly a requirement to recompile your software. I would be extremely surprised if you had to recompile your software since all distros use pretty much the same set of libraries/got bash/use the Linux kernel but have different package managers. The last part is where it gets complex:

上述发行版具有不同的程序包管理器,需要您相应地重新打包软件。您可以在tar.gz文件下发布预编译的二进制文件,只需让发行版维护人员为您打包该软件即可。但是,如果您想控制软件的分发方式,则最好自己做。由于存在许多程序包管理器的问题,因此人们仍然诉诸于通过可通过cmake生成的make文件重新编译源代码。仅在由于某些原因而对某些依赖项进行了重命名的情况下才会发生这种情况,在这种情况下,由于简单的名称更改,程序神奇地找不到依赖项。由于也没有命名约定,因此甚至使生活更艰难。这里最重要的优点是Trust,其中的Trust使开发人员遵循命名约定,因此每个人都可以引用相同名称的同一包。

The aforesaid distributions have different package managers which requires you to repackage your software accordingly. You could release pre-compiled binaries under a tar.gz file and simply have distro maintainers package the software for you; though if you want to control how your software is distributed then you should better do that yourself. Because of this issue surrounding the many package managers out there, people still resort to recompiling source code through a make file which can be generated through cmake. This only happens if certain dependencies are, for whatever reason, 'renamed' in which case because of a simple name change the program magically doesn't find the dependency. Since there's also no naming convention it even makes life harder. The most important virtue here is Trust, and Trust therein to have developers follow naming conventions so everyone can reference the same package of the same name.

最受支持的发行版是最受欢迎的发行版:Ubuntu和openSUSE将是一个很好的起点。 Linux Mint,Fedora和Red Hat和Debian同样使用软件包管理器。

The best distros to support are the most popular ones: Ubuntu and openSUSE would be great starting points. Linux Mint, Fedora and Red Hat and Debian use package managers likewise of the aforesaid.


  1. 同时,您应该知道,如果不使您的软件无法静态链接GPL代码,那么您应该知道软件也是GPL。解决此问题的一种方法是通过以下方法解决依赖关系:A.在可执行文件所在的文件夹中包含相关的依赖关系(类似于Windows上的* .dll),或者依赖于运行程序的系统来查找内部文件程序在编译和链接时查找的目录。后者实际上具有较高的风险,因为它假设用户将拥有未修改的库。前者将使您的整体软件使用的存储空间更少,但包括依赖项仅意味着增加软件包的大小,但可以确保所有系统之间的一致性。

对于安装,您将需要一个bash可执行文件,用于将目录内容移动到正确的位置。通常,主应用程序进入/ usr / bin,与应用程序相关的所有数据进入主文件夹。这又取决于发行版;寻找.local目录,或者您可以创建一个专用于隐藏应用程序的目录。隐藏的文件夹以句点为前缀。为什么将这些东西放在主文件夹中,又是什么?原因:默认情况下,由于主文件夹为所有人提供了读写权限。内容:无需用户授权即可与应用程序一起运行的所有内容。因此,依赖项应位于主文件夹中,最好位于您自己的目录下。遵循不同的约定;

As for installation, you would need a bash executable that moves the contents of your directory to the right locations. Generally, the main app goes into /usr/bin and any app-related data goes into the home folder. This again depends on the distro; look for a .local directory, or you could create a directory dedicated to your app that is hidden. Hidden folders are prefixed with a period. Why put this stuff in the home folder, and what? The why: because the home folder gives read-and-write permissions to everyone by default. The what: anything that needs to be run with the app without the user having to authorise it. Dependencies should thus be located in the home folder, preferably under your own directory. Different conventions follow; some may disagree with me on this one.

您可能还想使用Steam的API,它可以为您完成大部分工作。在Steam下,您的应用可能位于Steam自己的目录下,因此可以充当Steam APP,其中包含所有功能。

You might also want to use steam's API which does most of this work for you. Under Steam, your app may be under steam's own directory and thus functions as a steam APP with all the functionality therein.

http://www.steampowered.com/steamworks /

了解有关如何使您的应用蒸蒸日上的更多信息。我不得不说,我真的很感动,甚至包括代码示例。最好的部分是,该API也在Linux上。除此以外,我不知道Steam会通过自己的层来处理应用程序的执行。其中,无需按照先前的步骤独立分发您的应用。

To find out more about how to get your app on steam. I have to say I was really impressed, and they even include code samples. The best part is that this API is on Linux as well. I don't know much apart from that Steam would be handling the execution of your app through its own layer. Wherein, there's no need to independently distribute your app the previous steps.

请注意,如果您有兴趣,也可以通过Ubuntu Software Center分发软件。

Note that you can also distribute your software through the Ubuntu Software Centre if you are interested.

http://developer.ubuntu.com/apps /

尽管如此,Ubuntu更加注重使应用程序运行而不受平台限制。

Though, Ubuntu has more focus on getting apps running regardless of platform.

知道Linux没有单一的约定,但是它的约定只是从实用主义派生出来的,而不是理论上的。归根结底,如何在Linux上运行软件取决于您自己。

Know that Linux has no single convention, but its convention is simply derived from pragmatism, not by theory. At the end of the day, how you want your software run on Linux is up to you.

这篇关于在Linux中部署C ++游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆