Is there any sort of performance difference between logic bricks and python?
Logic bricks are written in C++, so they’ll run faster than the equivalent Python code. However, logic bricks quickly become unmanageable. Also, at some point, the basic mechanic of optimization becomes something that you basically will need Python to do. For example, hiding objects based on if they’re visible or not (if the camera can see them un-obscured) is something that you’d pretty much need Python to do effectively and efficiently.
There is no real vs. Logic bricks and Python controllers complement each other
Logic bricks provide an easy to read and simple to setup event system. The sensors are pretty efficient as they run in native code. Logic bricks offer a GUI to describe logic. They are limited to static behavior. As most of a game is static and simple logic bricks are sufficient for most things. With event switching it is possible to deactivate performance intensive sensors (e.g. radar or near).
Python controllers are logic bricks. They allow you to create your own custom logic bricks.
You can fit different roles even if it sometimes looks a bit strange:
- act as controller by evaluating the status of connected sensors and activating actuators
- act as actuator by manipulating the scene
- act as sensors to events the existing sensors can’t measure
- act as dynamic configurator by modifying other logic bricks in-game
Both:
- Logic bricks and Python controllers complement each other
- carefully pick the bricks you need
- review your design, in a lot of cases there is more than one solution
- make sure your model what you need, not what you think is cool
- you can easily create a mess in logic bricks
- you can easily create a mess in Python code