npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hytopia-ui

v0.0.4

Published

A library required to be included in your UI developed for a HYTOPIA game. Handles environment setup, provides helpers, and more.

Downloads

207

Readme

HYTOPIA UI Library

This is the core library required for any in-game HYTOPIA UI.

Even if you are not using the data features, this library must be imported in your UI because of the internally managed cross-frame communication it sets up and handles.

The HYTOPIA UI Library automatically handles configuring cross-frame communication between the game scene and your developed UI within HYTOPIA's sandboxed UI environment.

Installation

This library must always be included in your UI. Not doing so will break HYTOPIA's cross-frame communication and prevent UI and game focus from working!

If you're using a framework and need to install and import the package for extended feature use, you can do so by running the following command:

npm install hytopia-ui

If you're using vanilla HTML & JavaScript for your UI, or would prefer to include this using a tag you can do so by adding the following to the bottom of your tag:

<script src="https://unpkg.com/hytopia-ui@latest/dist/index.umd.js"></script>

Sending & Receiving UI State Data

To send data to your game server, you can do so as follows:

// The data object sent can be any shape and have any properties or values.
// We recommend minimizing the amount of data sent where possible. Sending
// or receiving too much UI data too frequently can create latency issues
// on poor connections.
hytopia.ui.sendData({
  some: 'data',
});

To receive data sent from the server to the UI, you can do so as follows:

// data is an object that can have any
// properties with any JSON compatible values
hytopia.ui.onData = data => { 
  console.log('received data from server:', data);
};

Data sent from the player UI to the game server will be received by the server as being from that specific player. You can fully control the UI data state and interactions between client and server uniquely for each player.

Data received from the server will be received by the UI as an object with any properties and values. You can use this data to update the UI state or interact with the game server in any way you see fit. UI Data can be sent from the server globally or to a unique player, you have full control over this through the HYTOPIA SDK.