Too much window unions with PreciseConvexDecomposition Collision

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.

Thanks!

1 Like

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.

Maybe @Aotrou could give some insight here

3 Likes

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.

2 Likes

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.

3 Likes

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

2 Likes

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.

2 Likes

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.

2 Likes

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)

2 Likes

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 :slight_smile:

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! :smiley:

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 :sunglasses:


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 :slight_smile:

4 Likes

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.

3 Likes

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.

1 Like

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

1 Like