I’m looking for a little advise. I’m working on prototypes for my game and part of this was making some basic level scenery in blenders in a modular fashion. My entire game work is set inside a spaceship so there are only corridors and rooms.
Now i’m no modeller I’m a coder that has taught myself the basic of blender so I can knock out level geometry such as walls, doorways and such. So i’m a little unsure on the best practises for these things
As i’ve expanded the prototype in a half dozen rooms I’ve realised that i suddenly have quite a large number of prefabs loaded into my scene, Each of these has 1-3 materials and a mesh collider. I’m looking at upwards of 200 prefabs pieces for these 6 rooms. I’ve looked at online sources and they seem to be doing things in a similar way, but i get the feeling i’m missing something and there is an extra step that i should be doing to reduce the number of prefabs that would be required from a game world of any real size.
Is there a best practise for this kind of thing, or something i should be doing?
The amount of prefabs isn’t really an issue, it’s the amount of polys and draw calls that matters. Try to use the same materials so they can be batched and occlusion culling so you don’t render stuff you can’t see.
Thanks for the reply. I’m (hopefully) using the same set of materials on all the prefabs, and i’ve already begun looking at culling. I’ve also just found out about Combining Meshes at runtime. Is that something worth looking at? my rooms are already grouped under a gameobject for each room so i could join all the static meshes inside each room into a single mesh.
The only issue I do have is the floor, I was originally using a simple plane with a script that changed the tiling of the texture based on the scale of the floor itself, However I’ve just found out that in order to do that with multiple floor objects each would need it’s own texture. Is that acceptable or would i be best working around that issue somehow.
Again, I’d be more concerned about the tris/vert count (you can see in the Game View Stats) rather than the actual amount of objects in the scene. Also, make sure you bake static lighting and use occlusion culling. Occlusion culling is one of the best things you can do as it will ensure that only a visible portion of your scene is rendered, saving a huge amount of resources.
Thanks again for the reply. And the useful tips about the stats sections. Can i ask what would be a number to begin worrying about? (Baring in mind the game is designed for desktop not mobile gaming) with my small(ish) prototype and no culling (although not a huge ammount would be culled because it’s currently quite small and compact and its a topdown view) i’m looking at around 59.k Tris and 40.4k Verts.
Actually, that’s very little for desktop. Remember that Occlusion Culling will not render anything not viewed by the camera, even if it’s top-down which is why I’m recommending it highly. I’d continue making the game and see when there’s a performance drop. Also worth remembering that there are many other factors, such as lights and scripting practices that influence FPS greatly (so look in the Profiler as every project is different). So I’d say try to stay under 300K, but if your lighting is cheap (for instance, if you bake all of it and use cheap Mobile/Diffuse shaders), you could easily get to a million and beyond.