Giter VIP home page Giter VIP logo

rcat's Introduction

A web server for massively multi-user online applications.

Requirements

Requirements in Ubuntu

To install all required packages in ubuntu, do: sudo apt-get install python python-sqlalchemy python-pip sudo pip install tornado sudo pip install websocket-client

Please note that the Ubuntu package python-tornado is not up-to-date and will cause errors in running rcat.

Jigsaw setup

After installing all the required libraries, follow these 3 steps to start the server

  1. cd into bin directory
  2. Copy rcat.cfg.example and jigsaw.cfg.example to rcat.cfg and jigsaw.cfg respectively. Configure both files with host name and mysql credentials (default: localhost)
  3. run ./runproxy.sh
  4. run ./runjigsaw.sh
  5. By default, the client in static/jigsaw.html connects to localhost. If deploying externally, modify the server URL in jigsaw.html accordingly.

bots:

  1. cd /dbg
  2. ./runbot.sh ip port numbots

Now point your browser at :8888/static/jigsaw.html, change the host name and click Connect!

Database checks

  • mysql -u jigsawuser -p
  • then enter password
  • use jigsawdb
  • select * from jigsawpieces

rcat's People

Contributors

arthur00 avatar bravelittlescientist avatar diva avatar gentimouton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rcat's Issues

Personal workbench space

Each user should have a personal workspace where they can (UNDER DISCUSSION) lock pieces for themselves, and work on creating and blogs.
Discussion: Should that workbench be a shared space or individual?

Remote update

Verify if updating objects remotely works as expected. Still untested (so probably no)

Game over/init on server-side

Includes:

  • message type for game over
  • message type for game init
  • or a single message type "game over; here's the new config"?

Refactor the Data Connector

The data connector is monolithic in the file mysqlconn.py. It assumes multiple roles, which we broke down into:

  1. Mapper: Provides mapping between an input value to objects. Commonly an ID is used, but in space partitioning a range is used instead
  2. OBM: Provides communication between data nodes and organizes object ownership, marking on the database when it owns or lets go of objects.
  3. DB: Provides functionality to write to the database.

To achieve this purpose, I propose to add new packages in the data module:
db: resides database connectors. mysql is the only database as of now
mappers: provides classes that implements mappings of the any sort. Currently, we have space partitioning and the chat manager style
plugins: Additional modules that increment functionality. Pubsub for IDs is a plugin, so is the OBM

Additionally, I propose the creation of the abstract class DataConnector and Mapper. Mapper sets necessary methods for any mapper, data connector just gathers all the components in one container (not sure if I need it for anything though).
The app logic should instantiate the pieces and build the Data Connector as it desires.

PS: Will add image later

[Gameplay]: Versus mode

Allow players to play against each other. Possible design might include something similar to Quadra: upon placing a a certain blob on the board, the other player placed pieces get taken off the board, or remain in the same place but mixed. Other ideas are welcome on the comments

Blobs

Allow players to put pieces together outside of the board and form bigger pieces.

Create an event manager

Many of the plugins are interested in insert, select and other data events that are sent by the client. An event manager would correctly distribute events to interested plugins so they can perform their part

Benchmark tools

Includes bot?

List micro-benchmarks

  • greenlet vs stackless vs normal python
  • client: single-threaded a la Tornado vs multi-thread like the current java one

Async game loading

While the image is downloading, perform all the work necessary to start up the game.

Locking pieces

When a client clicks on a piece, it should send a lock request to the server that should remain locked until it is dropped

Data structure on server

Initial data structure used will be a bucketing matrix with lists of pieces and subscribed players, based on their frustum. Should take into account the object manager and that some pieces might not be locally available.

[bug] Piece-binding drop without moving is not forwarded

Scenario:

  1. drag and drop a piece so that it intersects its correct cell, but does not magnet (ie the mouse should remain outside of the cell)
  2. click on the portion of the piece that also collides with its correct cell: the piece binds/magnets locally, but not across all clients

I don't know if a drop+bind message is sent at all from the client, so the issue may be client or server side. (seems to be client, though)

MySQL times out after 8 hours

Fix it by 1) keeping it alive every x hours by running a simple operation on every cursor, or 2) increase the timeout value to infinite. Going with 1 for now..

Client bot

I think the main bottleneck when running 20 bots on a single machine is when receiving messages. In the java code, the 20 socket threads (1 per bot) most likely blocked each other all the time, whether user or kernel threads. See http://en.wikipedia.org/wiki/Thread_%28computer_science%29#I.2FO_and_scheduling

Hence, sockets should be non-blocking. That means using epoll on their file descriptors. This is low-level stuff, so there may be a python lib or project for that. Maybe from tornado?

Constrain zoom

Similar do dragging, only allow zooming to the size of the board

Optimistic client

Client should perform all actions optimistically and perform roll back when conflicts happen at the server.

Test different canvas size

The client and server codes so far should nearly support clients with different canvas sizes. So far, it's only been tried with 800x600.

[Gameplay]: Challenging modes

Create events that disrupt gameplay and make the game more dynamic. Examples include "exploding" pieces in certain areas (due to a meteor or some other twisted plot design), blacking out pieces and slowly fading them back as user approaches the correct position, etc.
More ideas, insert in comments

Low-overhead cpu and bandwidth measurement

Python may have a library to measure the upstream and downstream from/to an ip addr on each of the network interfaces of a machine.

I think this measurement tool should be standalone and remain an outside observer of the machine as a whole, and not only of the clients/proxy/server/db processes.

Refactoring RCAT and MySQL Connector

Two refactorings are required:

  1. RCAT's functionality is too mixed up in the developers application. Creating an rcat.py that will do all the tornado initialization, ip/port reading, etc etc.

  2. MySQL Connector is intruding in OBM territory. OBM should be repsonsible for determining who owns the object and contacting the owner for changes and updates. MySQL Connector is responsible to find objects in database and retrieve, insert or update them. Keeping the same API, just removing "location" checks. Also removing location field from tables.
    Also, all reference to other servers will be centralized around adm ids. The OBM will have its own table where adm id gets converted to a host:ip, so that proxies don't have to be involved in this fast type of communication. But talking only in one language(adm ids) makes thing simpleer

Logging performance

log.debug and others are good to know what's going on in the proxy and server (and other components). But we also need to log over time how much they consume in terms of:

  • CPU
  • RAM
  • upstream (by port, so that we can distinguish between proxy->server and proxy->client)
  • downstream (by port too)

Bonus:

  • how many packets TCP resends (does that account for collisions?)
  • ...?

This logging may need to be done in another file (ie another logger). Checking every second may be alright (checking more often won't add any benefit).

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.