2

We are still absolute beginner in moodle. I will try to phrase our query as clearly as possible.

So, the basic requirement for our project is that, we be able to host unity games in moodle courses and track the student performances in each of the unity games. For now we have decided to go with xAPI standard. We have already setup a free LRS from scrom cloud.

My query is : How can I (moodle side developer) send the information on who is the current user that launched the unity game. So that my game developer friend can later send the statements like : A USER clicked in the BUTTON. Or, a USER ended a game with the score of 82. And things like that.

I am finding it very hard to grasp the general idea of how this works. Any help would be highly appreciated. Just pointing in the right direction would help a lot.

Sijan Bhattarai
  • 570
  • 2
  • 6
  • 25

1 Answers1

1

To be able to use your Unity project in Moodle you will have to add it as an activity. Moodle handle different kinds of activites (SCORM, H5P...) You can instal the following plugin which implements xAPI https://moodle.org/plugins/mod_tincanlaunch in Moodle and look its source code to get an idea. When installed, you will find the source code in the folder:

mod/tincanlaunch/

I think the general idea is:

Get the current user info in Moodle:

global $USER
$username= $USER->username;
$firstname = $USER->firstname;
$lastname = $USER->lastname;

Post those information to Unity

Get it in Unity

Then send to LRS and/or Moodle.

Maybe you can fit your Unity project to mod_tincanlaunch if it meets your needs.

Ludo
  • 743
  • 1
  • 10
  • 25
  • Hey thanks for the response, My question was about the line "Post those information to Unity". How do I do that ? I am sorry if my question was not clear. – Sijan Bhattarai Sep 18 '20 at 02:38
  • I do not know in details, but I think that if you install the plugin https://moodle.org/plugins/mod_tincanlaunch, add a new activity with this plugin, you can see the URL it uses to launch the activity. Then explore the file in source code (maybe launch.php have information about that). – Ludo Sep 18 '20 at 09:31