A downloadable extension

Download NowName your own price

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
StatusReleased
CategoryAssets
Rating
Rated 5.0 out of 5 stars
(1 total ratings)
AuthorYellowAfterlife
TagsGameMaker

Download

Download NowName your own price

Click download now to get access to the following files:

BitBuffers.gml 5.4 kB
Version 1.0.0
BitBuffersDemo.zip 23 kB
Version 1.0.0