0.2.1 • Published 8 years ago

citron-server v0.2.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

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.
  • Connection and data transfer management
    • Handle incoming connections
    • fire receive event and pass data object (returned from the function on the next bullet).
    • Modular (strategy?) pattern for using different data interchange methods. (instead of JSON, use some other more compressed interchange language.) See: STRATEGIES
  • Players
    • Create new player in limbo instance on connect.
    • Custom player events
  • Entities
  • Instances
    • Default instance events, like on.('enter').
    • Instance options, like 'sendEntityDataOnEnter
    • Store collection of Entities
    • 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.

0.2.1

8 years ago

0.2.0

8 years ago

0.1.19

8 years ago

0.1.18

8 years ago

0.1.17

8 years ago

0.1.16

8 years ago

0.1.15

8 years ago

0.1.14

8 years ago

0.1.13

8 years ago

0.1.12

8 years ago

0.1.11

8 years ago

0.1.10

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.1

8 years ago

0.0.1

8 years ago