phetsims / natural-selection

"Natural Selection" is an educational simulation in HTML5, by PhET Interactive Simulations
GNU General Public License v3.0
3 stars 7 forks source link

Query parameters cannot be used to set the initial population for a wrapper. #318

Closed pixelzoom closed 1 year ago

pixelzoom commented 2 years ago

In https://github.com/phetsims/studio/issues/268, it was determined that using query parameters with wrappers is problematic, and that setting a Property (or calling an API function) should be preferred.

There are 4 query parameters related to setting the initial population: introMutations, introPopulation, labMutations, labPopulation. They are documented in NaturalSelectionQueryParameters.js.

History of the design and implementation of those query parameters can be found in https://github.com/phetsims/natural-selection/issues/9. A fundamental goal was to use those query parameters for both phet and phet-io brands of the simulation. But with phet-io brand, that's currently possible only with Studio. If a wrapper uses those query parameters, it will break the API, and will be overwritten with the initial population that was saved from Studio. This makes it impossible to create a wrapper where the student can specify an initial population.

Is the current limitation OK, or does something need to be changed?

Propority high, because Natural Selection is up next for https://github.com/orgs/phetsims/projects/44.

pixelzoom commented 2 years ago

@kathy-phet and I discussed this. This could be addressed by creating a PhET-iO API function to set the population, and call that function after state has been restored by the wrapper. The query parameters and the API function should use the same underlying code. This would be a non-trivial development task, and we don't have time for it now. So our conclusion is that not being able to use these query parameters with a wrapper is an acceptable limitation for now. If a client ever requests this, we can revisit.

@amanda-phet if that sounds OK to you, please close this issue.

amanda-phet commented 1 year ago

@kathy-phet didn't our original client request this? I thought that was a primary request. But I might not understand fully, because maybe they weren't using it in a wrapper? I see that these can still be used with studio, so as log as @kathy-phet says that is ok then it's fine by me!