GithubHelp home page GithubHelp logo

kaldararalay / casino-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from floatinghotpot/casino-server

0.0 1.0 0.0 728 KB

:fire: An online poker game server powered by Redis, node.js and socket.io

License: MIT License

JavaScript 97.42% Lua 0.15% HTML 0.97% CSS 1.45%

casino-server's Introduction

casino-server

npm version

Build Status

NPM

An online poker game server powered by redis, node.js and socket.io

A A A

Game rules supported:

  • Chat Room (聊天室)
  • Jinhua (诈金花/三张牌)
  • Texas Holdem (德州扑克)
  • Fight Landlord (斗地主)
  • Blackjack (21点)

Features:

  • Cross-platform: powered by node.js, easy to deploy on various platforms.
  • Scalable: using Redis as message bus and data storage.
  • Open architecture: with Redis as the message bus, easy to interact and extend.
  • Cluster: using PM2, sticky session, and socket.io-redis.
  • WebSocket protocol: come with javascript client API and web-based demo.
  • Event logger for server events and user actions.

TODO List:

  • Client API for Unity3D (C#, support mono/.NET2.0)
  • Payment gateway callback URL.
  • Admin Portal.
  • Load balancing: using NginX, or auto handled if deployed to Amazon Cloud.

Architecture

Architecture

Required

  • Redis

Redis is an open source, BSD licensed, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.

Download

  • node.js / npm

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Download

  • PM2 (production & cluster)

PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.

Read More

Installation

  • Installing globally and run as service with PM2:
[sudo] npm install pm2 -g
[sudo] npm install casino-server -g

# run redis-server first
redis-server &

# run as service and cluster mode
pm2 start `which casino-server` -i 0
  • Installing as a node app, and run in current folder:
git clone https://github.com/floatinghotpot/casino-server.git casino
cd casino
npm install
# sudo npm install -g gulp
# gulp build
node bin/casino-server [options]

Now you can visit http://localhost:7000, it's a web-based game client for testing and demo purpose.

# open a browser to access the test web page
open http://localhost:7000/

Available Options:

-p Port to use (defaults to 7000)

-h Host address to use (defaults to 0.0.0.0)

-r Address of Redis server (defaults to 127.0.0.1:6379)

Tools

With Redis as the message bus, it's very easy for tools to work with the open architecture.

Event Logger

Start the event logger to monitor the events:

bin/logger.js

Or, log the events into log file:

bin/logger.js -o ./tmp/casino.log

See Also

  • socket.io for Unity3D, is a socket.io client library for Unity3D. You can develop casino games with Unity3D, and using this library to connect to this casino server.

Credits

This poker game server is created by Raymond Xie, published under MIT license.

It can be used for FREE, but be aware that:

  • It is provided as it is. (Not a mature commercial product, may be incomplete, or even lots of bugs)
  • We will mainly focus on our own needs.
  • You can propose wish for new features, but don't rely on us to implement them. Instead of waiting for new features, welcome join us to implement them.
  • You need take your own risk, including that you need find answers from reading code instead of easily asking only. :P

If you are interested in this project, you can contribute in any of following aspects:

  • Simply "Star" it.
  • Use it or test it, report bugs or even send pull request of patches.
  • Add better HTML5 demo client.
  • Add new poker game rules.
  • Add client APIs in other languages (like C# for Unity, Java, Objective-C, C/C++, etc.)
  • Help us write documentation, if your English is good.

casino-server's People

Contributors

floatinghotpot avatar xphoniex avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.