What is a Library in the Blender Game Engine (BGE)Edit
Just to let you know, there is no offical term "library" for the Blender Game Engine. So let us define it:
- A BGE Library is
- a data block that reside in a different file than the current executed blend file (in blender refered as external data).
A library can be a single game object, a collection of game objects, meshes, logics, animations, materials, sounds, textures etc.. Libraries can be in different container files e.g. textures can be in an image format (.png, .jpg). All Blender compatible data can reside in a .blend file.
The advantages of a library:
- the data is maintained in the library file
- the library file can reside in a different folder as the current executed blend file
Groups as LibraryEdit
A collection of blender objects can be organized in groups. This groups can be instanciated, which produces a copy of this objects parented to a "pivot" object. The group objects can be placed in the scene by placing the pivot in the scene.
Groups are perfect for building Libraries:
- they provide a single access point to the objects of the groups
- they hide the implementation details
- you can have as much instances of the group as you like
Unfortunatly - groups (as an entity) do not exist when running a game. The game objects of a group are added to the BGE while converting the Blender scene into a BGE scene (when loading the scene).
- Groups are not accessable when running the BGE (but the copied objects exist).
- Objects of a group do not know that they are part of a group while in the BGE.
- Objects of a group do not know the pivot object that added them
- Objects of a group are NOT parented to the pivot (usually you do not need that). If you move the pivot when running the BGE the group objects stay where they are. This is different to the behaviour in Blender
Continue to the following tutorials to learn how to use libraries in you own game and to learn how to create own libraries.