Skip to content

Commit f48d427

Browse files
authored
Merge pull request #26 from manfred-z6/dev
Modified CopyInfo and GameServer
2 parents 44cae40 + d998121 commit f48d427

7 files changed

Lines changed: 412 additions & 376 deletions

File tree

dependency/proto/Message2Clients.proto

Lines changed: 106 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ message MessageOfCharacter
1111
int64 team_id = 2;
1212
int64 player_id = 3;
1313

14-
CharacterType character_type = 4;
14+
protobuf.CharacterType character_type = 4;
1515

1616
// 主动状态
17-
CharacterState character_active_state = 5;
17+
protobuf.CharacterState character_active_state = 5;
1818

1919
// 位置
2020
int32 x = 6;
@@ -36,17 +36,18 @@ message MessageOfCharacter
3636
}
3737

3838

39-
message MessageOfMaterialResource
39+
message MessageOfResource
4040
{
41-
MaterialResourceState material_resource_state = 1;
41+
protobuf.ResourceType resource_type = 1;
42+
protobuf.ResourceState resource_state = 2;
4243

43-
int32 x = 2;
44-
int32 y = 3;
44+
int32 x = 3;
45+
int32 y = 4;
4546

46-
int32 remaining_amount = 4; // 采集进度 等价于血量
47+
int32 remaining_amount = 5; // 采集进度 等价于血量
4748

48-
int32 id = 5;
49-
int32 max_amount = 6;
49+
int32 id = 6;
50+
int32 max_amount = 7;
5051
}
5152

5253
message MessageOfMap
@@ -64,38 +65,57 @@ message MessageOfTeam
6465
{
6566
int64 team_id = 1;
6667
int64 player_id = 2;
67-
int64 score = 3;
68-
int64 energy = 4;
69-
// int64 guid=5;
68+
int32 score = 3;
69+
int32 material = 4;
70+
int32 compute_power = 5;
7071
}
7172

7273
message MessageOfFactory
7374
{
7475
int64 factory_id = 1;
7576
int64 team_id = 2;
77+
7678
int32 x = 3;
7779
int32 y = 4;
80+
7881
int32 hp = 5;
79-
message ProductStack
82+
int32 robust = 6;
83+
84+
int32 storage = 7;
85+
int32 efficiency = 8;
86+
87+
int64 source = 9;
88+
int64 computing_power = 10;
89+
90+
bool can_produce = 11;
91+
bool can_recruit = 12;
92+
93+
message GoodsStack
8094
{
81-
int32 product_type = 1;
95+
protobuf.GoodsType product_type = 1;
8296
int32 quantity = 2;
8397
}
84-
repeated ProductStack product_inventory = 6; //
85-
int32 producing_line_count = 7; // 生产线数量
98+
99+
repeated GoodsStack product_inventory = 13;
100+
86101
}
87102

88103
message MessageOfMarket
89104
{
90105
int64 market_id = 1;
106+
91107
int32 x = 2;
92108
int32 y = 3;
93-
bool high_value = 4; // 是否为高额市场
109+
110+
protobuf.MarketType market_type = 4;
111+
94112
message PriceEntry
95113
{
96-
ProductType product_type = 1;
114+
protobuf.GoodsType goods_type = 1;
97115
int32 price = 2;
116+
int32 traded_quantity = 3;
98117
}
118+
99119
repeated PriceEntry price_list = 5;
100120
}
101121

@@ -108,33 +128,74 @@ message MessageOfComputeCenter
108128
int32 occupy_progress = 5; // 占领进度
109129
}
110130

131+
message MessageOfBarrier
132+
{
133+
int64 barrier_id = 1;
134+
int32 x = 2;
135+
int32 y = 3;
136+
}
137+
138+
message MessageOfBush
139+
{
140+
int64 bush_id = 1;
141+
int32 x = 2;
142+
int32 y = 3;
143+
int32 radius = 4;
144+
}
145+
146+
// 智慧大脑事件
147+
message GlobalAIEvent {
148+
int64 event_id = 1;
149+
int64 trigger_time_ms = 2;
150+
protobuf.AIEventCategory category = 3;
151+
string title = 4;
152+
string description = 5;
153+
}
154+
155+
// 世界修正
156+
message AIWorldEffect {
157+
int64 event_id = 1;
158+
int64 duration_ms = 2;
159+
160+
repeated ProductPriceModifier price_modifiers = 3;
161+
repeated CharacterAttributeModifier character_modifiers = 4;
162+
repeated TaskTimeModifier task_modifiers = 5;
163+
}
164+
165+
message ProductPriceModifier {
166+
protobuf.GoodsType goods_type = 1;
167+
double multiplier = 2;
168+
}
169+
170+
message CharacterAttributeModifier {
171+
protobuf.CharacterType character_type = 1;
172+
double speed_multiplier = 2;
173+
double damage_multiplier = 3;
174+
double hp_multiplier = 4;
175+
}
176+
177+
message TaskTimeModifier {
178+
protobuf.TaskType task_type = 1;
179+
double time_multiplier = 2;
180+
}
181+
111182
message MessageOfObj
112183
{
113184
oneof message_of_obj
114185
{
115-
MessageOfCharacter character_message = 1;
116-
MessageOfMaterialResource material_resource_message= 2;
117-
MessageOfMap map_message = 3;
118-
MessageOfNews news_message = 4;
119-
MessageOfTeam team_message = 5;
120-
MessageOfFactory factory_message = 6;
121-
MessageOfMarket market_message = 7;
122-
MessageOfComputeCenter compute_center_message = 8;
123-
MessageOfAIEvent ai_event_message = 9; //服务器推送的AI事件/建议
186+
MessageOfFactory factory_message = 1;
187+
MessageOfCharacter character_message = 2;
188+
MessageOfResource resource_message= 3;
189+
MessageOfMarket market_message = 4;
190+
MessageOfComputeCenter compute_center_message = 5;
191+
MessageOfMap map_message = 6;
192+
MessageOfNews news_message = 7;
193+
MessageOfTeam team_message = 8;
194+
MessageOfBarrier barrier_message = 9;
195+
MessageOfBush bush_message = 10;
124196
}
125197
}
126198

127-
// 智慧大脑事件
128-
message MessageOfAIEvent
129-
{
130-
int64 team_id = 1;
131-
int64 from_character_id = 2; // 触发来源(可选)
132-
AIEventType event_type = 3; // 事件类型
133-
string description = 4; // 人类可读说明
134-
string plan_json = 5; // 结构化计划(JSON),客户端可以解析执行
135-
int64 timestamp_ms = 6; // 事件触发时间(ms),便于回放
136-
int64 event_id = 7; // 事件id, 便于追踪
137-
}
138199

139200
message MessageOfAll
140201
{
@@ -154,12 +215,16 @@ message MessageOfAll
154215
message MessageToClient
155216
{
156217
repeated MessageOfObj obj_message = 1;
157-
GameState game_state = 2;
218+
protobuf.GameState game_state = 2;
158219
protobuf.GameMode game_mode = 3;
159220
MessageOfAll all_message = 4;
160-
// MessageGameConfig config = 5; // 可用于下发对局参数
221+
222+
GlobalAIEvent ai_event = 5;
223+
AIWorldEffect ai_effect = 6;
224+
161225
}
162226

227+
163228
message MoveRes // 如果打算设计撞墙保留平行速度分量,且需要返回值则可用这个(大概没啥用)
164229
{
165230
int64 actual_speed = 1;
@@ -199,6 +264,7 @@ message MessageOfNews
199264
int64 to_id = 4;
200265
int64 team_id = 5;
201266
}
267+
202268
// message MsgRes // 用于获取队友发来的消息
203269
// {
204270
// bool have_message = 1; // 是否有待接收的消息

dependency/proto/Message2Server.proto

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ message RegisterFactoryMsg
2222
int32 side_flag = 5; // 客户端希望的阵营标识
2323
}
2424

25-
message CreatCharacterMsg
25+
message CreateCharacterMsg
2626
{
2727
CharacterType character_type = 1;
2828
int64 team_id = 2;
@@ -89,13 +89,13 @@ message RecoverMsg
8989

9090
message RepairFactory
9191
{
92-
int32 character_id = 1;
93-
int32 team_id = 2;
92+
int64 character_id = 1;
93+
int64 team_id = 2;
9494
}
9595

96-
message ProduceProductMeg
96+
message ProduceGoodsMeg
9797
{
98-
ProductType product_type = 1;
98+
GoodsType product_type = 1;
9999
int64 team_id = 2;
100100
int32 max_produce_num = 3;
101101
}
@@ -126,30 +126,31 @@ message SellMeg
126126

127127

128128
// 智慧大脑相关
129-
message AskAIRequest
129+
message StrategicAIRequest
130130
{
131131
int64 team_id = 1;
132-
int64 character_id = 2;
133-
string model = 3; // 模型标识
134-
string prompt = 4; // 自然语言提示
135-
int32 timeout_ms = 5; // 超时时间
136-
bool prefer_structured = 6; // 是否优先返回结构化计划
132+
int64 current_game_time = 2;
137133
}
138134

139-
message AIAction
135+
message StrategicAIResponse
140136
{
141-
AIActionType type = 1;
142-
int64 character_id = 2; // 执行者
143-
string target = 3; // 目标说明
144-
string payload_json = 4; // 额外参数(JSON)
145-
int64 eta_ms = 5; // 建议在多少毫秒后执行
137+
bool act_success = 1;
138+
repeated ProductionSuggestion production_plan = 2;
139+
repeated TaskSuggestion task_plan = 3;
140+
string explanation = 4;
146141
}
147142

148-
message AskAIResponse
143+
message ProductionSuggestion
149144
{
150-
bool act_success = 1;
151-
string answer_text = 2; // 自然语言回答
152-
string plan_json = 3; // 结构化计划(JSON),便于引擎解析执行
153-
repeated AIAction actions = 4; // 可直接执行的动作列表(结构化)
154-
string error_msg = 5; //
145+
GoodsType product_type = 1;
146+
int32 quantity = 2;
147+
}
148+
149+
message TaskSuggestion
150+
{
151+
AIActionType action_type = 1;
152+
int64 character_id = 2;
153+
int32 target_x = 3;
154+
int32 target_y = 4;
155+
int64 target_id = 5;
155156
}

0 commit comments

Comments
 (0)