Skip to content

Bit Collections for Unity provides value type bit arrays and signed- and unsigned integers made out of an unconventional amount of bits and bytes

License

Notifications You must be signed in to change notification settings

MrUnbelievable92/Bit-Collections

Repository files navigation

Bit Collections

Bit Collections for Unity is all about saving as much RAM and/or network bandwidth as possible with a minimal performance trade-off, by providing array value types of single bits, aswell as array value types of signed- and unsigned integers with a given number of bits.

The compression applied is geared towards performance first, but can and should also be used before using advanced compression algorithms.

Since using less RAM usually comes at the cost of taking more time (CPU), this library uses SIMD instructions as much possible, resulting in the following dependencies:

  • Unity 2020.2.0f (C# 8 => unmanaged constructed types)
  • Unity.Mathematics
  • Unity.Burst
  • Unity.Collections (A native bit-array and generic, native "bit-number" arrays are defined)
  • Unity.Jobs (Mainly for de-allocating the mentioned arrays on a worker thread)
  • MaxMath (my SIMD library supplementary to Unity.Mathematics)
  • C Sharp Dev Tools (Conditionally compiled runtime-checks)

Bit Arrays:

alt text

Generic Bit Arrays:

alt text

Number Arrays:

alt text

Bit-Number Min- and Max Values:

alt text

Additionally, 3- 5- 6- and 7-Byte Numbers are defined:

alt text

... Which Work (almost) Just Like Normal Integers:

alt text

How To Install This Library

Disclaimer: I firmly believe in open source - being able to copy/modify/understand other people's code is great :) I also want people to be able to step through code with a debugger. For these reasons I usually don't distribute DLLs.

  • Download the package and unzip it into your "LocalPackages" folder, which is located at the root folder of your Unity project (where your "Assets" folder resides at).
  • Start up Unity. Usually Unity detects new packages and will generate .meta files for you.
  • In case that doesn't work, open up the package manager from within Unity and click on the '+' symbol at the upper left corner of the window, further clicking on "Add package from disk..." - "Add package from git URL" should also work.

alt text

  • Locate the library's "package.json" file
  • DONE!

About

Bit Collections for Unity provides value type bit arrays and signed- and unsigned integers made out of an unconventional amount of bits and bytes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages