📝Behavior Scripts

Behavior Scripts are ‘plugins’ of Morpheus.

Behavior Scripts are programs external to Morpheus Platform. They implement behaviors — event-based interactivity of Artifacts. Artifact developers can extend platform functionality using Behavior Scripts to make complex features out of simple blocks.

For example, a Scoreboard is a Content Display that changes its text every time it is hit by a Boxing Glove.

Hosting of Behavior Scripts

Behavior Scripts are designed to be developed by third parties as well as in-house. There are several options of where Behavior Scripts can be hosted:

HostingProsCons

Local machine of a developer using ngrok (read more).

Quick turnaround for developing and debugging.

  • Big latence, can’t be scaled

  • Requires for a local machine

Proprietary hosting of the developer

Host a script that integrates with custom products or services of the developer.

  • Needs robust hosting to scale

  • Delays with ‘close-to-realtime’ behaviors.

Google Cloud account of the developer.

Same as above, but faster as it is uses same Google infrastructure.

  • Requires Google Cloud

Morpheus Google Cloud, separate VM or part of Morpheus Backend.

Implement close-to-realtime behaviors.

  • In-house only

Same VM as Unity Server of a Place

Achieve better close-to-realtime performance

  • In-house only

  • Requires infrastructure for delivering behaviors to the VM of Unity Server

Implemented as part of the app

  • Best close-to-realtime performance

    • Can leverage internal features of the platform

  • In-house only

  • Requires app updates

Assigning Behavior Scripts

For a Behavior Script to work, it must be associated with a certain behavior. In other words, a behavior must be created in a Place and then connected with Objects via Behaviors.

It could be done by several ways:

  • When an object is spawned, it can be already inhabited by a behavior (or behaviors).

    • behaviors can be specified either in Module Manifest or in Module Config.

    • Behavior Script URL is provided in the spec.

    • same specification may contain two filters — listen and control — which will serve as dynamic connectors of this particular.

  • place messages can be sent with hope there is a Place Script which listens to them and enacts.

Behavior can change their sources and subordinates dynamically by sending messages as described above.

END

Last updated