Open timhutton opened 8 years ago
I like it. Do all programming languages have base64 coders and decoders, like python, or is it always included in the JSON libraries independently of the language. Just to be sure that this solution is language-independent.
Sounds great! What would the format of the decoded json look like?
@jorallo: My thought was that users can use Grid
to extract whatever blocks they want from the compressed string. As part of the API it would be available in all the languages.
@katja-hofmann: ObservationFromGrid
currently sends a JSON structure with the block information in it, so the simplest is simply to use that.
Sending potentially huge grids in the observer is nearly always wasteful, since subsequent frames have large overlap. An API for requesting blocks would be much better than having to decide beforehand which range to observe. At the very least the grid observer should contain an option to transfer only the differences to what's already known to the client. This boils down to the ability of sending shift information and sparse changes, maybe composed of sub-cuboids (since many changes are expected at the edges).
Issues #105, #24 and #48 require a way to work with a cuboid of Minecraft block data and to send and save it efficiently.
A
Grid
class might have the following API:The block data would be compressed as (e.g.) a base64 encoding of a zip of a JSON structure.
A new
DrawingDecorator
element would take such a compressed string, e.g.:Then the current
ObservationFromGrid
could have a new Boolean flagcompressed
(default=false) that determines if it sends as the current JSON string or the compressed version. Another flagsendOnlyAtStart
(default=false) could specify if the observation is sent on every world tick or just at the beginning (after the generators have run). Another flagabsoluteCoordinates
(default=false) could specify whether the requested coordinates of the grid observation are relative to the player (as is currently the case) or in absolute coordinates, for e.g. retrieving a maze.