Repository navigation
World GB2: a generated world is a dataset (data-generate) - #1396
Merged
Merged
Conversation
A generated world reaches the physics the way a loaded city does (ARIADNE_WORLDS section 18.8, GB2): - The data store makes datasets as well as fetching them: a request with generate: and params: runs a registered generator for its files, which decode as a fetched one's do (city_bundle). The built-in generated_world makes the world and writes it as a version 2 city bundle, so its world is the bundle read back. Documents name one in data: (generate:, params:), programs with (data-generate NAME GENERATOR [PARAMS]), hosts with register_data_generator. DataStore::put publishes a dataset its owner already made. - A generated_world node publishes each world it makes, headless or drawn, as its dataset data.<id>, replaced in place on Regenerate (its rev up), and its body is that dataset's world, as a data node's is. SceneWorld::generated_world(id) now also answers when a renderer runs the node. - SceneWorld takes a dataset that is already ready when the world is built, so its bodies are there from the start. - cvcGL writes a rebuild's bundle in its world task, off the frame thread. - city_bundle publishes a version 2 bundle's hash, water level, region and generator.
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.
GB2 of ARIADNE_WORLDS section 18.8 (the design is #1380, the bundle format #1385): a generated world reaches the physics the way a loaded city does, through a dataset.
What changes
generate:andparams:runs a registered generator for its files, and they decode as a fetched dataset's do (city_bundleunlessas:says otherwise). The built-ingenerated_worldmakes the world (generate_world) and writes it as a version 2 city bundle, so the dataset'sworldis the bundle read back.generatedbeside it is the world as made (raster, roads, props).data: { world: { generate: generated_world, params: { seed: 7, half_m: 600 } } }(data-generate NAME GENERATOR [PARAMS])register_data_generator;DataStore::putpublishes a dataset its owner already madegenerated_worldnode is its dataset. Each world it makes, headless or drawn, is published asdata.<id>(or the node'sdata:prop) and replaced in place on Regenerate, with itsrevgoing up. Itsbody:is that dataset's world, as a data node's is.SceneWorld::generated_world(id)now answers when a renderer runs the node too (it was null).sync()as well (a holon callingfollowgets late datasets).city_bundlepublishes version 2's manifest:version,hash,water_level,region.*,generator(version,seed,params).Costs measured (MSVC Release, this box)
A terrain lab world (1.2 km, 500 trees, 90 rocks, 110 buildings):
At 5 km: 14.5 s, 1.9 s and 0.5 s. The write runs in the world task. The read (0.2 to 0.5 s) is on the frame thread at the swap, which is new; it is not measured in a browser.
Tests
ariadne_world_dataset_test(new, 4 tests):data-generatemakes the bundle the world made directly writes: same hash, the terrain's heights as stored, the same collide items; the same params share one dataset.generated_worldnode's dataset is ready at build, its bodies are the dataset's world, and Regenerate replaces it in place with its rev one higher.generate:entry gives a data node the same world (same hash) as the JSON request.cvcgl_ariadne_physics: the drawn world'sgenerated_world("world")is now the dataset's, with the same params and bundle hash as the headless world, and the state hashes still match.Locally: 1,599 matching ariadne, world, data, bundle and cvcGL ariadne tests pass (the full build, MSVC Release).
Not in this PR
streets.jsonandground.pngin the bundle go with the renderer (GB3).