Python In Realtime...


(snailrose) #1

Hey…Okay I’m learning python
and I’m not very far into it yet but i’ll ask in advance so i can get on the right track…Ive read here that your game goes alot faster if you use python. Is that true?and how would i incorporate than into the game engine…Thanks Chuck


(S_W) #2

Saluk has written a very good tutorial for beginners:
http://mysite.iptic.com/spinhead/blender.html#python1
I don’t really know whether games run faster with python, I haven’t tried it yet, but probably Python makes it run faster.


(blenderage) #3

converting logic bricks to python does indeed make your game faster. although im not sure how much though.


(snailrose) #4

Hey thanks for the replys…
I’ll check out the link…

Chuck


(Abracsis) #5

python does not make your games faster than logic bricks. However, imagine your character has two modes. and certain buttons can do different things depending on the mode. with logic bricks a property logic brick would be test to check your MODE property you have set up, and check if every other sensor was true or not.

In python you could have an If statement which said

IF mode = 1 then check all this logic sensors
Else, then check all this logic

This means that each frame depending on the mode it only has to work out that modes logic rather than the whole lot.

However in certain cases python would make no differnce.

in more advanced terms. in python you can have nested logic. logic bricks cannot be nested. nesting saves processing power
-Luke


(Piraniac) #6

hmmm…i thought i read ages ago that python scripts can be evaluated faster than a lump of logic bricks, not just because of nesty stuff but just in general. Awwww i don’t know, it works so what the hell! :slight_smile:
But, never the less i got a 10 - 15 fps increase last time i switched from logic bricks to python so its definately worth it

cheers
Piran