[AV3.0 SDK] Add the option for a 4-Bit ShortInt to save on memory space.
tracked
S
Stefleff
I very much would like to see the option for an 4-bit non-signed Integer (Values 0-15) called a Short/ShortInt (or maybe a Nibble, but I think that's less intuitive) to save on memory space for use cases that don't need such a large range.
There are many reasons why someone would prefer to use an Int:
- Automatic swapping of toggles in menus
- Easy greater/less/not-equal comparisons
- Ease-of-use handling one parameter instead of multiple
(Compared to an array of bools)
But for many common situations an 8-bit Int is way too overkill, taking up unnecessary space in the memory bandwidth.
For example it's very common for an Int to be used for exclusive toggles in the Menu (meaning toggles where only one option can be active at a time), but rarely do those toggles exceed the size of a submenu, meaning 8 options (9 if you're counting 0).
Another less frequent, but important, use case is the use as an Enum (An Integer encoding different States of a certain thing). And again there are many situations where, at least I personally, didn't need the full 256 range of an Int. A good example here is the GesturesLeft and GestureRight Ints, both of them being an Enum with 8 defined states. (I know that those two don't count to the memory limit, I use it as an example)
The only problem I would see with a ShortInt is how intuitive it is for a non-programming user. Currently there is a 1-to-1 correlation between the data types used in the Parameters Object and the data types used in the Animator. Now if there is a new option, like the short, in the Parameters Object, I could see that there would be some users confused on what that correlates with in the Animator. It obviously would be stated in the documentation that it's a type of Int, but I think that there should also be an additional Info-Box on the Parameters Object that pops-up once you select a ShortInt that says something like:
"A ShortInt is an Integer limited to the values of 0-15, therefore only taking up 4 Bits of memory. It is identical to a normal Int in every other way. A ShortInt has to be defined as an Int in the Animator"
Log In
Smash-ter
Adding bit depth for ints and floats would be nice
Julian Astrum
this needs looking at,why do we have so little data for avatars?
Scout - VRChat Head of Quality Assurance
tracked
Adeon Writer
S
Stefleff
Adeon Writer: I know about that thread, I also left a comment on it. In my opinion, choosing the amount is unnecessary complexity.
Integers of size 1 are just bools, 2 and 3 are too small for most use cases and 5-7 are only marginally cheaper than 8 bit Integers. 4 bit Integers show a sweet-spot where they are big enough to be usable whilst cutting the cost in half.
Implementing a way to adjust Integer size adds a lot of overhead on the syncing, where you would have 9 effective data types (bool, float, Int 2-8) instead of 4 (bool, float, Int 8, Int 4). And they would also have to implement checks for all Integer sizes for the Parameter Driver and the Expression Menu, so that you cannot exceed the range.
tl;dr Too much additional effort for minor value.
ItsTacosDude
I'm pretty sure Unity only supports Integers, Floats, Bools, and Triggers according to this: https://docs.unity3d.com/Manual/AnimationParameters.html
S
Stefleff
ItsTacosDude: yes it does, but as stated in the last two paragraphs. "A ShortInt has to be defined as an Int in the Animator". The differentiation between Ints and ShortInts is only for the VRC Parameters Object and therefore for syncing.