Give packages a variant system

This proposal is intended to be paired with this, but both are technically independent:
https://devforum.roblox.com/t/make-packages-more-like-unitys-prefabs/551882/

Current Behavior

  1. Make a package
  2. Make a different variant (color, style, etc.)
  3. You either have to update the package, resulting in using VersionNumbers to deal with variants, or you have to make an entirely new package (defeating the point of packages)

Proposed Behavior

Uploading

  1. Make a package
  2. Make a different variant (color, style, etc.)
  3. You are given the option to upload the package as either a “package” or a “package variant”
  4. If you wish to make a package variant, you give the package variant a name and select the package it is a variant of
  5. You can update variants via this upload system

Selecting Variants

  1. Either the package itself or the PackageLink has a variant dropdown enum which allows you to pick the package variant you want
  2. Switching the enum automatically changes that package to the last uploaded variant

Why

  • The current package system is not intuitive to making package variants. You are forced to either use different packages or VersionNumbers.

  • Paired with this thread. In order to make a red, blue, and green version of the same package, you need to upload 3 different versions. In order to update each package, you have to update three unique instances. This means more hassle, this means more time wasted.

Benefits

  • Makes the packages system more flexible
  • Makes making variants of the same/similar objects easier
  • Allows easy package variant randomization via script

Example

Package: Western Table

Default: Western Table
https://www.roblox.com/library/4967424169/WesternPokerTable

Variant: Poker
https://www.roblox.com/library/4967424169/WesternPokerTable

Variant: Dining
https://www.roblox.com/library/4967400379/WesternTable

In-game display

19 Likes

100% agree, this feature would be a major boon and make the current package system a lot more robust.

1 Like

There is a related but slightly different usecase for “package variants” which is “package configuration”.

Let’s use a lamp as an example:

If you put Color, Brightness and Range as Color3Value, NumberValue and NumberValue respectively into a Folder called Config inside the lamp Model then a Script in the Model can then read those values and apply them to the light at run time:

image

Unfortunately if we publish this lamp Model as a Package then the Values under Config will also be part of the package, and any changes will ask you to publish the changes. We are unable to specify that This lamp is red and bright while this lamp is blue and dim.

Interestingly, there is already a “Configuration” Instance in Roblox that is just a special case of Folder that supposed to contain only value objects for configuration. However it is not really useful in it’s current state because it functions EXACTLY like a Folder. I would propose the following update to make it mor useful:

  1. If a Configuration instance is found inside a Package, the change made to it’s children will be ignored at publish time
  2. Values already existing inside Configuration are not ever overwritten on package update
  3. New Values not already existing will be copied on package update

Further I suggest the following update of the Configuration Instance for general usability upgrade:

  1. Give it syntax to gracefully fall back to a default value upon trying to read missing values. For example: local val = config.myVal.Value or 4 will return 4 if myVal did not exist inside the config folder
  2. Give it syntax so that the .Value part can be skipped. With the example above, this would be equivalent: local val = config.myVal or 4
  3. Give it syntax so that when setting a value that does not already exist, it will create the value object on the fly with the most spesific type. For exampe; config.myVal = 4 would create a new object myVal under config of type NumberValue and set the value to 4.

Alternatively, there could be an attribute set on children inside the package that marks them as “not synchronized”. This is more general and probably easier to implement by Roblox, but puts more work on the dev and is far less opinionated/purpose driven.

7 Likes

Yes this seems like something I’d use. But surely sounds complex for newer developers.

Bump. We absolutely need some sort of config system if packages are going to become a useful and robust feature.

Edit: See post below

I actually found out that packages can have custom attributes, which can adjust the package on an instance-by-instance basis. Extremely useful if you know how to code in the functionality.

For your use case, the package can probably contain both models combined with one of them transparent, with a script that chooses which variant should be visible based on a custom attribute within the package. You can read the specific post about it below. Hope this helps!

1 Like