I’m currently trying to come up with set sizes and practices early on with level design so I have a foundation to build on. I’m not sure if it’s good or not, but I’m actively worried about performance. To clarify, I mean more like I’m focused on creating assets and designing in a way where I won’t have to completely scrap and start over, or have a large amount of complicated things that will require fixing later on down the road. I’ve already come up with a standard size for doors, and also a bit for common wall/ceiling heights. Now I’m trying to come up with the best way to create interior/exterior walls, and also a few other things.
So in my project, there will be many buildings where you’ll be able to scavenge through for supplies, so I plan to design a couple of neighborhoods with houses. I’ve thought about using level-streaming zones for each house perhaps, that you enter the moment you go into the house’s radius (such as the driveway/lawn). I’m not sure how many level streaming zones can be placed in one map though. I’ve read around to look for basic practices on interior/exterior wall design, and most say use what works for you. I’ve set 20cm to be the common wall thickness in my project, and I’ve ran into a question.
Is it smart, performance-wise, and also shadow/lightmap-wise, to have two 10cm walls back to back (with the touching faces deleted); one as interior and the other as exterior? I wanted it so that the houses in the main map show the exterior walls while everything inside the interior (walls and all meshes) are all culled (I guess that’s right). All of the interior of the house will then be loaded once you enter the yard/level streaming zone. Is that possible and efficient? If I had just one 20cm wall acting as both interior and exterior, it would be less tris, but I’d think it also would be a bit harder to keep performance cost down with many houses in view.
I don’t want the houses to be completely seperate levels (model the exterior and place on the main map, have the game load into a completely new map when you open the door to go into the interior). I want to be able to enter the house in real-time. I’m not sure if having the walls set up this way will cause unnecessary light/shadow bleed on the interior or not, so I wanted to ask before I got started heading down that path. If there is any more advice that someone can give on advancing in these subjects, I’d appreciate it. Thanks!
EDIT Forgot to mention, this project is planned to be co-op, so I’m sure that may mean a great difference in terms of a solution.
That’s the right way to construct a building, just avoid having too many objects since that increases draw calls.
For lighting that will work as well, just make sure that walls/ceiling/floor don’t extend beyond each other otherwise the pixels in the lightmap can bleed over.
You should be able to set it up to load a building interior once you get close enough, there’s some type of visibility culling, but for an interior it might not work automatically.
I see, well thanks. I’ll have to look into visibility culling way down the road when I actually have something to to tweak. I have a question on draw calls now that you brought up it, I still don’t exactly understand how they work. Is there one draw call per object, per material slot used on that object, as *well * as the amount of lights that are affecting the mesh? So if I have one object with one material and one spotlight aiming at it, would that be 3 draw calls? Also, in terms of optimization, would I be aiming to keep a lower draw call per scene, or for the entire project? Or to word that better, are draw calls happening when something is in visible range, or is it happening constantly for every single asset in the game (even what isn’t yet loaded/visible)?
Oh yes, and if I have ten walls (duplicates of the same mesh) all using the same material, are they all taking up x10 draw calls, or is it only loading it once?
Draw calls are one call for the mesh and one call for each material, so most objects will be two draw calls. Basically it’s a command for the graphics card to process an object. Lights don’t affect draw calls, that’s part of its own thing. The draw calls are only what’s currently being rendered, so it will change as you move the camera around, stuff that’s not within the view of the camera doesn’t get processed. UE4 will automatically load only one of an object into memory that is used multiple times, but if you don’t care about saving memory you can batch/instance objects to reduce draw calls. Batching/instancing will merge objects that have the same material so that it reduces the number of draw calls at the expense of memory (it’s literally like attaching objects in 3ds Max). UE4 does that automatically with foliage and particles, but for other stuff that you want to use batching/instancing you have to set up manually using Blueprints. Games like Minecraft have to use batching/instancing to manage all of the objects, otherwise it wouldn’t be able to have so many cubes.
Ahh! Well then can I ask another question; what would be good practice or knowledge to keep in mind, related to when its best to batch/instance compared to just placing individual meshes? Let’s say outside of one of my houses, I have 5 windows and 5 sets of shutters (one for each window). All of the shutters are the same duplicated objects and with the same material, so in total, the shutters would be 10 draw calls. In this case, would it be best to batch/instance them for just 2 draw calls? (I think I got that right).
Since those are small objects, I can only guess that it would be best to do that, but what if they are larger objects that I want to be duplicated, how would I know if whether or not the objects would cause more issues on the memory side than to the fps side? Also, if I instance an object, can I change the size and it still stays batched (scaling uniformly) or does it become an additional draw call? And does the file size of the object determine the amount of memory used in any way?