This plugin integrates SCORM (Sharable Content Object Reference Model) functionality into your Godot projects, allowing your games or applications to communicate with Learning Management Systems (LMS) via xAPI (Experience API), also known as Tin Can API.
- xAPI Communication: Send xAPI statements from your Godot project to an LMS.
- SCORM Initialization and Termination: Manage SCORM sessions directly within Godot.
- tincan.xml Generation: Automatically generate the
tincan.xmlfile required for SCORM packages. - JavaScript Bindings: Utilize JavaScript code for advanced SCORM interactions.
- Export Packaging: Prepare your project for deployment as a SCORM-compliant package.
- Installation
- Usage
- Building the xAPI JavaScript Bundle
- Exporting the Godot Project with Custom HTML Template
- Preparing the SCORM Package
- Configuration
- Requirements
- License
- Author
-
Copy the Plugin:
Copy the
addons/scormdirectory into your Godot project'saddonsdirectory. -
Enable the Plugin:
In the Godot Editor, navigate to Project > Project Settings > Plugins and activate the SCORM plugin.
Once enabled, the plugin registers a singleton named SCORM accessible throughout your project.
To ensure the SCORM singleton is globally available and initializes correctly, add it to your project's Autoload settings:
-
Navigate to Autoload Settings:
In the Godot Editor, go to Project > Project Settings > Autoload.
-
Add the SCORM Script:
- Click the Add button.
- Set the Path to
res://addons/scorm/scorm.gd. - Set the Node Name to
SCORM. - Ensure the Singleton checkbox is checked.
-
Save the Settings:
Click Add to confirm and save the autoload settings.
You can use the following methods provided by the plugin:
-
Initialize SCORM Session:
SCORM.scorm_initialize()
-
Terminate SCORM Session:
SCORM.scorm_terminate()
-
Set SCORM Value:
SCORM.scorm_set_value(element: String, value: String)
-
Get SCORM Value:
var value = SCORM.scorm_get_value(element: String)
-
Commit SCORM Data:
SCORM.scorm_commit()
func _ready():
SCORM.scorm_initialize()
SCORM.scorm_set_value("cmi.score.raw", "85")
SCORM.scorm_commit()The plugin includes a JavaScript bundle that handles xAPI communication.
-
Navigate to the Directory:
cd addons/scorm/godot-xapijs -
Install Dependencies:
npm install
-
Build the Bundle:
npm run build
The compiled
bundle.jsand updatedhtml_shell.htmlwill be located in thedistdirectory.
After building the JavaScript bundle, you need to export your Godot project using the custom HTML template generated during the build process.
-
Set Custom HTML Template:
In the Godot Editor:
- Go to Project > Export...
- Select the Web (HTML5) export preset or create one if it doesn't exist.
- In the Export settings, find the Custom HTML Shell option.
- Click on the folder icon next to Custom HTML Shell and navigate to the
addons/scorm/godot-xapijs/dist/html_shell.htmlfile.- If you can't find
html_shell.html, ensure you have completed the Building the xAPI JavaScript Bundle step.
- If you can't find
-
Export the Project:
- Set the Export Path to your desired output directory, e.g.,
export/web/index.html. - Click Export Project to export your project using the custom HTML template.
- Set the Export Path to your desired output directory, e.g.,
-
Verify the Export:
- The exported project should now include the custom
index.htmlthat integrates the SCORM and xAPI functionality. - Ensure that the exported files are located in the
export/webdirectory (or the directory you specified).
- The exported project should now include the custom
To package your project as a SCORM-compliant ZIP file:
-
Render
tincan.xmland Package:npm run prepare-scorm
This script performs the following:
- Renders the
tincan.xmlfile using your project'sproject.godotconfiguration. - Zips the contents of
export/webintoexport/scorm.zip.
- Renders the
-
Result:
The SCORM package
scorm.zipwill be ready for deployment to an LMS.
Ensure your project.godot file contains the following fields:
-
Application Name:
config/name="Your Application Name"
-
Application Description (optional):
config/description="A brief description of your application."
These fields are used to generate the tincan.xml file required for SCORM packaging.
- Godot Engine: Compatible with Godot 3.x or higher.
- Node.js and npm: For building the JavaScript bundle and preparing the SCORM package.
- Web Export Template: Ensure you have the HTML5 export templates installed for Godot.
This project is licensed under the MIT License.
- George Gabra
- Email: george.gabra.jr@outlook.com
Feel free to contact me if you have any questions or need assistance with the plugin.
Happy developing! Integrate SCORM into your Godot projects seamlessly with this plugin.