Git Product home page Git Product logo

vertx-game-server's Introduction

Vert.x Game Server

This project is an implementation of the Game server on top of Vert.x.

It provides the HTTP endpoints and websockets for the game part of the demo.

Structure

The projects is composed by 3 verticles:

  • MainVerticle just deploys the 2 other verticles
  • ServerVerticle creates a HTTP server and manage HTTP requests and web sockets, data is computed by the GameVerticle
  • GameVerticle manages the game. It is written in Groovy

This architecture lets us increase the number of instances of the GameVerticle to face the load. The ServerVerticle and GameVerticle are communicating using the event bus. So, potentially, the GameVerticle instances can be located on different computers.

Build and Run

mvn clean package -DskipTests

It generates a fat jar in target: game-service-1.0.0-SNAPSHOT-fat.jar

Launch it with: java -jar target/game-service-1.0.0-SNAPSHOT-fat.jar - cluster

Tests are simulating a couple of loads, so may takes a bit of time to run.

Fast run for dev

mvn compile exec:exec@run

Redeploy for Dev

vertx run src/main/java/com/redhat/middleware/keynote/MainVerticle.java -cluster -cp target/game-service.jar --redeploy=src/main/**/* --launcher-class=io.vertx.core.Launcher --on-redeploy="mvn compile package -DskipTests"

Configuration

You can pass a configuration object using: -conf my-configuration.json.

This configuration can contain:

  • game-verticle-instances : the number of GameVerticle instances, 1 by default, can be 0
  • server-verticle-instances : the number of ServerVerticle instances, 4 by default, can be 0
  • port: the HTTP server port, 9001 by default
  • number-of-teams: the number of teams, 4 by default
  • score-broadcast-interval: the period in ms between 2 score broadcast, 2500 by default

export ACHIEVEMENTS_SERVER=localhost export ACHIEVEMENTS_SERVER_PORT=9090 export SCORE_SERVER=localhost export SCORE_SERVER_PORT=8080 export SCORE_USER=kiewb export SCORE_PASSWORD=kiewb

vertx-game-server's People

Contributors

burrsutter avatar

Watchers

Nicolas De Boose avatar 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.