Procedural Generation

VirtualHome has procedural generation capabilities to create new environments on demand during runtime. This implementation of procedural generation in VirtualHome supports the generation of new layouts and objects, but also allows the user to use a seed to generate any environment they want and share it with others. Addtional parameters such as altering the amount of specfic rooms generated inside a environment can also be used.

You can use procedural generation by using unity_simulator.UnityCommunication.procedural_generation() function, and can specify additional parameters such as the desired seed_id(). After a environment is created through the procedural generation process, the interaction with the environment becomes the same as the custom designed environments where all the available interactive features in VirtualHome are supported. Essentially procedural_generation() replaces the comm.reset() function.

# This is the basic function with the default paramameters that you call to activate procedural generation.
comm.procedural_generation(seed=random)

Example

The following example shows how one could use procedural generation:

# Start procedural generation and returns a Boolean flag with the seed_id used during generation
comm.procedural_generation()

# When you want to reload the same procedurally generated environment, call the same function but with the same seed_id.
comm.procedural_generation(seed_id=37492)

Below is a list which provides more information for the parameters available for procedural generation.

seed_id

The seed integer value used to generate the same environment which was created by procedural generation. Allowing you to rebuild the environment and share it with others.

Arguments

integer or random

Modifier

Preconditions
  • communication with the unity executable file is active

Postconditions
  • A new environment will be generated

Example
  • comm.procedural_generation(seed_id=random)

Please note, the seed_id provided by the procedural_generation() function only works interchangebly with builds using the same version number! A important thing to keep in mind is that the parameter provided to the procedural_generation() function will need to be logically possible to generate or after a predefined number of attempts it will return False with a error message.

../images/vh_overview.gif

More features such as finer control over procedural generation is in the works.