1
$\begingroup$

I've tried this in my games in the past with little success, but I want to give it another shot. So, let's say I have a character and an open world and I want that character to be able to enter into a building's interior or a cave and start a level from a new blend file. I know I could just put the same character into the new file, but that clearly can't be option if I want to have dozens of levels as the characters will eat up a lot of file space. So how can I use just one character across all of my different .blend levels and simply spawn them into an empty there where they can continue their journey?

Thank you in advance for any help. As I've mentioned, this is a problem I've tried to tackle a few times before, but have had a lot of trouble finding the resources I need.

$\endgroup$

1 Answer 1

2
$\begingroup$

I suggest to link groups from different files.

enter image description here

You have one blend file with your character. It should contain all the object that initially belong to it (physics object, armature, skin meshes, etc.). Place them all in a group that you can create an instance from it.

enter image description here

In your game file you can link the group from the character file.

enter image description here

enter image description here

Then you can instantiate the linked group.

enter image description here

  • You can have as many instances as you like. You can link the group into any number of blend files you like.

  • When you update the character file the linking files will be updated when you open them (e.g. save+load = update).

  • This is a good option not just for a single character but for assets too (stones, trees, houses, rocks, NPCs, GUI, HUD, Menu, vehicles ...).

  • Be aware this method is static. It loads on file/scene load. It does not load dynamically (in this case you need LibLoad - which should work with linking blends too).

Hint:

  • You can create groups from instances too. This makes linkable groups that contain instances of other groups.

  • When you place instances in a separate scene, you can link all groups in one step by linking the scene (rather than linking each single group). This is very useful when you have a lot of assets in one file.

  • Be careful with naming. Groups with the same name are supported, but you have to guess which one is the one you want.

$\endgroup$
4
  • $\begingroup$ Thanks! This solve a lot of my issues. I am still having a slight problem that I can't figure out though. When I import my player and try to play with it, I can't use any of the logic to move it around, crouch, jump, look, etc. The weapon still fires, but it is being added from another layer at runtime. Is there any reason why this might happen? $\endgroup$
    – Zenet
    Commented Apr 26, 2017 at 19:39
  • $\begingroup$ Okay, I can get the player to move, crouch, everything, and I can shoot, but now the gun and left-hand item won't parent to the left and right hand empties. Although everything works in the original file. $\endgroup$
    – Zenet
    Commented Apr 26, 2017 at 22:16
  • $\begingroup$ I fixed it! It was because I was parenting through the parent actuator and the sensor wasn't triggering when the player was added to the game. Using regular parenting fixed it. Thanks again for the detailed answer Monster! This will really help me organize my games better. $\endgroup$
    – Zenet
    Commented Apr 26, 2017 at 23:20
  • $\begingroup$ Yes, there are some limits as you can't directly access the details of the linked group. This adds some complexity but also forces you to encapsulate the assets and operations (e.g. a player does player things, rather than the level scene does player things). $\endgroup$
    – Monster
    Commented Apr 27, 2017 at 5:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .