Hello, I recently started to learn how to build and I have a question about unions with PreciseConvexDecomposition Collision.
So For windows to have holes, I negate a part to make a hole in a part so I can make a window hole in my buildings. However, I have a worry if too much unions with PreciseConvexDecomposition Collision would lag the people with low-end PCs and if so how much would it affect the performance?
And yes I do have to use the Precise Collision Fidelity because windows will be used to get in and out of buildings. Also the game I am currently developing is a shooter game so it bullets has to go through windows.
I donât know the details of how the engine handles unions(and their collision) in comparison to an identical shape using regular parts (so instead of 1 singular union with a hole, 4 different parts scaled to make a hole in the middle) so I wonât try getting into those details,
Probably the easiest way to test whatâs best performance-wise would be to get a sample of each wall youâre willing to test, for example; union wall with precise collision - 4 part wall - MeshPart wall with precise collision - âŚ
Duplicate each individual version a few times on an empty baseplate and run a playtest, compare the performance output between the versions youâve tested and see what was best.
Ofcourse context matters a lot here, for example reusing the same MeshPart wall would be less performance costly as opposed to using multiple unique ones, and Iâm assuming the same goes for Unions.
As @wickedyboo said, copy/paste 100 times to try to stress your computer a little then test each version.
Another way I make complex walls with possibly 100âs of Parts is to make them all CanCollide false, CanTouch false, and put non transparent âfillerâ CanCollide Parts between openings.
It also kind of helps with collisions since if you have a large wall with a small window even with PreciseConvexDecomposition you may find the hole isnât as big as youâd expect. Thereâs a tool in the Studio settings to show you the physical shapes of Unions and MeshParts in the workspace called ShowDecompositionGeometry. Check it on (you may have to change a Property in an item in the workspace to get it to display) and youâll see the exact shape of the Union or MeshPart.
Unions have been greatly improved in recent times and now do not cause as much chaos as they used to in the past. It wonât be too bad if you use multiple unions, BUT! It is BEST practice to convert the unions into meshes by exporting them and then importing them. An optional thing you can do is to import them into a software like blender and make some optimization adjustments like removing duplicate vertices and fixing shading, there are tutorials on that, go watch them.
What I personally would do if I wanted a window that a player could climb through, is just set the collisionfidelity of the windowâs unions/meshes to box, and make the entire window model non-collidable.
Alternatively, the outermost frame could have default collision fidelity (seriously, you donât really need to use precise collisions even when you need to get through a window, default fidelity can be good enough), while every other component of the window doesnât have collisions Window with the union part frameâs collision fidelity set to default
Unless youâre cleaning them up in an external software like you mentioned after, simply exporting and reimporting as a mesh wonât help, you need to do actual cleanup work otherwise youâre not really changing anything performance wise.
It could. If I am correct, all unions are unique, thus having the same union but 1000s of times lags the game a lot. But having a mesh of that union wonât because roblox would have to store only the mesh data of the origin mesh and then t can modify the basic visual properties, thus, less ram usage.
But yeah, itâs best to just use blender as it provides more flexibility.
I did a little performance test with a Union and an identical Mesh, either I didnât stress my machine enough or there was no visible difference at all in any outputs, or the difference was so minimal it would barely make any difference to begin with.
If you decide to test it out and yield a different result then what you said could be possible, but from my own test I cannot reproduce said theory (tested 1000 of each union/mesh)
All of this is great info and thereâs really nothing I can add that hasnât already been said (good work everyone haha). Unions are definitely better than they used to be, but still inferior to Meshparts solely because of the Union redundancies mentioned above. However as you said youâre new to building and I donât expect you to dive into Blender immediately, Unions are a âGood Enoughâ solution for the time being
If youâre just starting out, rest assured that performance optimization shouldnât be a top priority anyways - learning the basics, practicing, and trying new things is best when starting out and optimization can be learned later for more serious projects, or can be fixed retroactively (albeit with some difficulty). Just focus on finishing the game and everything else can come after!
Also if you have additional questions for your journey into game art in general, please message me Iâm always happy to answer even the most basic questions
One correction I want to add;
Unions that are duplicated are instanced like any other identical* object as far as Iâve seen, but if Iâm wrong please let me know so I can correct my understanding (and stay even further away from Unions lol).
*Two Unions made with the same CSG calculations twice are considered two unique Unions and will not be instanced, similar to how two meshparts can be identical but have two different MeshIds are not instanced. Unions are are CSGâd once and copied, are instanced
I think they were actually worried about the wall around the window being Unioned with a hole in it and be able to have players climb through the hole.
Maybe @kaanXBT can you explain if the window Parts are going to be included in the Union, or if they just want the hole in the wall. Not that it matters too much because everyone else seems to have provided answers for either case.
I think I misinformed that. I am not going to make the window part of the union. Instead, Wall will be the only union, windows will be apart from the union.
And I have came to the conclusion that there is absolutely no reason to use precise collision as I realized the default collision on the window wall union is enough for bullets to come in and out the building without hitting any invisible wall therefore the players can get inside and out too which I wanted.
Thanks for all your replies! I appreciate it a lot.
Sounds good. Like I said, just watch out for cases where the window opening is a small percentage of the wall.
A 10 stud high, 1 stud deep, 20 stud long wall with a 5 x 4 hole should work out perfectly fine. If you step up to a 10 stud high, 1 stud deep, 100 stud long wall with a single 5 x 4 hole it may show up as a 5 x 4 hole, but the physical hole may be more like a random triangle instead, or no hole at all.
The ShowDecompositionGeometry tool will open your eyes to how the Union is physically shaped.
Thereâs a plugin that does it as well. https://create.roblox.com/store/asset/414923656/Mesh-Optimization-Tools?assetType=Plugin&externalSource=www