Gorilla includes a fully-featured Code Editor, giving you the full power and flexibility to program your own tasks. In particular, it gives you the freedom to add features that are not well suited to the Task Builder tool, such as dynamic adaptivity, complex randomisation, rich feedback, games and special effects.
At heart, it is a blank canvas - you get
gorilla.ready(), which is an entrypoint that guarantees that the whole page is loaded and ready.
gorilla.manipulation(), which lets you know how the user has configured your task, and
gorilla.metric(), which allows you to upload metrics.
Finally, you get
gorilla.finish(), which tells Gorilla that you're finished.
These four functions give you the smallest interface needed to run a task within Gorilla. You still get all the same cloud features - experiment design in the tree, participant handling, metrics collection and storage - as long as you tell Gorilla when you have metrics and when you're finished, your code will integrate seamlessly.
For seasoned coders, the minimal interface above might be all you want.
You have access to the
<head> so you can reference in your own libraries at will.
You could, for instance, use this to include JSPsych or a third party gaze detection or voice processing library.
For those who prefer a more streamlined experience, all areas of the Gorilla runtime system are available. You can use our rendering system of Handlebars templates, our layout system which provides resolution-independant sectioning of the screen, and our state machine system which allows you to easily and neatly implement your task as a Finite State Machine.
To see an example go to the Tower of Hanoi task in your Starter Project. This has been built in the code editor. It uses our own 2D engine which is built on PIXI.
We have many exciting upgrades planned for the Code Editor, including the ability to use more of the Task Builder systems (such as the spreadsheet), and the ability to deploy games built in Unity
If you would like more information about the Code Editor, please get in touch!
For those that don't want to code from scratch, both the task builder and questionnaire editor allow you to add a small code snippet to customise their behaviour.
The Script Demo in the Starter Project shows an example of this.