phetsims / build-an-atom

"Build an Atom" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/build-an-atom
GNU General Public License v3.0
11 stars 10 forks source link

Assertion occurs after completing a level and starting a new one #185

Open jbphet opened 6 years ago

jbphet commented 6 years ago

If the user plays a level, completes it, then starts a new one, the following assertion occurs:

Assertion failed: challenges should be cleared before starting a new game

As of this writing, the SHA for the master version is 7dd6e27135751a4edcb7108113ad66acee1d780f, and this problem is coming from line 190 of BAAGameModel.js.

I believe this problem is closely related to work that was being done on the game in order to instrument it for PhET-iO. That effort is being tracked in #156. The two most relevant commits are https://github.com/phetsims/build-an-atom/commit/f77898e35ae3e8a72da19ed773c4eb1d41387fbd and https://github.com/phetsims/build-an-atom/commit/55983a792532326c2318bd2587e6e96bab8ef6f8. The problem had to do with making sure that the game challenges were being disposed, but only once, because otherwise something went south with PhET-iO.

I'm going to comment out the assertion so that the game can be played and assign this to @samreid for investigation. It's possible that this may cause some breakage in automated test of the phet-io version.

jbphet commented 6 years ago

By the way, I stumbled on this while working to address https://github.com/phetsims/vegas/issues/68.

zepumph commented 6 years ago

The commented out assertion from https://github.com/phetsims/build-an-atom/commit/c85709ab4bba2b7ca2abdec06b897b7b195e9418 seems to have only moved to downstream errors in the phet-io state wrapper. Today @chrisklus and I found an error when completing a level the following error:

Assertion failed: Cannot register two different instances to the same id: buildAnAtom.gameScreen.view.levelCompletedNode.continueButton.textNode.visibleProperty

basically it seems like LevelCompletedNode isn't being disposed correctly.

zepumph commented 6 years ago

@chrisklus and I were able to get the LevelCompletedNode and BAARewardNode to be properly disposed when restarting the state to "Choose you level." From here this exposed an error that I think links up pretty well to @jbphet's first comment in the issue:

Assertion failed: Impossible set state:
buildAnAtom.gameScreen.model.challengeSets_0.challenges_0
buildAnAtom.gameScreen.model.challengeSets_0.challenges_0.challengeStateProperty
buildAnAtom.gameScreen.model.challengeSets_0.challenges_0.numSubmissionsProperty

so from here I think we are a bit closer to getting BAA game running in phet-io fuzz, but not yet.

ariel-phet commented 6 years ago

@samreid does not have time to work on this right now. @chrisklus this seems like a good task for your iO learning, and since this is a @jbphet sim he can help where needed.