Skip to content

Action-based Puoribor environment serialization #11

Description

@yklcs

Currently, a single step (state, agent_id, action) of the Puoribor environment requires at least 331B to serialize.1 For a 100 turn game, this results in a 331 * 2 * 100 = 66.2KB history.

This is pretty inefficient, and can be solved by simply only using the actions of each step.

All fights environments are pure functions of the form:

$$\mathrm{env}(\mathrm{state}_n, \mathrm{action}_n) = \mathrm{state}_{n+1}$$

With $\mathrm{state}_0$ known, all we need are $\mathrm{action}_0 \cdots \mathrm{action}_{n-1}$ to reconstruct $\mathrm{state}_{n}$.

Using this method, all we need are 4B to serialize each step. Action-based serialization should be explored.

Footnotes

  1. $(9 \times 9 \times 4 + 2 + 1) + 3 + 1$ uint8 are needed. In reality, 425B is needed using MessagePack. The initial state is encoded as g6VzdGF0ZYOlYm9hcmSUmZkAAAAAAAAAAACZAAAAAAAAAAAAmQAAAAAAAAAAAJkAAAAAAAAAAACZAQAAAAAAAAAAmQAAAAAAAAAAAJkAAAAAAAAAAACZAAAAAAAAAAAAmQAAAAAAAAAAAJmZAAAAAAAAAAAAmQAAAAAAAAAAAJkAAAAAAAAAAACZAAAAAAAAAAAAmQAAAAAAAAAAAZkAAAAAAAAAAACZAAAAAAAAAAAAmQAAAAAAAAAAAJkAAAAAAAAAAACZmQAAAAAAAAAAAJkAAAAAAAAAAACZAAAAAAAAAAAAmQAAAAAAAAAAAJkAAAAAAAAAAACZAAAAAAAAAAAAmQAAAAAAAAAAAJkAAAAAAAAAAACZAAAAAAAAAAAAmZkAAAAAAAAAAACZAAAAAAAAAAAAmQAAAAAAAAAAAJkAAAAAAAAAAACZAAAAAAAAAAAAmQAAAAAAAAAAAJkAAAAAAAAAAACZAAAAAAAAAAAAmQAAAAAAAAAAAK93YWxsc19yZW1haW5pbmeSCgqkZG9uZcKmYWN0aW9ukwAAAKhhZ2VudF9pZAA= this way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions