Coder Social home page Coder Social logo

flappybird-with-server's Introduction

flappyBird-with-server

A Flappy Bird game developed under cocos-2d with client-server model to exchange data between client and server. This project mainly targets to Mobile and Network Programming Practice course from SYSU.

Introduction

This project contains a copy of Flappy Bird game and we made contributions to enhance the simple game with client-server model. We developed a simple server and modify Flappy Bird game to a client.

Main features:

  • Three levels of difficulty available.
  • User and account system.
  • Score record upload/download to/from server.
  • Leaderboard of users.
  • Notification from server.
  • Simple Encryption for user information.
  • A command-line tool for server management.

There are three levels of difficulty available, pipes are generated randomly according to difficulty and it's guaranteed that the bird can pass pipes randomly generated.

Interactions between server and logined clients are based on tokens to improve the security of sessions. User password is encrypted using MD5 and our server stores only MD5 encrypted password.

According to the requirements from our course, we made the following compromise:

  • File-based database.
  • Simple server based on python built-in socket library. (No additional third-party library is allowed.)
  • Python2. (Encoding issues may occur when using languages besides English.)

Since we mainly contribute to meet the requirements from our course, functional implementation is considered preferentially and Optimization for server is not paid principally attention. These issues may or may not be solved in future works according to the author.

User Guide

requirements

  • Python2 >= 2.7.14:

    Run python --version in command-line to check if your python version satifies the requirement. If not, visit Python Offical Site to see python installation guide.

  • Cocos-2d 0.6.5:

    This dependency is only required for the client side. Run pip install cocos2d --user to install cocos-2d to current user.

Client Usage

Enter FlappyBirdClient directory first. You can click start_client.bat to start client on Windows operating system.

Generally, on all systems that are supported by Python2 and Cocos-2d, use the following command to start the client:

python FlappyBird.py [-h] [--host HOST] [--port PORT]

Specify the host and port of server to connect by arguments --host HOST --port PORT. If not specified, the defalut port to connect is 127.0.0.1:9234 as well as the default arguments for server.

A GUI environment is required to start the graphical Flappy Bird client.

Server usage

Enter FlappyBirdServer directory first. And you can start server on Windows by clicking start_server.bat.

It's recommanded to use command-line to start the server with the following command:

python server.py [-h] [--host HOST] [--port PORT] [--timeout TIMEOUT]
              [--saving_gap SAVING_GAP]

TIMEOUT argument is used for determine whether a connection is lost. The server will automaticly disconnect from connections that haven't send request after TIMEOUT seconds since last request. To avoid data loss, our server writes server data to disk every SAVING_GAP seconds. The default values of TIMEOUT and SAVING_GAP are 60 and 300.

After start our server using command-line or click start_server.bat, a command-line server manangement tool will start. There are commands you can use to manage the server and modify user accounts. All commands are shown when you enter the command-line environment as below:

***Enter command line environment for server manager.***
==============================================================
List of supported command:
cllog:  Clear log.
help:   Print all command and get help.
log:    Show server log.
ls:     Show details of all current connections.
lsblk:  Show details of users in black list.
muser:  Modify user. Change user profile, remove user, add/remove user to/from black list.
notice: Change server notice.
nuser:  Create new users.
server: Change or show server status(start, stop, restart).
user:   Search user under conditions(substring of name, range of best score, longest survive time, greatest number of passed pipes).
==============================================================
Enter "help <command>" to show detail of command usage.

Follow these instructions and enjoy our Flappy Bird with Server.

flappybird-with-server's People

Contributors

orankarl avatar sgly avatar shawnlixx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sgly

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.