Skip to content
This repository was archived by the owner on Aug 25, 2026. It is now read-only.

Latest commit

 

History

105 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ ARCHIVED — 已归档

本仓库已只读归档。GServer 工程客户端(hy/bench/pkg/client)已迁移到 monorepo:

https://github.com/zylikedream/gserver/tree/master/client

开发与维护全部迁移到 monorepo;本仓库不再接受任何提交/PR/Issue。


hy_client

Console debugging client and benchmark tool for gserver.

Architecture

Directory Purpose
cmd/hy/ Interactive REPL client for manual debugging
cmd/bench/ Configurable benchmark bot framework
pkg/client/ Core SDK — codec, connection, message registry
pb/ Generated protobuf Go code
proto/client/ Proto source files (gserver protocol submodule)

Build & Run

git submodule update --init   # clone proto/client submodule
make proto                    # regenerate protobuf (if protos changed)
make build                    # build both binaries
make test                     # run all tests

hy — Interactive REPL

./bin/hy                                # connect with defaults
./bin/hy --addr=127.0.0.1:9000 --account=account001

All Req* protocols auto-register as CLI commands at startup. Commands follow a domain.action naming convention (e.g. bag.info, friend.search_player, mail.list). Type help to see all available commands.

bench — Benchmark Bot

./bin/bench -config cmd/bench/bench.yaml

Bench runs configurable bot types against the game server. Bot behaviors are defined entirely in YAML — no Go code changes needed to add or modify bot scripts.

Configuration

addr: "127.0.0.1:11086"
account_pattern: "loadtest_%d"
total_bots: 1000
startup_rate: 50           # bots/sec, 0 = instant
report_interval: 5s

bot_types:
  - id: newbie
    weight: 40              # weight determines bot type ratio
    script:
      - login: {}
      - ensure_breed: {flower_id: 101}
      - loop:
          count: 0
          script:
            - plant_cycle: {plot_max: 3}
            - wait_range: {min: 3, max: 8}

chat_mixin:
  chance: 0.1
  channel: 1                # 1 = world, 4 = guild
  messages: ["大家好", "hello ~"]

Available Actions

Action Description
login Connect, handshake, login, pull initial state
breed Start breeding a flower
wait_for_breed Sleep for breed duration + jitter
finish_breed Complete breeding
ensure_breed Skip if already bred, otherwise breed + wait + finish
plant Plant flower in specified plots
water Water specified plots
wait_for_harvest Sleep for growth duration + jitter
harvest Harvest specified plots
plant_cycle Harvest → plant → water in sequence
claim_task Claim main task reward
check_orders Check resident order status
submit_orders Submit affordable resident orders
wait_range Sleep for random duration between min and max
gm Execute GM command
loop Repeat sub-script (count=0 = infinite)

Protocol

Transport format (LTIV):

[Size:2B LE][Type:1B][ID:2B LE][Payload:protobuf]

Messages are identified by numeric msg_id defined in proto options. All Req*, Rsp*, and Notify* messages with option (msg_id) are auto-registered at startup.

About

client for gserver

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages