Giter VIP home page Giter VIP logo

gameserver_rust's Introduction

GameServer_Rust

wrote the game server entirely in rust, and the design was inspired by the previous Java version of the server, It contains several important components, as follows:

# 1. gameserver:

is dedicated to handling player data and logic, which already contains all the components required for the basic game suit, as follows (most of the following components are from tools) :

a: TCP server is used to listen for messages sent by gateserver, based on mio(0.7.0) to achieve
B: integrated mysql client, based on mysql(16.1.0)
C :redis client, based on redis(0.13.0)
D: the ThreadPool to be processed, using either async-std(1.5.0) or ThreadPool(1.7.1)
E: asynchronous timer, used to perform some timed tasks, such as 0 point resetting daily, and persist player data to mysql server
asynchronously every 5 minutes F: the HTTP server and HTTP client, based on async-h1(1.0.2) and http-types(1.1.0), are used to handle request events for some other component, such as shutting down the server, or other requirements
G: and the source code with simple logic processing, communication protocol using TCP, based on mio(0.7.0) to achieve
H: data storage adopts json. The framework selects serde and serde_json, which are designed for flexibility and convenience. < br > I: log module, for logging and persistence to disk, divided into error.log and info.log

# 2. gateserver:

is used to communicate with gameserver and roomserver. It is the bridge between gameserver and roomserver. Since it is stateless, does not cache any player data, and only USES it for message forwarding, there is no logical and persistent module for data processing

a: TCP server, used to listen for messages sent by game clients
B: TCP client, divided into gameserver's TCP client and roomserver's TCP client, is used to send messages to the game client
C: log module, used for logging and persistence to disk, divided into error.log and info.log
D :websocket server, used to listen to the messages sent by the game client, d and a can be switched according to the needs, which you want to use is entirely up to you

# 3. roomserver:

is used to handle combat related tasks and can be extended as required. The components are as follows (most of the following components are from tools) :
A: TCP server, which listens for messages sent by gateserver
B: reids client < br >

# 4.tools:

other projects of lib, encapsulate some TCP server, client, the purpose is to encapsulate the underlying components in a simple and easy to use, and then exposed the simple API for other projects to use. Other project TCP, HTTP, log, threadpool,protobuf files, etc., all come from it. Important components

a: TCP, encapsulate TCP module, including client and server, expose API for upper layer to use
B: HTTP, encapsulating the HTTP module, including the client and the server, exposes the API to the upper layer using
C :log, encapsulate the log module, expose the API to the upper layer using
D :protos, generates a good protobuf file that is provided to all projects using
E :threadpool, encapsulates the threadpool module and exposes the API to the upper layer using
F :cmd_code, encapsulated gameserver, roomserver, gateserver need to be responsible for the command segment
G :conf, encapsulate the load json configuration file, expose the API to the upper use, such as mysql connection address, TCP listening address, redis connection address, and so on. < br > H :template, encapsulate the load json configuration file, expose the API for the upper layer to use, such as load NPC configuration, map configuration, level configuration? It depends on you
I :binary, which provides some apis for bit operations, such as two u32s into one u64, and one u64 into two u32
J :util, provides some other, such as packet (message package), bytebuf (parse message package)

5.net_test

Various test codes

gameserver_rust's People

Contributors

reison1218 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gameserver_rust's Issues

是否有存在粘包问题?

在 net_message_io.rs 中使用的是 Transport::Tcp 按照message-io的说明文档中,该方式不是以帧方式读取,可能存在客户端的数据还未完全接收,在 NetEvent::Message(_endpoint, data) 只有 block_on(self.on_message(data)) ,在 async fn on_message(&mut self, mess: Vec) 中的 build_array_from_server 似乎只是分解了包数据,并未考虑未完整的数据包。

Build gamecenter failed.

Rust version: 1.73.0-nightly

Error Message:

error[E0793]: reference to packed field is unaligned
--> C:\Users\hubri.cargo\registry\src\index.crates.io-6f17d22bba15001f\ntap
i-0.3.6\src\ntexapi.rs:2809:25
|
2809 | ((read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad)

加油

大佬一直在关注你的进度项目,加油

游戏服 和战斗服一样 都支持多个就完美了

代码写的太好了 学习了 谢谢
多个网关服连接 游戏服 和 中心服
多个战斗服连接 中心服
中心服 再连接 房间服 排名服

游戏服的数据 无法和战斗服 排名服 进行直接的数据通信了 绕道网关-》中心-》(战斗服 排名服 )

网关有转发数据包 中心服有转发数据包

游戏服 和 中心服 都单个了 感觉都可以合并了

Use cases for server and learning more

Hey! This seems like a very interesting project. I’d like to ask some general questions and learn more about it. My email is in my profile if you wanna get in touch.

I’m mainly curious about how you are using this server yourself. Are you building it for one particular game?

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.