Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Delta Patch Format

AoE2DE streams game state changes through the gRPC Frames RPC as binary delta patches. This document specifies the patch format as reverse-engineered by the delta-play-replay project.

The state model definition used to interpret patches can be found in model.rs.

Overview

The format is stack-based and requires a pre-definition of the state object. Instructions either modify the patcher state (navigating the object tree) or the state object itself.

Each instruction starts with 1 byte (the action ID), followed by variable-length arguments. Argument sizes can only be resolved by maintaining the current patcher state, since field types determine how values are read.

Actions

Object methods:
 1 - Pop
 2 - Assign Field
 3 - Push Field
 4 - Push, Create and Assign Field
 5 - Reset Field

Map methods (sometimes used for lists):
 6 - Assign Key
 7 - Push Key
 8 - Push, Create and Assign Key
 9 - Reset Key

List methods (sometimes used for maps):
10 - Insert
11 - Push, Create and Insert
12 - Remove
13 - Swap
14 - Resize

1. Pop

Pop an object from the stack (go to the parent object).

Takes no arguments.

2. Assign Field

Set a field to a value.

NameTypeDescription
Fieldu8Which field to assign to
ValueDynamicValue to assign

3. Push Field

Push the object in the given field onto the stack (make it the current context).

NameTypeDescription
Fieldu8Field to push

4. Push, Create and Assign Field

Create a new object for the given field, assign it, and push it onto the stack.

NameTypeDescription
Fieldu8Field to assign the new model to
Model Typeu8Which model to create

5. Reset Field

Remove the object on the given field.

NameTypeDescription
Fieldu8Field to reset

6. Assign Key

Set a key in a map (or list) to a value.

NameTypeDescription
Fieldu8Field with map or list
Keyi32Key to assign to
ValueDynamicValue to assign

7. Push Key

Push the object at the given key onto the stack.

NameTypeDescription
Fieldu8Field with map or list
Keyi32Key with the object to push

8. Push, Create and Assign Key

Create a new object, assign it to the given key, and push it.

NameTypeDescription
Fieldu8Field with map or list
Model Typeu8Which model to create
Keyi32Key to assign to, and push

9. Reset Key

Remove the object at the given key.

NameTypeDescription
Fieldu8Field with map or list
Keyi32Key to the value to reset

10. Insert

Insert a value at the given index in a list.

NameTypeDescription
Fieldu8Field with list
Indexi32Index to insert to
ValueDynamicValue to insert

11. Push, Create and Insert

Create a new object, insert it at the given index, and push it.

NameTypeDescription
Fieldu8Field with list
Model Typeu8Which model to create
Indexi32Index to insert to, and push

12. Remove

Remove an object at the given index.

NameTypeDescription
Fieldu8Field with list or map
Indexi32Index to remove

13. Swap

Swap two entries in a list or map.

NameTypeDescription
Fieldu8Field with list or map
Index Ai32Index of value to replace B with
Index Bi32Index of value to replace A with

14. Resize

Resize a list to the given length. In some cases, child objects are expected to be created automatically.

NameTypeDescription
Fieldu8Field with list
New Lengthi32New length of list