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

citron-server

v0.2.1

Published

Citron is a low level abstraction layer for a scalable multiplayer game server.

Downloads

5

Readme

Build Status

citron

Citron is a low-level game server framework. Citron abstracts the networking layer, and makes creating server-side game logic much easier.

Table of contents

  1. TODO
  2. Directory Structure
  3. Framework
  4. Getting Started
  5. License

TODO

  • [ ] Start on testing scripts.
  • [x] Connection and data transfer management
    • [x] Handle incoming connections
    • [x] fire receive event and pass data object (returned from the function on the next bullet).
    • [x] Modular (strategy?) pattern for using different data interchange methods. (instead of JSON, use some other more compressed interchange language.) See: STRATEGIES
  • [x] Players
    • [x] Create new player in limbo instance on connect.
    • [x] Custom player events
  • [ ] Entities
  • [x] Instances
    • [x] Default instance events, like on.('enter').
    • [ ] Instance options, like 'sendEntityDataOnEnter
    • [ ] Store collection of Entities
    • [x] Decide whether or not Instances should store a collection of Players.
  • [ ] Interactions
    • [ ] Callback system?
  • [ ] Load Balancing & Clustering
  • [ ] SSL
  • [ ] Redis
  • [ ] Get some proper documentation in here.

Directory Structure

  • /lib/modules contains the non-citron logic, like redis.
  • /lib/components contains the main logic for citron.

Framework

  • Citron has 4 main components:
    • Instances
    • Entities
    • Interactions
    • Players
  • Instances isolate players, instances, and entities. Instances define where in the game flow that players and entities can interact with eachother.
    • Examples:
      • Chat Lobbies
      • Game lobbies
      • World zones
      • Battle instances
      • Anything you can think of! We give you the tools to manage these instances, but it's up to the logic of your game to determine the level of isolation or how entities and players interact in them.
  • Entities define any thing that exists in the game which is intended to be universal for an instance. They are non-playable things which may have interactions. Depending on your game these may not be used, however that is unlikely.
    • Example:
      • Assets
      • NPCs
  • Players is a pretty self-explanatory element. It represents active connections and manages events for those connections.
  • Lastly, interactions define behaviors between players and entities. Interactions are an abstract. Their meaning depends on your implementation. In general, interactions will define the AI and logic. If a player, for example, sends an action attack with the parameters target and spell, the interaction defined in the server will process it according to the implementation of the attack interaction. For more information about implementing interactions into your server, see this document. It has examples!

Other information

  • We recommend using Redis with Citron, and provide an easy way to do this!

Getting Started

Follow these steps to get started:

  1. Install Redis. We recommend using Docker to install Redis. Docker isolates Redis and its dependencies on your filesystem as a container.
  • $ docker pull redis
  • $ docker run --name my-redis-server -d redis

If you don't want to use Docker, then use your package manager to install Redis.

  • On Arch Linux: $ pacman -S redis. By default, Redis will not be enabled on systemd. To start redis, type $ systemctl start redis. If you want Redis to start when your computer starts, type $ systemctl enable redis.
  • On Debian based distributions, like Ubuntu: $ apt-get install redis.
  • On RHEL based distributions, like Fedora or CentOS: $ yum install redis.

If you want to use a different system for managing the data in your game, see this document. Currently citron only supports redis, but PostgreSQL, mongodb, and MariaDB (MySQL).

  1. Add citron-server to your dependencies in package.json and run npm install

  2. Start programming. Here is the most basic example of starting a Citron-based server:

This example will start listening on the default citron port, 9981, connect to the redis server on localhost:6379. New connections will be added to the redis user collection, on the default instance limbo.

var citron = require('citron-server');
cintron.start();

Full Game server example

For an example of a full game server, see the Summoner's Game Server

License

The MIT License (MIT)

Copyright (c) 2016 Kevin Minehart

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.