Which is better for support: Lots of parts, or lots of unions?

Within our development team, we’re disagreeing about which would help boost our game’s performance-- unioning groups of parts (to make less parts), or separating unnecessary unions (to create more parts).

Currently, many unnecessary unions already have box collisions, even if they’re not that shape (unless it’s absolutely not possible to do so)

We’d appreciate any input from builders or programmers (with knowledge on performance) who can provide us with their two cents.

Thanks! :slight_smile:

22 Likes

From what I hear, you if union or model parts, it helps.

1 Like

It is a common mistake to think that grouping regular parts into unions will improve performance, in reality it actually hinders performance because it gives the game a more complex item to load. This article really breaks it down and makes it easy to understand.

5 Likes

It depends.

If you have a lot of unions, you will start to lag quite a lot.

You can have a lot of parts before performance issues start to happen.

For me, I just use regular parts.

1 Like

Unions are okay to use but in moderation. Like part count or meshes, if it gets out of control then you will start to experience performance issues.

Here are a few things to try out:

  • Unions have a Level of Detail system. Try adjusting any of the items you don’t need to be detailed from a far range (i.e - building details on tall buildings or similar) and it should cut some of the memory taken up by rendering.

  • You seem to already be using box collisions but you could go even further and disable the collisions of parts that don’t need collisions or won’t be interacted with by a player (this won’t have huge performance benefits but see if it changes anything)

  • Unions have a triangle count property. If a triangle count is in the thousands (especially if it is above 5000), you need to optimize that as soon as possible, whether you do that by un-unioning the structure and having it as parts, or by remaking the structure and unioning it again, it’s up to you.

  • Your problem may not even be unions. Some meshes that have high triangle counts can hog rendering and physics, causing the server start/load time to increase drastically.

A few fore notes:

  • While there is definitely a correlation between normal part count and performance, unions do not follow the same pattern because of the variation of triangles that each separate union has. As such, if you really want a good look at what’s causing your performance issues, you should look at each individual union (or a base model of the unions if it’s been copied around the map) and see what models have the highest triangle count and what can be cut down.
  • If you are doing an expansive open-world style game, it might be worth utilizing fog or streaming enabled to give the player an improved performance boost. While this isn’t favorable, it’s definitely useful
  • Consider whether you actually need all the detail on your buildings. Unless you are making a showcase, you should focus, like you are, on trying to make the game playable for as many people as possible. Very rarely, are there instances where a player might look at each individual detail a statue has and disregard it if it’s missing one detail. Chances are, you can probably get by with much less parts and unions.
32 Likes

So long story short, unions are basically like meshes?

1 Like

Crazy it’s been 2 years.

Since then, we’ve learned that unions are actually a bit different to meshes. SolidModels (unions) store their entire past state (anything used to make them).

This means that unions are quite bloated — you should probably use meshes or parts instead (or convert a union to a mesh)

7 Likes

About union triangle count, Would it cause any problems if the average count for each union is around 2300-3500?

1 Like

How would one convert a union to a mesh?

1 Like

Export the union instance as an object file. You can do this by right clicking on it and selecting export.

5 Likes