GameMaker (2.0 - 2.2.x)
Icon

MessagePack

Meseta

You must be logged in to obtain assets

Description

A pure-GML implementation of the MessagePack protocol. Is able to encode or decode ds_map and ds_list into/from msgpack structures stored in buffers.

Usage guide and support: https://meseta.itch.io/gm-msgpack

MessagePack is a light-weight binary serialization format with wide language support, often described as "like JSON, but more binary". See https://msgpack.org for more details.

This set of scripts uses pure GML to do the conversion, making it safer for cross-platform use as it does not depend on external DLLs. However, the consequence of this, and due to some of the limitations of GML's datastructures, it is slower than the native json_encode/decode.

Basic usage

The function msgpack_encode() takes a buffer and a ds_map. It encodes the map as binary data inside the buffer. The buffer can then be transmitted or saved to file.

var buffer = buffer_create(100, buffer_grow, 1);
msgpack_encode(buffer, map);
buffer_resize(buffer, buffer_tell(buffer)); // resize to exactly the right size
buffer_save(buffer, "save.bin");

The function msgpack_decode() takes a buffer and returns a ds_map or ds_list depending on what is contained within the messagepack.

var map= msgpack_decode(buffer);

End User Licence Agreement (EULA).

Age Rating: 4+

Version

GMS2 - Version 1.0.0. Published May 28, 2018

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait