Link vs. Append in a game environment, question & discussion

This began as a question, but in experimenting, I found my answer, and created a list of facts, below.

The question I began with is this: In terms of objects to be used in a game environment, what’s the difference between linking and appending? I realize what each does: linking just creates a link to the object, while appending actually places the object in the scene. So, I suppose what I’m asking is this:

In order to manipulate, in any way, a linked object, I need to Alt-D, or make an instance of it. The instance is still just a link, but a moveable object. What’s the advantage (I’ve heard that there is one) of linking objects, as opposed to just appending them? Is it a file size thing? I like the idea of being able to edit an object in its own file.

Here’s what I discovered, no doubt covered elsewhere, but I present it here for anyone who may be interested:

Some facts about linked objects:

  • You can move and scale the instance of a linked object, without affecting the original linked object, or the source file.
  • Any changes made to the mesh or texture of the original file will be passed along to both the original linked object and the instanced copy.
  • Any changes made on an object level in the original file, such as moving or scaling, will not be passed along to instances.
  • Instances and linked objects show up in the outliner.
  • Deleting a linked object does not delete its instance.
  • Textures for linked objects will themselves be links, but they will show up in the list of textures accessible through the UV layout panel.
  • Deleting instances and original links does not delete linked textures. Is this on purpose?
  • Linked objects and instances only add a very tiny amount to the file size, enough I suppose for the line of code that says “Hey man, grab that file and display it!”.

Conclusion: Linking is superior to appending in game environments at least, for the following reasons:

  • File size is kept low
  • Edits to the mesh of the original object to be linked to are easier
  • Clutter in the main file is reduced.

So, to add a chair to a game environment:

  • Link it
  • place the linked object on an unused layer
  • Make an instance (Alt-D) and place that on a layer you’ll see in the GE.

Just my ramblings on an old question I never really had all the answers to. Please correct my errors and let me know if you know of any other interesting facts concerning linking.

I suggest to use linked groups rather than linked objects. You can read about that in the BGE Guide to linked Libraries. You can find it in my signature (Guides link).

Thanks. I will check that out.

I have another, sort of related question, Monster, as you know a good bit about this sort of thing.

When I join objects, even objects with the same material, the resulting merged object sometimes won’t show up in the GE. I check normals, the “w” restrict render menu, double verts etc. I just get corrupted objects frequently. It happens more when I join objects with multiple materials. I wish I could just group objects, then select them as I do normal objects, without the secondary step of having to right click I think it is, select objects in same group. It seems to me when I watch people creating levels in Unity etc, that users are able to select objects, such as a torch with an animated light, fire, sparks smoke, the torch itself, as a single group, without having to do a secondary step. Your thoughts? Thanks.

Edit:

I think you answer that question here:

“Each instance consists of a copy of the group’s object and an empty (pivot) that acts as parent for the objects. If you want to select the objects of the group you will recognise it is not possible, only the empty gets selected. You still can’t change anything on the linked objects, but the objects transform now with the pivot. When you move the pivot the objects of the group move too.As you see this makes it easy to create assets for a scene.”

Edit: YES! Perfect, Thank you very much. I’m sure this is really basic stuff, but I focus so much on just low poly modeling I neglect other things. I do seem to be able to select the empty or the object to move the linked group in the new .blend. I’ll keep experimenting, but yes, this will be a huge help.

Edit: The empty always want to be at 0,0,0, which makes sense, I suppose. Having trouble figuring out the group creation sequence to make sure the grouped object which is linked is also at 0,0,0. But of course if I want to link a bunch of groups at once, they will all cluster at 0,0,0. Is there way to get the linked group’s empty to form at the location I create the group?

I always put the linked object on an inactive layer, then place an empty on the active layer and spawn the linked object with the empty. That way I can move the empty, or size the empty on the active layer, when you press P the linked objects (center) will be placed and sized where the empty is.

Interesting, thanks.

You might want to have a look at the “How to: create a door preset” (guide link too ;)). It shows you how you can create interactive asset. I think it can help to understand the concept and its power a little bit more.

Yes, when you want to dynamically add new instances the “template-instance” needs to be at an inactive layer. If it is static level creation you can just add or copy the instances within the visible layers. You can even do both ;).

@3D - If you want the group’s center to be at a specific location, position the 3D cursor where you want and set the group offset to the 3D cursor. You can find the setting in the object panel - just select an object in that group.

Thanks. I’ll try that out.