Game Development Community

To Prefab or not to Prefab

by Tim · in Game Design and Creative Issues · 11/12/2012 (1:06 pm) · 4 replies

Hi all, quick question if anyone knows the answer I'd be very grateful. I'm currently looking at using prefabs in our T3D game environment to save a lot of time building the game levels - but would like to know if there are any advantages of using prefabs in terms of memory and improving performance of the engine.

So for example, while I can combine a collection of meshes into one prefab and place this prefab around the level many times to save me time in creating the environment BUT is it better for the engine to use prefabs pasted around the level rather than place the collection of meshes individually? I understand that the engine will have to render and draw each prefab as it if were a group of meshes placed individually but do prefabs perform differently to placed meshes performance wise?

Thanks folks

Tim

#1
11/12/2012 (10:20 pm)
Um, you could have just asked me directly mate. But this is fine, as anyone else wanting to know can find out here.

The prefabs are stored in a text file that stored the pos and rot of each object within that prefab. Memory isn't an issue as far as I know, and if it is the prefabs can be busted open again prior to packaging the project, leaving the objects exactly where they were. The unpackaged prefab can then be treated as a normal SimGroup.
#2
11/13/2012 (5:38 am)
On one of the missions I'm working on I would require lots of doors (with some kind of physics of course) could I do them as prefabs as well to save time?
#3
11/13/2012 (10:51 am)
Are your doors animated? If so I'm not sure to be honest. However if they're just static meshes I don't see why not. Even PhysX objects can be made into prefabs as far as I know.
#4
11/14/2012 (7:30 pm)
Kory: what do you mean by making the doors prefabs? Is each door comprised of multiple parts you need to arrange? In this case they sound like a perfect candidate for prefabs.