0
$\begingroup$

Say that I am developing a game on Mac OS X, and I want to export it as a runtime (for Mac OS X). I can use the "Save as Game Engine runtime" plug-in. This does not take into account my external scripts (I use python controllers in module mode). Say that I have all the scripts in a "scripts" folder and I am using Monster's LinkedPythonFolder (link), or any other method, to make Blender aware of this.

Where should I place the "scripts" folder once I've created the runtime "myGame.app"? The only place that seems to work is the "Resources" folder inside the "myGame.app" package. I don't understand why. Is this because this is the directory where the exporter puts the "game.blend" file? (this is actually the myGame.blend file which is renamed by the exporter. Why does it need to rename that?. Isn't there any other directory that is in the Python search path? What about the folder where the "myGame.app" resides?

This folder structure works fine even without LinkedPythonFolder

$\endgroup$
11
  • $\begingroup$ I can't help on MacOS directly. But I guess the files should be relative to the start-up blend file. As "save as runtime" binds the blend file to the blenderplayer I think it should be relative to the app file. This might be different in MacOS than in WinOS and Linux. I really do not know. $\endgroup$
    – Monster
    Commented Sep 19, 2016 at 4:40
  • $\begingroup$ What do you mean by start-up blend file? If you mean the .app generated by the exporter, placing the "scripts" folder in the same directory won't work. In this sense, the LinkedPythonFolder technique becomes useless. The only thing that works is placing the "scripts" folder inside the "Resources" within the generated .app package. And in case you do that, you don't need the LinkedPythonFolder anymore. $\endgroup$ Commented Oct 1, 2016 at 16:46
  • $\begingroup$ The start-up blend file is the blend file that gets loaded at game start. It can refer to any other blend file. These references are either absolute (good for development) or relative (good for publishing). Python modules are expected within the Python search path. The Python search path of your game includes your default Python search path (Python installation), the location of your start-up blend file and the location of referred blend files. It the referred blend file is not found - the python search path can't include them. $\endgroup$
    – Monster
    Commented Oct 7, 2016 at 5:15
  • $\begingroup$ The location of my start-up .blend file is the "Resources" folder within the generated .app package. The scripts reside inside a "scripts" folder within the same location (e.g.: //game.app/Contents/Resources/scripts/script.py). Like this, the game works. Does this mean that the subfolders included in the location of my start-up .blend file (like the "scripts" folder) are in the Python search path as well? $\endgroup$ Commented Nov 3, 2016 at 14:51
  • $\begingroup$ From my experience folders with linked blend files are added to the Python search path. That is what LinkedPythonFolder.blend is doing. When you link anything from it (it does not matter what) the folder it resides in gets included. But I have WinOS only. So I can't tell the structure on MacOS. I suggest to print the Python search path to the console for investigation. $\endgroup$
    – Monster
    Commented Nov 4, 2016 at 5:19

0

You must log in to answer this question.

Browse other questions tagged .