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

bigbrain

v0.0.0-dev.0

Published

concept game engine

Downloads

2

Readme

monarch is in its cocooon

what does a monarch user want?

  • i want a simple <monarch-game> element to start building my online game

    • it consolidates and manages the follow subcomponents

      • viewport
      • overlay
      • netstate
      • simulator
    • pass in your game's entities

      • register your entity subclasses, and add them to the game world
      • your entities use babylonjs for interacting with the 3d world
      • several events are published for things in the game world
    • networking is easy

      • just set some connection attributes
      • comes with a standard server browser interface
    • ergonomic methods are provided

      • like game.add to add entities into the game world
  • sometimes i want to avoid the web component and want more control over the game

    • this allows you to use engines other than babylon

    • in this case the users put together the game manually

      • instance a netstate
      • instance a viewport and install the canvas
      • instance a simulator, provide netstate, game context, and entity subclasses
      • insert stuff into the netstate to watch it manifest
    • this method is more fundamental, and therefor "comes first"

  • i want to write cool entities

    • how it works generally
      • all entities are given a shared context object, to access babylon and such
      • entities can participate in a logic loop
      • entities are either in 'host' state or 'client' state
      • host entities can manipulate their own state entries
      • the netstate will automatically synchronize any changes
      • client entities have readonly state, and must send messages to the host entity to request any changes
      • host entities can send messages to themselves, but this isn't a required pattern
      • host entities implement onMessage to handle messages
      • all entities can implement callbacks to react to changing state or other events
    • your entity classes should implement
      • onInsertion() state entry has been inserted (aka onInit)
      • onUpdate() state entry is updated
      • onRemoval() state entry has been removed, entity dies now
      • onMessage(message) receive an entity message (is only called when host)
    • your entity classes should utilize
      • sendMessage(mode: "reliable", message) send a message either "quick" or "reliable"

state theory


class MonarchGame extends LitElement {
  private _overlay: Overlay
  private _viewport: Viewport
  private _netstate: Netstate
  private _simulator: Simulator

  constructor({connection}) {
    const overlay = this._overlay = new Overlay()
    const viewport = this._viewport = new Viewport({overlay})
    const netstate = this._netstate = new Netstate({connection})
    const simulator = this._simulator = new Simulator({netstate})
  }

  async add<T extends Entity>(EntitySubclass: typeof T, data: any): Promise<T> {
    return this._simulator.insert(EntitySubclass, data)
  }

  async remove(id: number): Promise<void> {
    return this._simulator.remove(id)
  }
}