This tutorial will show you how to make an executable for your game made in Blender.
::如何在Blender中创建游戏的可执行文件.

Note: The methods listed in the "Windows" and "GNU/Linux or Mac OS X" sections work only for the operating system you are on when you create the file. To make it cross platform, use the "BlenderPlayer" method.
::注意: "Windows"和"GNU/Linux或Mac OS X"部分列出的方法仅适用于您创建文件时使用的操作系统. 要使其跨平台,请使用"BlenderPlayer"方法.

Windows
::窗户

First create a folder that will hold all your game information. Name it something meaningful, like "Yo Frankie!".
::首先创建一个文件, 存储所有游戏信息. 给它一个有意义的名称,

The folder must contain four files that you can copy from your blender installation directory.(under windows it should be "C:\Program Files\Blender Foundation\Blender") They are:
::文件必须包含四个文件,您可以从您的混合器安装目录复制.

  1. SDL.dll
    ::SDL.dll 在
  2. python24.dll  (Or other relevant python file; python25.dll, python26.dll etc.)
    ::python24.dll (或其他相关的python文件; python25.dll, python26.dll等)
  3. pthreadVC2.dll
    ::没有任何问题.
  4. zlib.dll
    ::一个 zlib.dll

(sometimes you will need the following also...
:sad有时你还需要以下...

  1. avformat-51.dll
    ::这是一个非常好的方法.
  2. avutil-49.dll
    ::没有任何的
  3. avcodec-51.dll
    ::没有任何问题.

They are in the same folder.)
::它们都在同一个文件中.

Not quite a Noob Note: If you are using the latest version of Blender you WILL need the following files)
::如果您使用的是最新版本的Blender,您将需要以下文件)

I am running windows xp media edition and blender 2.46, here is a full list of files i needed:
::我正在运行Windows XP媒体版和混合器2.46,这里是我需要的文件的完整列表:

  1. avcodec-51.dll
    ::没有任何问题.
  2. avformat-52.dll
    ::没有任何问题
  3. avutil-49.dll
    ::没有任何的
  4. libfaac-0.dll
    ::在 libfaac-0.dll
  5. libfaad-0.dll
    ::没有任何问题.
  6. libmp3lame-0.dll
    ::这是一个错误.
  7. libx264-59.dll
    ::没有任何问题.
  8. pthreadVC2.dll
    ::没有任何问题.
  9. python25.dll
    ::python25.dll 在线
  10. SDL.dll
    ::SDL.dll 在
  11. swscale-0.dll
    ::在此处,请选择"swscale-0.dll"
  12. vcomp90.dll
    ::这是一个很好的方法.
  13. xvidcore.dll
    ::没有任何文件
  14. zlib.dll
    ::一个 zlib.dll

On Blender 2.48a (Windows XP Media Center 2002, SP3), these .manifest files are also required:
::在Blender 2.48a (Windows XP Media Center 2002, SP3) 上,这些 .manifest 文件也需要:

  1. blender.exe.manifest
    ::混合器.exe. 声明
  2. blenderplayer.exe.manifest
    ::混合器.exe. 声明
  3. Microsoft.VC90.CRT.manifest
    ::微软.VC90.CRT.manifest 提供
  4. Microsoft.VC90.OpenMP.manifest
    ::微软.VC90.OpenMP.manifest 提供一个

If you use  random  Python module in your game, you will have to add one more file to your game directory. For Blender 2.49 it would be python26.zip, which you can find in Blender main directory (where blender.exe is). Otherwise there may be some errors during executing the game in system without installed Python.
::如果您在游戏中使用随机的 Python 模块,则必须在游戏目录中添加一个文件.对于 Blender 2.49 则是 python26.zip,您可以在 Blender 主目录中找到 (其中是 blender.exe).否则在没有安装 Python 的系统中执行游戏时可能会出现一些错误.

Since Blender 2.56 you will need to enable Save As Runtime; first open blender with the game that you have created and open the file menu. Click on User Preferences then select Add Ons then Game Engine, check the box Game Engine Save As Runtime and return to the file menu. Save As Runtime will appear as an option in the export menu then save to the new folder that you have created and rename the file yourgamename.exe,
::自从Blender 2.56开始,你需要启用"保存为运行时",首先用你创建的游戏打开混合器,打开文件菜单.点击"用户偏好",然后选择"添加加码",然后选择"游戏引擎",勾选"游戏引擎保存为运行时",然后返回文件菜单. "保存为运行时"将作为导出菜单中的选项显示,然后保存到你创建的新文件,并重命名文件 yourgamename.exe,

and then you can run the game!
::然后你可以运行游戏!

If you encounter errors during the "Save As Runtime" process (I'm on Windows 7) you can right click on the Blender icon and select "Run as administrator". So you will have your fresh .exe and you can spread it with a piece of your favourite pepperoni pizza.
::如果在"保存为运行时"过程中遇到错误 (我在Windows 7上),你可以右键单击Blender图标并选择"以管理员身份运行". 这样你就有了新的.exe,你可以用一块你最喜欢的胡饼来铺开.

Making A Screensaver (Windows Only)
::创建一个屏幕保护程序 (仅限Windows)

  1. First, save your runtime (that's the .exe addressed above.) via File->Save Game as Runtime. ("Save Runtime" in older versions)
    ::通过"文件->保存游戏作为运行时"保存您的运行时 (这是上面的.exe地址).
  2. Now, go to your .exe game and rename it .scr - for instance, if your game was NotMyGame.exe, rename it to NotMyGame.scr. You can now right click to Install it, and then use it as your regular screensaver by applying it as you would any other screensaver (right click on desktop, properties... You know the drill.)
    ::现在,去你的 .exe 游戏,并将其更名为 .scr - - 例如,如果你的游戏是 NotMyGame.exe,将其更名为 NotMyGame.scr. 现在你可以右键安装它,然后用它作为你的常规屏幕保护程序, 应用它,就像你会任何其他屏幕保护程序 (右键在桌面,属性...你知道演练.

Screensavers are not games, and so they should not accept input. At most, they should be videos showing what your game does. If you just rename your regular game as a .scr, it will be remarkably boring, because your game needs input and screensavers do not.
::屏幕保护程序不是游戏,所以它们不应该接受输入.最多,它们应该是视频,显示你的游戏是做什么的.如果你把你的常规游戏重命名为 .scr,这将非常无聊,因为你的游戏需要输入,屏幕保护程序不需要.

Intel screensaver bug
::智能屏幕保护程序错误

There is a caveat with Intel Integrated Graphics drivers, found in many laptops though. The graphics driver shuts off OpenGL acceleration for screensavers, for some obscure reason. The way to work around this is to rename the  .scr  extension to a  .sCr  as the driver's algorithm is dependent on case-sensitive characters. If you experience very low framerates in your screensaver, you should attempt this fix, It is tested and reported to work.
::虽然在许多笔记本电脑中发现了英特尔集成图形驱动程序,但有一个警告.由于一些不明原因,图形驱动程序关闭了屏幕保护程序的OpenGL加速.解决这个问题的方法是将 .scr扩展名更名为 .sCr,因为驱动程序的算法取决于大小写字符.如果您在屏幕保护程序中遇到非常低的率,您应该尝试此修复,它已经测试并报告工作.

GNU/Linux or Mac OS X
::提供GNU/Linux或Mac OS X

Open blender with the game that you have created and open the file menu. Click on  Save Game as Runtime  and then save to the new folder that you have created and rename the file yourgamename...
::打开您创建的游戏并打开文件菜单. 点击"保存游戏作为运行时",然后保存到您创建的新文件,并更名文件 yourgamename...

and then you can run the game!
::然后你可以运行游戏!

BlenderPlayer
::混合器播放器

The methods shown above only create an executable for your operating system. Well, BlenderPlayer can fix that.
::上面所示的方法只能为您的操作系统创建一个可执行文件. ,BlenderPlayer可以修复这个问题.

  1. Make a new folder to store all your game data.
    ::创建一个新的文件来存储所有游戏数据.
  2. Then save your .blend file into the directory.
    ::然后将你的.blend文件保存到目录中.
  3. You can skip this step and the next step if you do not want a Windows version. For the Windows users, copy blenderplayer.exe to the new folder from a Windows copy of Blender. Then copy all your DLL files for Blender as mentioned for Windows to the folder.
    ::如果您不想要Windows版本,可以跳过此步骤和下一步.对于Windows用户,请从Windows版本的Blender复制Blenderplayer.exe到新文件.然后将所有DLL文件复制到Windows版本的Blender文件中.
  4. Next you have to make an MS-DOS batch file (for UNIX users, this is the shell script equivalent). In a simple text editor, in CR-LF mode if available (Notepad is always in this mode, and NOT a word processor!), copy and paste this text:
    blenderplayer.exe yourgamename.blend
    Save it as YourGameName-Windows.bat in your game folder.
    ::接下来,您必须创建一个MS-DOS批量文件 (对于UNIX用户,这是shell脚本的等价).在一个简单的文本编辑器中,如果有,在CR-LF模式下 (笔记本总是处于这种模式,而不是文字处理器!),复制并粘贴此文本:blenderplayer.exe yourgamename.blend 保存为您的游戏文件中的YourGameName-Windows.bat.
  5. You can skip this step if you do not want a UNIX (basically Mac OS X and GNU/Linux) port. For GNU/Linux (at least), make a shell script. (A shell script is the UNIX term for a batch file.) In a simple text editor, in LF mode (unfortunately Notepad can't be used), copy and paste this text:
    #!/bin/bash
    ./blenderplayer.app/Contents/MacOS/blenderplayer yourgamename.blend

    Save the file as YourGameName-UNIX.sh in your game folder. You will need to have BlenderPlayer in the same directory as the .blend game file.
    ::如果你不想要一个UNIX (基本上Mac OS X和GNU/Linux) 端口,你可以跳过这个步骤.对于GNU/Linux (至少),制作一个shell脚本. (shell脚本是UNIX对批文件的术语.) 在一个简单的文本编辑器中,在LF模式 (不幸的是不能使用Notepad),复制和粘贴此文本:#!/bin/bash./blenderplayer.app/Contents/MacOS/blenderplayer yourgamename.blend在你的游戏文件中保存文件为YourGameName-UNIX.sh.你需要在同一个目录中拥有BlenderPlayer和.blend游戏文件.
  6. Write a readme for your program. This is again best done with a simple text editor like Notepad or gedit, but it does not matter which mode it is in. You should include the name of the game, a description, perhaps a walkthrough or hints, and if you made a *NIX port, mention that it requires BlenderPlayer, available with Blender.
    ::写一个程序的readme. 这也是最好的用简单的文本编辑器,如笔记本或 gedit,但它不重要是什么模式.你应该包括游戏的名称,描述,也许是步骤或提示,如果你做了一个 *NIX端口,提到它需要BlenderPlayer,可用与Blender.

Blender and the BlenderPlayer fall under the GNU General Public License. Blend files are copyrighted to their respected owners and do not fall under the GPL as long as they are not packed in the BlenderPlayer. If a user does not want the blend files to fall under the GPL, it is recommended not to use the "Save Game as Runtime" feature. To put it another way, the user must keep the blend files and the BlenderPlayer in separate files. More information can be found at  http://www.blender.org/education-help/faq/gpl-for-artists/ . (Blender 2.4 now has a run game from file actuator.)
::混合文件的版权归于其受尊敬的所有者,并且只要它们没有被包装在混合程序中,就不会属于GPL.如果用户不希望混合文件属于GPL,建议不要使用"保存游戏作为运行时"功能.换句话说,用户必须将混合文件和混合程序放在单独的文件中.更多信息可以在http://www.blender.org/education-help/faq/gpl-for-artists/找到. (混合程序2.4文件现在有一个从执行器运行的游戏).

Proprietary Blend Files
::专有组合文件

Blender has no built-in functionality to "lock" or protect user generated content. As a result, anyone who has Blender can open and/or modify blend files. However, it's still possible to lock blend files. Common methods involve encrypting the blend file and then temporary decrypting it at runtime. This can be accomplished by using python scripts or by using external 3rd party applications (which are feasible under the GPL v2).
::混合程序没有内置的功能来"锁定"或保护用户生成的内容.因此,任何拥有混合程序的人都可以打开和/或修改混合文件.然而,仍然可以锁定混合文件.常见的方法包括加密混合文件,然后在运行时临时解密.这可以通过使用 Python 脚本或使用外部第三方应用程序 (在 GPL v2 下是可行的).

Last modified: Monday, 17 March 2025, 2:15 PM