i know there are some things to keep in mind when exporting a game as an executable. i know that you cannot store any references to game objects (ie the owner of a brick). but somewhere i read that you also cannot save state information between scripts via setattr(GameLogic, “coins”, 4). but it seem to work for me (win2k, b225). does anyone know about this?
as far as i know you can use GameLogic for global variables. i used it in my contest game a LOT. im not sure what you mean by “references to game objects” but the only times ive had problems with games exporting is when i tried to have over 30 packed sounds and when i tried to export a game that was too big for my computer’s ram.
i mean when you store a reference i.e. of the owner of a controller with: GameLogic.abc = controller.getOwner() in one script, so that your other scripts can easily access this object, i.e. for reading and setting it’s properties.this does work when you run the game inside blender but not when you deploy an executable. i also use global vars a lot but i read on the blenderbuch site that one should avoid this.
Maybe there are differences on different computers? I do know that both my multiplayer game and crescent dawn DO NOT work as executables, unless I allow the console to remain active in the background (“blenderplayer.exe -c blah.blend”).
But I dont think this is because of global variable, rather its probably because I import external python, and the executable sandboxes python disallowing imports.
anyway it is,that represents a problem.i’m not really sure what are you guys talking about,as i have never used python on an exe game.now that i’m using python script, i hope i don’t run into those problems(if i decide to make my games exes.beside,they look ugly on exes).
i evaluated things a bit, and my conclusion is: as long as you do not want to make executables of your game, you do not need to care about these issues. if you want to make executables, you should not make any game object or logic brick global, but you can use global vars. and why should one make executables? blender’s game engine together with python enables you to make first-class games, and the typical gamer wants an executable that she can download and double-click. and from my point of view one can also make commercial games with blender (which that for have to be of very high quality). it’s somehow that blender’s philosophy works, everybody is able to make games, now lets focus on quality 8) .
I store all sorts of stuff global in the GameLogic object: strings, floats, lists, dictionaries, object owners, controllers, functions, classes…
I’ve practically made my own API for my games inside the GameLogic object!!! :o
as far as I know you can import python modules from the same directory as the exe no trouble. if it only works when you’ve got console on then its probably cos you’ve got print statements in your scripts. They cause the script to crash without a console.