-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathprotocol.txt
1305 lines (821 loc) · 29.5 KB
/
protocol.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Messages in ascii.
Terminated by # character
NOTE:
Wherever an object_id is menioned (o_id, new_id, etc), it can be either
a single ASCII-base-10 integer, OR a comma-delimited list of integers.
The first one is the base object ID (can be 0 if no object there),
and subsequent IDs are the objects contained in that object
HMAC_SHA1 below is the SHA-1 based HMAC as defined in RFC 2104, with the
resulting hash in hex-encoded ASCII.
The parameters are as follows:
char *HMAC_SHA1( char *inKey, char *inData )
Shutdown mode:
If the server is in shutdown mode (no new connections allowed), upon
receiving a client connection, the server will immediately send the following
message:
SHUTDOWN
current_players/max_players
#
All further messages from the client will be ignored.
Server full
If the server is full, (no new connections allowed), upon
receiving a client connection, the server will immediately send the following
message:
SERVER_FULL
current_players/max_players
#
All further messages from the client will be ignored.
Client login proceedure.
1. Upon receiving a client connection, the server will immediately send
a sequence number to the client in the following format:
SN
current_players/max_players
challenge_string
required_version_number
#
Where challenge_string is an ascii string, less than 150 characters long.
2. The client MUST respond with the following login message:
LOGIN client_tag email password_hash account_key_hash tutorial_number twin_code_hash twin_count#
NOTE: The command LOGIN can be replaced with RLOGIN if the client is
reconnnecting to an existing life and doesn't want to start a new life
if the previous life is over.
client_tag must contain only A-Za-z0-9 plus _ and -
(alphanumeric, underscore, and hyphen).
To be processed correctly, it must start with the string client_
Mods MUST describe themselves honestly and uniquely. Examples:
client_official (reserved for the official client)
client_custom_john
client_hetuw
cleint_awbz
client_wondible
client_milkweed
password_hash is based on the server access password, and is computed by:
HMAC_SHA1( password, challenge_string )
account_key_hash is based on the client's account key, all uppercase with
hyphens removed, and is computed by:
HMAC_SHA1( account_key, challenge_string )
tutorial_number specifies the tutorail map number to load, or 0 for normal game.
twin_code_hash is optional. The sha1 hash of the twin code.
twin_count is mandatory if twin_code_hash is present. How many twins are in
the party, total.
3. The server responds with one of:
ACCEPTED
#
-or-
REJECTED
#
-or-
NO_LIFE_TOKENS
REJECTED
#
After ACCEPTED, normal client-server messaging commences.
After REJECTED, the server will close the connection to the client.
Each message from server is prefaced by a type tag.
Possible types include:
COMPRESSED_MESSAGE (CM)
MAP_CHUNK (MC)
PLAYER_UPDATE (PU)
PLAYER_MOVES_START (PM)
PLAYER_OUT_OF_RANGE (PO)
BABY_WIGGLE (BW)
PLAYER_SAYS (PS)
LOCATION_SAYS (LS)
PLAYER_EMOT (PE)
MAP_CHANGE (MX)
FOOD_CHANGE (FX)
HEAT_CHANGE (HX)
LINEAGE (LN)
NAME (NM)
APOCALYPSE (AP)
APOCALYPSE_DONE (AD)
DYING (DY)
HEALED (HE)
POSSE_JOIN (PJ)
MONUMENT_CALL (MN)
GRAVE (GV)
GRAVE_MOVE (GM)
GRAVE_OLD (GO)
OWNER_LIST (OW)
FOLLOWING (FW)
EXILED (EX)
VALLEY_SPACING (VS)
CURSED (CU)
CURSE_TOKEN_CHANGE (CX)
CURSE_SCORE_CHANGE (CS)
FLIGHT_DEST (FD)
BAD_BIOMES (BB)
VOG_UPDATE (VU)
PHOTO_SIGNATURE (PH)
FORCED_SHUTDOWN (SD)
GLOBAL_MESSAGE (MS)
WAR_REPORT (WR)
LEARNED_TOOL_REPORT (LR)
TOOL_EXPERTS (TE)
TOOL_SLOTS (TS)
HOMELAND (HL)
FLIP (FL)
CRAVING (CR)
FRAME (FM)
GHOST (GH)
PONG
Client can expect to receive these at any time, and in any order.
Each batch of messages from a single server time step will be terminated with
a FRAME message. This ensures that related messages can play at the same time
on the client, regardless of network latency (for example, a player picking
up an object results in a PLAYER_UPDATE and an MAP_CHANGE message, which only
make sense if played together client-side).
----
CONTAINER OBJECT FORMAT:
----
Several message contain object IDs that may optionally be containers containing
other objects.
The presence of these can be detected if the object ID field contains commas.
The format is as follows:
containerObjectID,containedID1,containedID2,containedID3,...
If the contained objects are ALSO themselves containers, their ID fields will
contain a colon-delimited list of sub-contained objects, like so:
containerObjectID,subContainerID1:subContainedID1:subContainedID2,containedID2,containedID3,...
Containment can only go two layers deep. A wagon full of baskets full of
carrots, for example.
(CM)
CM
binary_raw_size binary_compressed_size
#
COMPRESSED_DATA
Any message type, except MC (MAP_CHUNK), can be packaged into a CM message.
Usually, this behavior is reserved for very long messages (like the first PU
sent to a client upon connection).
After decompression, the text message is in the usual format, complete with
terminatin # character.
(MC)
MC
sizeX sizeY x y
binary_raw_size binary_compressed_size
#
COMPRESSED_BINARY_DATA
Where:
Chunk includes a sizeX x sizeY number of ids (a square of the map).
Square is positioned on map grid with upper left corner at x y
binary_size is the number of binary bytes of map data that will follow the #
BINARY_DATA is the raw binary data. This involves zip compression.
Check the code in map.cpp for details.
(PU)
PU
p_id po_id facing action action_target_x action_target_y o_id o_origin_valid o_origin_x o_origin_y o_transition_source_id heat done_moving_seqNum force x y age age_r move_speed clothing_set just_ate last_ate_id responsible_id held_yum held_learned
p_id po_id facing action action_target_x action_target_y o_id o_origin_valid o_origin_x o_origin_y o_transition_source_id heat done_moving_seqNum force x y age age_r move_speed clothing_set just_ate last_ate_id responsible_id held_yum held_learned
p_id po_id facing action action_target_x action_target_y o_id o_origin_valid o_origin_x o_origin_y o_transition_source_id heat done_moving_seqNum force x y age age_r move_speed clothing_set just_ate last_ate_id responsible_id held_yum held_learned
p_id po_id facing action action_target_x action_target_y o_id o_origin_valid o_origin_x o_origin_y o_transition_source_id heat done_moving_seqNum force x y age age_r move_speed clothing_set just_ate last_ate_id responsible_id held_yum held_learned
...
p_id po_id facing action action_target_x action_target_y o_id o_origin_valid o_origin_x o_origin_y o_transition_source_id heat done_moving_seqNum force x y age age_r move_speed clothing_set just_ate last_ate_id responsible_id held_yum held_learned
#
List of player ids with their display object ids, facing direction, action
attempt flag, action attempt target position,
held object ids (in CONTAINER OBJECT FORMAT, see above),
whether held origin is valid (1 or 0), origin position on map of that held
object (where it was picked up from),
transition source object id (or -1) if held object is result of a transition,
player's current heat value,
done_moving_seqNum (to signal destination reached), force flag (to signal
a move truncated unexpectedly), x,y grid positions of player,
floating point age in "years", floating point aging rate in sec/year (how many
seconds it takes the player to age 1 year), and
floating point move speeds (in grid square widths per second) and clothing
set, just_ate = 1 or 0 to indicate whether the player just ate what they were
holding, the ID of the object they just ate, and the player responsible for this update.
If facing is 0, then the player's facing direction doesn't change.
If facing is 1, then they should face right, and -1 to face left.
action flag is 1 if player is attempting an action, 0 otherwise;
Heat is the player's warmth between 0 and 1, where 0 is coldest, 1 is hottest,
and 0.5 is ideal.
If done_moving_seqNum is > 0, this means the player is stationary at this position (and this is the sequence number of their last move).
Otherwise, player may still be in the middle of a move (for example, if what
they are holding decays while they are moving, a PU will be sent with
done_moving_seqNum set to 0).
force is usually 0 except in special cases of move truncation where it is 1.
A player receiving force for itself must snap back to that location
before continuing to move.
Deleted players reported in update with
X X
for x y
and a reason string at the tail end of the line. Reason can be
reason_disconnected
reason_killed_id (where id is the object that killed the player)
reason_hunger
reason_nursing_hunger (starved while nursing a hungry baby)
reason_age
Clothing sets are in the format of
hat;tunic;front_shoe;back_shoe;bottom;backpack
Each clothing piece in the list is in the following format:
clothing_obj_id
or
clothing_obj_id,contained_id,contained_id,...
If clothing ID is 0, player is not wearing anything in that spot.
If the held object contains things, they are in the format described above
in CONTAINER OBJECT FORMAT.
If o_id (held object ID) is negative, it represents the p_id of the other
player (baby) that this player is holding.
responsible_id is used to indicate updates that were caused by another
player (so that client can defer these until responsible player finishes
local walk). Current examples involve feeding and clothing a baby.
-1 if irrelevant.
held_yum is 1 if held item is yummy food, 0 otherwise
held_learned is 1 if the held item is a learned tool (or non-tool), 0 otherwise
NOTE:
If a baby wriggles out of an adult's arms, there is no PU sent about
the adult, only about the baby. The fact that there was a PU about
the baby indicates that they are no longer held by the adult.
This is so PU's can be interpreted as "the player is HERE right now"
and a baby can wriggle out of an adult's arms while the adult is in transit.
(PM)
PM
p_id xs ys total_sec eta_sec trunc xdelt0 ydelt0 ... xdeltN ydeltN
p_id xs ys total_sec eta_sec trunc xdelt0 ydelt0 ... xdeltN ydeltN
...
p_id xs ys total_sec eta_sec trunc xdelt0 ydelt0 ... xdeltN ydeltN
#
List of player ids that just started moving, their start x y grid position,
their delta grid offsets along their path (xs + xdelt0 = first destination x),
how long the total move should take (in case we
come into the game in the middle of a move), and their time to arrival in
floating point seconds
trunc is 0 for untruncated path, or 1 for truncated path.
Truncated paths are shorter than what the player originally requested.
This can happen in immediate response to the move request or later, mid-move,
if the path gets cut off (a new PM will be sent to truncate the path at that
point)
A PLAYER_UPDATE will be sent with done_moving set to 1 when these players
reach their destination.
Until that has happened, client must assume player is still in transit.
(PO)
PO
p_id
p_id
p_id
...
p_id
#
A list of player IDs that are out of range for this player. We avoid sending
a full PU message about these players, but we need to let the client know that
they have moved out of range.
BABY_WIGGLE (BW):
BW
p_id
p_id
...
p_id
#
A list of player IDs that are babies who just started wiggling.
(PS)
PS
p_id/isCurse text
p_id/isCurse text
p_id/isCurse text
...
p_id/isCurse text
#
Alternative:
p_id/isCurse text *display_name player_to_point_id *map map_x map_y
isCurse is 0 if not a successful curse, or 1 if successful.
Text that each player says must not contain # or newline.
Example:
PS
1432/0 HELLO THERE
1501/1 CURSE JOHN SMITH
1448/0 HELP ME
#
The "text" part of PS messages can also contain pointers to map locations or
particular players.
These aren't necessarily part of the protocol, because spoken messages can
contain any text except for newlines. However, these extra bits of data
in a spoken message are a convention shared between the server and the official
client. Also note that some of these special-purpose PS message are only sent
by the server to the client of the speaking player (they are like the player
thinking to themselves), and nearby players don't get these PS messages. Or
in other situations, nearby players only get the spoken part of the message,
with the player/map pointers stripped off.
For straight map locations, the format is:
p_id/isCurse *map x y map_age_seconds
Example:
PS
38499/0 :SPECIAL SPOT *map 13 6 92
#
(Note that the colon in this message has no protocol significance. It is sent
by the server whenever a player is reading out loud from written words.)
For locations of players, the format is:
p_id/isCurse *target_label target_p_id *map x y
Example:
PS
38501/0 OUTSIDER NAMELESS PERSON IS MY NEW FOLLOWER *visitor 38500 *map 3 0
#
Known *target_label values are:
*baby
*leader
*follower
*expert
*owner
*visitor
*prop
(LS)
LS
x y text
x y text
x y text
...
x y text
#
Text at each location says must not contain # or newline.
Example:
LS
0 25 HELLO THERE
14034 3424 CURSE JOHN SMITH
-342 3847 HELP ME
#
(BB)
BB
bID DISPLAY_NAME
bID DISPLAY_NAME
...
bID DISPLAY_NAME
#
Lists bad biome IDs for a player, along with their display names IN_THIS_FORMAT
(VU)
VU
x y
#
Example:
VU
301 14
#
(PE)
PE
p_id emot_index ttl_sec
p_id emot_index
p_id emot_index ttl_sec
...
p_id emot_index ttl_sec
#
Example:
PE
1432 4
1501 6 30
1448 1
1449 17 -1
#
ttl_sec is optional, and specifies how long the emote should be shown, in
seconds, client-side. If it is omitted, the client should display the emotion
for the standard amount of time. If ttl is -1, this emot is permanent and
should layer with other permanent and non-permanent emots.
If ttl is -2, the emot is permanent but not new, so sound shoudl be skipped.
(MX)
MX
x y new_floor_id new_id p_id
x y new_floor_id new_id p_id
x y new_floor_id new_id p_id
...
x y new_floor_id new_id p_id
#
Or optionally, some lines can have 3 extra parameters, like this:
MX
x y new_floor_id new_id p_id old_x old_y speed
x y new_floor_id new_id p_id
x y new_floor_id new_id p_id old_x old_y speed
...
x y new_floor_id new_id p_id
#
Grid position of changes, and new floor id and object id that position must
change to.
p_id is the player that was responsible for the change (in the case of an
object drop only), or -1 if change was not player triggered. p_id < -1 means
that the change was triggered by player -(p_id), but that the object
wasn't dropped (transform triggered by a player action).
Note that if cell contains other stuff (for a container object), new_id
is in the CONTAINER OBJECT FORMAT described above.
Optionally, a line can contain old_x, old_y, and speed.
This indicates that the object came from the old coordinates and is moving
with a given speed.
(FX)
FX
food_store food_capacity last_ate_id last_ate_fill_max move_speed responsible_id
yum_bonus yum_multiplier#
food_store is integer amount of food left in body, capacity is the integer
maximum amount of food.
last_ate_id is the object id of the last piece of food eaten, or 0 if nothing
was eaten recently
last_ate_fill_max is an integer number indicating how many slots were full
before what was just eaten. Amount that what was eaten filled us up is
(food_store - last_ate_fill_max).
move_speed is floating point speed in grid square widths per second.
responsible_id is id of player that fed you if you're a baby, or -1
yum_bonus is an integer indicating the current stored bonus food.
yum_multiplier is an integer indicating how many yum bonus points are earned
when the next yummy food is eaten.
(HX)
HX
heat food_time indoor_bonus#
Tells player about their current heat value, food drain time, and indoor bonus.
Food drain time and indoor bonus are in seconds.
Food drain time is total including bonus.
(LN)
LN
p_id mother_id grandmother_id great_grandmother_id ... eve_id eve=eve_id
p_id mother_id grandmother_id great_grandmother_id ... eve_id eve=eve_id
p_id mother_id grandmother_id great_grandmother_id ... eve_id eve=eve_id
...
p_id mother_id grandmother_id great_grandmother_id ... eve_id eve=eve_id
#
Describes lineage of player p_id.
Each line has a variable number of fields, depending on how long the lineage
back to Eve is.
Also, if lineages get very long (like hundreds of links), the server may
cut them off beyond some point.
For long lineages, they may not go all the way back to eve_id. To cover
these cases, the actual eve_id, even if the provided lineage doesn't reach it,
is included at the end with the eve= tag in front of it.
This message describes known lineages.
(NM)
NM
p_id first_name last_name
p_id first_name last_name
p_id first_name last_name
...
p_id first_name last_name
#
Gives name of player p_id.
last_name may be ommitted.
(AP)
AP
#
Indicates that an apocalypse is pending. Gives client
time to show a visual effect.
(AD)
AD
#
Indicates that an apocalypse is now over. Client should go back to displaying
world.
(DY)
DY
p_id isSick
p_id
p_id isSick
...
p_id
#
Indicates that the listed players have been mortally wounded and will die soon.
isSick is optional 1 flag to indicate that player is sick
(client shouldn't show blood UI overlay for sick players)
(HE)
HE
p_id
p_id
p_id
...
p_id
#
Indicates that the listed players have been healed and are no longer dying.
(PJ)
PJ
p_id_killer p_id_target
#
Indicates that killer joined posse of target.
If target = 0, killer has left the posse.
(MN)
MN
x y o_id
#
Indicates that a monument call has happened at location x,y with the creation
of object o_id.
(GV)
GV
x y p_id
#
Grave at x y belongs to player p_id.
(GM)
GM
xs ys xd yd swap_dest
#
Grave at xs,ys moved to xd,yd.
If optional swap_dest parameter is 1, it means that some other grave at
destination is in mid-air. If 0, not
(GO)
GO
x y p_id po_id death_age underscored_name mother_id grandmother_id great_grandmother_id ... eve_id eve=eve_id
#
Provides info about an old grave that wasn't created during your lifetime.
In response to a GRAVE message from client.
underscored_name is name with spaces replaced by _
If player has no name, this will be ~ character instead.
death_age is how long the player has been dead (in in-game years)
Same semantics for eve= tag at end as for LN message.
(OW)
OW
x y p_id p_id p_id ... p_id
#
Provides owner list for position x y
(FW)
FW
follower_id leader_id leader_color_index
follower_id leader_id leader_color_index
...
follower_id leader_id leader_color_index
#
Provides list of people following other people.
If leader is -1, that person follows no one
Leader color index specifies leader's badge color from a fixed color list
(EX)
EX
exile_target_id exiler_id
exile_target_id exiler_id
exile_target_id exiler_id
...
exile_target_id exiler_id
#
Provides list of people exiled by another person.
If someone's exile list has changed (who's exiling them), then their whole
exile list is sent.
Each target's list is prefaced by this line:
exile_target_id -1
This indicates that the target's complete list is coming, and the client-side
list should be cleared in preparation for this.
If a target is newly exiled by no one, they show up as:
exile_target_id -1
(VS)
VS
y_spacing y_offset
#
Provides information about horizontal valley spacing to client.
Offset is from client's birth position (0,0) of first valley.
(CU)
CU
p_id level word
p_id level
...
p_id level word
#
List of player ids that are cursed, and their curse level
word is optional, which is a persistent name tag for this person.
(CX)
CX
curse_token_count#
Tells player about how many curse tokens they have
(CS)
CS
excess_curse_points#
Tells player about their curse score, if it is above the threshold.
(FD)
FD
p_id dest_x dest_y
#
Sent to all players to let them know about new flights.
Flying player should wait for a MAP_CHUNK message around the destination.
(PH)
PH
x y signature
#
Gives the player a requested photo signature for their last PHOTO request.
Will return a dummy signature if the photo is denied.
(SD)
SD
#
Indicates that the server is undergoing a forced shutdown. Gives client a
chance to hear about this and close connection before connection is
force-closed by server.
GLOBAL_MESSAGE: (MS)
MS
some_message_text_with_space_replaced_by_underscore
#
Server sending a global message to be displayed by all non-tutorial clients.
(WR)
WR
eve_id_a eve_id_b status
eve_id_c eve_id_d status
...
eve_id_e eve_id_f status
#
Full report of families that are at war or peace. Unlisted families are
neutral.
status is either:
war
peace
(LR)
LR
tool_id tool_id ... tool_id
#
Report about new tool objects that have just been learned
Each tool_id is an object id.
(TE)
TE
p_id p_id ... p_id