Buffer Functions
This article is an overview of Buffer related function's. Buffers are generally used for sending packets of data with network functions.
This chart should help you figure out byte alignment of the different buffer data types. This chart is only an approximation of what the byte alignment should be for the most optimal performance.
Data Type | Byte Alignment |
---|---|
String | 1 byte |
Signed or unsigned 8bit integers | 1 byte aligned with buffer_fast/any alignment with other buffer types |
Signed or unsigned 16bit integers | 2 bytes |
Signed or unsigned 32bit integers | 4 bytes |
Floats smaller than or equal to 16bits | 2 bytes |
Floats small than or equal to 32bits | 4 bytes |
Floats small than or equal to 64bits | 8 bytes |
NOTE: It is important to delete and free buffers from memory when you are finished with them, otherwise they continue to sit in memory and will continue to grow the memory usage of your game as you work with them.
Saving, loading, reading, and writing functions all respect the buffer type and whether the contents are wrapped, clamped, or grow able.
Creation and deletion of buffers:
Saving to a file:
Loading from file:
Manipulating surfaces to and from buffers:
General buffer manipulation utilities:
Querying properties of buffers:
Compression and decompression using zlib
:
Read and write values using buffers:
- Reading
- Writing
- Miscellaneous
Base64 functions:
Cryptographic functions:
Saving and loading of game state using buffers: