Plugins

The HYTOPIA SDK was built from the beginning with best-in-class developer and plugin support in mind. Developers can create their own plugins for themselves, or plugins that other developers can use. This is done by creating packages through NPM (Node Package Manager).

A HYTOPIA plugin and an NPM package are synonymous. A HYTOPIA plugin is an NPM package, and nearly every NPM package will work as a HYTOPIA plugin so long as it meets the requirements below.

Requirements

At the core, a plugin is just an NPM package that may or may not have a dependency on the HYTOPIA SDK for the features it provides. Whether a plugin offers specific functionality that expands the HYTOPIA SDK, or is just a generic set or utilities, or something else, there are a few unique constraints it must adhere to in order to work as expected.

  • No External Network Requests - Packages used as plugins cannot make external network requests. The HYTOPIA runtime environment for deployed games explicitly prevents outbound network requests to all but a few whitelisted domains for internal or supported services.

  • Package Must Be Public - To use an NPM package as a plugin, the package must be published publicly on NPM. This is because HYTOPIA internally performs an bun installof all your declared packages for your game when it is deployed to HYTOPIA's services. We may add support for private org packages in the future, but this isn't currently supported.

  • Terms Of Use Compliance - HYTOPIA reserves the right to blacklist specific plugins or use cases for plugins at any time in the future. If we believe a specific plugin or implementation pattern is impacting games or services in a way that is clearly not intended for our services, it may be blacklisted. For example, this includes but is not limited to using HYTOPIA services to harvest user data, serving web content separate from a game's experience, or any other use that violates our Developer Terms of Use, etc.

Creating Plugins

There's a number of guides available for creating Node.js packages that can be published to NPM. You can get started by reviewing official docs from npm, here.

Because a HYTOPIA plugin is an NPM package that conforms to our Requirements, there isn't a difference between creating a regular NPM package and a HYTOPIA plugin - the process is effectively the same.

The functionality exposed by your plugin is entirely up to you. The API developers use to interact with your plugin and how it depends on and interacts with the HYTOPIA SDK is also up to you.

Overall, you have nearly complete freedom to create plugins however you'd like so long as they conform to our Requirements.

Installing Plugins

If there's a plugin you'd like to use with your game, you can install it like any other package from npm. For example, a common utility library that many developers use is lodash. If we want to use lodash as a plugin in our game server, we can install it like so from the root directory of our HYTOPIA project.

bun add lodash

That's it! When you deploy your game to HYTOPIA's services, our deployment pipeline will look at the dependencies listed in the package.json of your game bundle and attempt to install all dependencies so long as they meet our Requirements.

Last updated