Bit Buffers for GameMaker
A downloadable extension
Quick links: documentation · source code
Supported versions: GameMaker LTS and GameMaker 2022+
Supported platforms: all
This is a pair of helper constructors for reading and writing buffers with per-bit granularity!
For example, if you did
var buffer = buffer_create(64, buffer_fixed, 1); var output = new BitOutput(buffer); output.writeInt(global.character, 0, 7); // (value, min, max) show_debug_message(output.tell()); output.finish();
the displayed buffer position would be 0.375
(3/8) because you only need 3 bits to represent an integer between 0 (inclusive) and 7 (inclusive).
And if you write a 3-bit number 3 times, the position would be 1.125
(9/8) as two numbers fit and the third has its last bit roll over to the second byte!
Rest assured, this can be useful for packing a bunch of data into limited space, such as Steam leaderboard metadata (with 64 bytes per entry total).
Published | 2 days ago |
Status | Released |
Category | Assets |
Rating | Rated 5.0 out of 5 stars (1 total ratings) |
Author | YellowAfterlife |
Tags | GameMaker |
Download
Click download now to get access to the following files: