Buffers

A buffer is a region of physical memory used to temporarily hold data while it is being moved from one place to another or manipulated in some way, for example you can use a buffer to hold packet data awaiting transmission over a network or for storing a packet that has been received over a network. GameMaker has a number of specific functions related to creating, modifying and loading/saving buffers, but before using them please note the following points:

The following pages explain how buffers work within the context of GameMaker and contain a couple of code examples for those users that are unsure of how to use them:

IMPORTANT! When you create a buffer, the index value used to identify it is an integer value starting at 0. These indices are re-used by GameMaker, so a destroyed buffer index value may be used by a newly created one afterwards, and we recommend that you set any variable that holds a buffer index to -1 after having destroyed the buffer.

The following functions exist for you to use with binary buffers in your games:

 

There are also two extra functions related to buffers that can be used to save and load game states (note that they require a buffer to have been created previously):

 

Finally, you can also use special Vertex Buffers to create your own custom primitives or models, etc... You can find out more about these from the following section of the manual: