< Scratch File Format (1.4)

This is part of a technical description of the file format.

An Object Table contains a list of serialised Objects.


Object tables have the following structure:

  • header: "ObjS", binary 1 encoded to a byte, "Stch", binary 1 again.
In Python, this looks like "ObjS\x01Stch\x01".
  • size: 32-bit (unsigned?) integer — number of objects in the table.
  • objects: size number of serialized Objects.

Object References

Object references allow objects to store attributes that are not simple Inline Values, by pointing to other objects. They also help to avoid circular references.

From a post by nXIII:

The object references are there to preserve identity and store potentially circular structures--for example, a sprite contains a reference to its parent (the stage), and its parent contains a reference to that sprite. If the stage was serialized each time it appeared in an object's field, attempting to serialize it would result in an infinite loop (serialize stage -> serialize child sprite -> serialize parent stage -> ...). With object references, each object is serialized only the first time it is encountered (including an object ID), and if it occurs again, a reference is inserted in its place. When the objects are deserialized, these object references are resolved using a lookup table, so they store references to the same object.

References are found inside both Fixed-format Objects and User-class Objects.


  • classID: 99 (63 in hex)
  • index: 24-bit integer. The first entry in the Object Table is numbered 1 (not 0 as in most programming languages).


There can be a maximum of 255 different kinds of objects. An object table can store a maximum of 2^24 - 1 (that's 16777215) objects.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.