Giter Club home page Giter Club logo

game-robot's Introduction

game-robot

Simple and Easy-to-Use robot client for game server.

Features

  1. Provide high level synchronous api based on gevent

  2. Multiple protos support. sproto and protobuf so far.

  3. Two modes support. client mode for interaction on command line, simulator mode for async running which is often used in pressure test.

  4. Simple and Easy-to-use api. Mostly only one line needed to add a command or request handler.

  5. Simple but powerful command client, which support passing in types of string, int, list and dict. Auto-Completions builtin.

  6. Stream encrypt support built in.

Setup && Launch

Run

git submodule update --init --recursive

after first clone.

Run

make

to build.

You need a config file to launch. see test/config.py for detail.

Game logic

Please put your logic functions into game.py.

use @addcmd(ARGS, COMMAND_NAME) decorator to add client command.

use @addhandle(protoname) decorator to add handle function for game server's request.

Test

test cmdclient

To launch test server:

python -m test/server  sproto

To launch client:

python main.py test/config.py

Now you've got a client to play with:

$ python2 main.py test/config.py
connect to ('127.0.0.1', 8251)
> help
help ['cmdname']
notify_addone ['i']
addone ['i']
echo ['msg']
login ['user']
addlist ['l']
> login "foobar"
hello, foobar
[foobar] > addlist [1,3,5,7]
answer: 16
[foobar] > echo "hello"
{'msg': 'hello'}

test simulator

To launch test server:

python -m test/server  sproto

Uncomment following block in test/config.py:

mode = "simulator"                 # client / simulator
run = [
    {
        "cmd" : "echo",
        "args" : ["hello world!"],
        "count" : 5,            # how many clients to launch to run this command
    },
    {
        "cmd": "addlist",
        "args" : [ [1,2,3,4,5] ],
        "count" : 3,
    }
]

Run client to run:

python main.py test/config.py

game-robot's People

Contributors

hqwrong avatar

Watchers

 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.