{"id":19083092,"url":"https://github.com/cr-mao/loric","last_synced_at":"2025-04-18T11:32:16.634Z","repository":{"id":189858564,"uuid":"679605510","full_name":"cr-mao/loric","owner":"cr-mao","description":"a game framework based on golang","archived":false,"fork":false,"pushed_at":"2024-01-08T07:36:29.000Z","size":411,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-03-26T03:44:52.968Z","etag":null,"topics":["game-framework","game-server","go-framework","go-game-server","grpc-client-pool","grpc-server","tcp-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cr-mao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-08-17T08:01:32.000Z","updated_at":"2024-03-26T01:59:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"6cf7158f-3e4d-4f09-a7ad-b07d96aa7028","html_url":"https://github.com/cr-mao/loric","commit_stats":null,"previous_names":["cr-mao/loric"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr-mao%2Floric","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr-mao%2Floric/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr-mao%2Floric/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr-mao%2Floric/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cr-mao","download_url":"https://codeload.github.com/cr-mao/loric/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223780082,"owners_count":17201287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game-framework","game-server","go-framework","go-game-server","grpc-client-pool","grpc-server","tcp-server"],"created_at":"2024-11-09T02:46:00.755Z","updated_at":"2024-11-09T02:46:01.560Z","avatar_url":"https://github.com/cr-mao.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# loric\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Go Reference](https://pkg.go.dev/badge/github.com/cr-mao/loric.svg)](https://pkg.go.dev/github.com/cr-mao/loric)\n\n\n### 1.介绍\n\nloric 是一款基于golang的分布式游戏服务器框架 \n\n![](doc/gamestruct.png)\n\n\n### 2.功能\n\n- 网关：tcp协议的网关服务器\n- 节点通信：grpc 带有连接池，断线自动重连, 和[grpc-conn-pool](https://github.com/cr-mao/grpc-conn-pool)这个实现一致\n- 日志：基于zap\n- 服务发现注册：支持etcd, 提供配套的etcd管理client\n- 协议：支持protobuf、json\n- 配置: 基于viper\n- 游戏常用技术(见gkit):异步操作 、定时任务及守护任务 、延迟保存、时间轮\n- 集成服务权重，通过设置权重，达到流量控制，另一层面实现热更新效果。\n- gm管理系统\n\n\n\n\n### 3.安装项目和依赖工具\n```shell\ngo get github.com/cr-mao/loric@v0.0.0\n# protobuf 编译\ngo install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28\n# grpc通信\ngo install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2\n\n# https://github.com/protocolbuffers/protobuf/releases/tag/v23.4\n```\n\n### 4.tcp协议\n\n```text\n-------------------------------\n| len | seq | route | message |\n-------------------------------\n```\n说明：\n\n1. 使用tcp协议时，为了解决粘包问题，还应在包前面加上包长度len，固定为4字节，使用大端序编码\n2. seq表示请求序列号     4字节，常用于请求、响应对的确认。\n3. route表示消息路由    2字节，不同的路由对应不同的业务处理流程。\n4. message表示消息体，采用json或protobuf编码。\n5. **心跳包** 包长度len，固定为4字节， 包长度固定为0。\n\n\n\n\n### 框架相关文档\n\n[框架相关文档](doc/README.md)\n\n\n### 参考\n\n- [due](https://github.com/dobyte/due)\n- [zinx](https://github.com/aceld/zinx)\n- [kratos](https://github.com/go-kratos/kratos)\n- [goim](https://github.com/Terry-Mao/goim)\n- [iam极客时间go语言项目实战](https://github.com/marmotedu/iam)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcr-mao%2Floric","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcr-mao%2Floric","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcr-mao%2Floric/lists"}