otacke / h5p-game-map

Let your students choose their exercises on a game map.
MIT License
3 stars 8 forks source link

Add a possibility to store a map-status in some kind of "cheat code" #68

Closed pechart closed 8 months ago

pechart commented 8 months ago

Is someone already finished a part of the map and he/she comes back later everything has to be done again. It would be great to give out something like cheat codes for the current level status (like in the 80/90s console games w/o storage possibilities).

otacke commented 8 months ago

There already is a solution to this problem: H5P features resuming. Please refer to e. g. https://snordian.de/2023/03/04/how-does-resuming-an-exercise-work-in-h5p/

danmarsden commented 1 month ago

Hi @otacke - we've tried using this activity on a Moodle site with the content resume feature enabled and it doesn't seem to be allowing the user to resume where they left off when returning to the activity - are there certain parts of your plugin that support resuming or are there certain parts that allow resuming?

I also note that the h5p.com site lists Game map as not currently supporting the content resume feature: https://help.h5p.com/hc/en-us/articles/7506467194653-Content-Resume

but hard to know if that's correct either!

danmarsden commented 1 month ago

interestingly - it does seem to support resume in a newer Moodle 4.5 site, so probably an issue on our end rather than an issue with the library itself.

otacke commented 1 month ago

@danmarsden GameMap has been supporting resuming right from the beginning. I am sorry, but I can neither tell why it is not working on your end nor why H5P Group claims it was not supported.

otacke commented 1 month ago

@danmarsden If you're interested: Here's the function that is responsible: https://github.com/otacke/h5p-game-map/blob/master/src/scripts/mixins/question-type-contract.js#L72 It gets called by H5P's core in order to store a state.

As you can see, there are three causes that could prevent storing the state.

  1. There's no main component set yet. This is merely a precaution though, because the main component is set up in the constructor already.
  2. and 3. If no subcontent reports to have been answered (if it doesn't have a respective getAnswerGiven method to tell, GameMap takes over and assumes yes as soon as content was viewed) and if at the same time there's no global time limit set (you'd want to store the global time left in any case), then a blank state is saved, as the user has either not opened a stage yet.

So, it's possible that there is a subcontent which does not implement getAnswerGiven as it should and that you happen to use. Still sounds rather unlikely to happen in practice, because this would have to have been the only subcontent to have been interacted with - and because you're telling that it is working on another system. But it is possible. Could you please provide me with access to a GameMap content where resumimg fails or tell me what subcontents were used?

It is also possible that there's an issue with your H5P integration, but if resume is activated and working with other content types, that can be ruled out.

Oh, and I have reached out to H5P Group and asked them why they claim resume was not working.

otacke commented 1 month ago

@danmarsden H5P Group corrected their overview.

danmarsden commented 1 month ago

Thanks @otacke - nice to have the extra context there too - and even better to have the h5p docs reporting the correct situation too!

I'm pretty sure the issue is on the plugin side in our end rather than on yours - one of the challenges is that there are basically 2 different "plugins" for running h5p within Moodle - one maintained by Moodle core, and the other maintained by H5P themselves. Interestingly the "latest" version of the Moodle core plugin seems to allow resuming fine, but the plugin maintained by H5P doesn't seem to be supporting the resume - I don't think there's anything you can do on your end but I'll reach out again if we discover something specific to the gamemap code (thanks for pointing at the functions responsible in there too!) - and thanks for sharing the content type with the community! :-)

otacke commented 1 month ago

@danmarsden If you need more insight into how resuming works (across different H5P integrations), then maybe https://snordian.de/2023/03/04/how-does-resuming-an-exercise-work-in-h5p/ can help.