Repository navigation
Conversation
New `binary_observations` export (also `--binary_observations` on the command line), off by default. When enabled, training observations are sent as hex-encoded float32 bytes instead of JSON number lists, which removes most of the per-step serialization cost with many agents. Keys containing "2d" and the ONNX inference path are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of edbeeching/godot_rl_agents#267: an opt-in way to send training observations as float32 bytes instead of JSON number lists.
What changes
Sync:binary_observations, off by default, also settable with--binary_observations.Array,PackedFloat32ArrayorPackedFloat64Arrayis sent asPackedFloat32Array(value).to_byte_array().hex_encode().2d, other value types, the ONNX inference path and the protocol version.It needs the decoder from edbeeching/godot_rl_agents#268. With the option off, nothing changes.
Why
The per-step cost with many agents is writing and parsing thousands of floats as text. Measured end to end with this branch and the package branch, with Godot 4.7.2 headless and 69 floats per agent:
Each case is the median of 3 runs of 1,500 steps. The decoded observations matched bit for bit. Hex is used instead of base64 because
hex_encode()is about 7x faster thanMarshalls.raw_to_base64()in Godot 4.7, and it is what2dkeys already use.How it was tested
A minimal project with this
Syncand NAIController3Dagents that return deterministic observations, driven by the package branch'sGodotEnv. Every 50th step, Python compared the decoded values with the expected ones. All runs matched in both modes.🤖 Generated with Claude Code