MODULE MODE is disturbing me, HELP PLEASE

Hello guys, i am learning python currently and i understand the script mode well, at least python is more English than angel script which i have learnt during my 3drad days. Every time i study an example project, all what you guys use is this ‘module mode’ which i don’t even have an idea of (def Player()) which looks like (void myfunction()) in angel script, please anyone tell me why is it better than the traditional ‘script mode’ because i really want to make a commercial title with blender please. Because i know that it is TOTALLY IMPOSSIBLE to make great games WITHOUT scripting, and since i am not using GLSL but using multi-texture so graphics is not on my side, so i need to programme nice gameplay please. A link to a Module mode tutorial or an explanation should do please. Thanks guys.

def example():

To access it through logic just do scriptname.example :slight_smile:
http://www.ibiblio.org/swaroopch/byteofpython/read/making-modules.html

i really want to make a commercial title with blender please

I don’t want to shoot you down too much, but, well, I’ve yet to see anyone’s first game go commercial successfully. In fact, for anyone first game to be finished at all.

But you do have one thing on your side, and that is you correctly identified that you need python.

So, a python script is executed inside a frame. Everything is deleted at the end of the frame
A python module is executed at game start, and then a specified function (one of those ‘def thingies’) every time the module logic brick is run. Any variables inside the module are preserved until game end.

So let’s say I have a python document called ‘junk.py’ and inside it is a function defined by ‘def throwaway()’
I can execute the function throwaway with a module logic brick with the contents ‘junk.throwaway’

One other important thing, if you include ‘def throwaway(cont)’ then the ‘cont’ will be the controller executing the script from which you can use things like obj = cont.owner, to access the object running the script, or cont.sensors to access the sensors attached to it.

I’d recommend having a good play around, and coming back here with any specific issues.
I’d also recommend studying python for a little, perhaps a couple months (yes, game creation does take a long time). There are plenty of good tutorials and books out there for this. And so long as you never copy/paste, you will learn.

Good luck.

@ monster thanks ur signature is nice.@thelaurent thanks for your answer@sdfgeoff thanks for your advise, i never planned for it to be ‘very successful’ just want to start with this before going into it well with a GLSL(i will get a better vga by that time, this my ati radeon x1070 can’t do GLSL), thank your explanation.I really apprecite your help and time.

yes, please about light maps, please a tutorial to mix lightmaps mapping with the diffuse map in the game engine since multi-texture has no shadows(both dynamic and static) no normal, specularity and glow maps. Please. :slight_smile: its so limited.