项目作者: cityblack

项目描述 :
Use netty with springboot to program game server
高级语言: Java
项目地址: git://github.com/cityblack/netty-game-server.git
创建时间: 2018-09-28T13:24:15Z
项目社区:https://github.com/cityblack/netty-game-server

开源协议:

下载


Netty Game Server

Introduction

Use netty with spring-boot to program game server.
The project structure like as spring-mvc. has a Dispatch class to distribute request to target class method

At present. The framework integrate redis. mongodb. protocolBuffer. eventBus. and implement some useful tools.

Getting Started

  1. mvn clean package
  2. java -jar game-start/target/*.jar

Prerequisites

  1. JDK 17+
  2. Installing mongodb
  3. Using the python execute the script static-resource/run.py. Add some data to mongodb
  4. Executing game-start module App
  1. python static-resource/run.py -h mongodb_host -p mongodb_port

Usage

  1. @Action
  2. public class HelloAction {
  3. @RequestMapping
  4. public ResponseHello hello(Session session, RequestHello hello) {
  5. System.out.println("Get session: " + session.getId() + " info:" + hello);
  6. return new ResponseHello("I am server.", 10001);
  7. }
  8. }
  9. @Protcol(10086)
  10. public class RequestHello {
  11. private String content;
  12. }
  13. @Protcol(10087)
  14. public class ResponseHello {
  15. private String content;
  16. private int version;
  17. }