Repository navigation
World snapshot: save_world and load_world (#149, first part) - #160
Merged
Merged
Conversation
aephysics.snapshot keeps everything a step reads: the settings, the id pools, the solver sets, the bodies, the shapes with their geometry once each, the fat boxes, the contacts with their manifolds and mesh caches, the joints, the sensors, the islands, the trees and the pair set, and the graph's colours. A world loaded from it steps on bit for bit as the one it was taken from. A snapshot of another layout, or one whose counts, geometry or invariants fail their checks, loads no world. The world owns the meshes, height fields and compounds it was loaded with (dynamics.adopt_geometry); hulls go through the hull database. height_field.height_field_bytes_valid joins its hull and mesh kin.
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.
The first part of #149: the world snapshot (Box3D
e77352c's world_snapshot.c). Recording and replay start from one, and it is useful on its own: save states, rollback, debugging a step.aephysics.snapshot:save_world(world_id) -> (bytes, count)keeps everything a step reads:dynamic_treesaves them;load_world(def, bytes, count) -> WorldIdmakes a world fromdefand fills it.hull_bytes_valid,mesh_bytes_valid, the compound's sections, and the newheight_field_bytes_valid);dynamics.adopt_geometry, freed with the world). Hulls go through the hull database.tests/test_snapshot.ae(50 checks):hash_world_state) and steps 150 steps beside it bit for bit, with the same contact, sensor and hit events every step.Found on the way: aether#2611. Same-named locals of different pointer or struct types in sibling
whileblocks orifbranches pass the type checker, but the generated C declares one variable of the first type, so gcc stops. The code here gives each local its own name.Local gate on Aether 0.795.0: all 35 suites pass with no warnings, and the golden trace matches bit for bit (1,256 steps). Pins: Aether 0.795.0 and aeb v0.325, the latest releases.
Refs #149 (recording, replay and the name cache are next).