mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 13:35:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
116d8681e2 | ||
|
|
09237eb9b1 | ||
|
|
b15a9f0878 | ||
|
|
a478906805 | ||
|
|
9619cb8076 | ||
|
|
588bcbd81f | ||
|
|
16cacb9ee8 | ||
|
|
150970fcae | ||
|
|
de6ccb4345 | ||
|
|
ab64052fa7 | ||
|
|
38129c2a8e | ||
|
|
2fd16d962c | ||
|
|
4dcb4bacdb | ||
|
|
e1dd455af3 | ||
|
|
1cd7474864 | ||
|
|
c1c60c406a | ||
|
|
b20c8e55db | ||
|
|
ca485e2c05 | ||
|
|
1f44105ac4 | ||
|
|
b200d6d631 | ||
|
|
5ca66b9090 | ||
|
|
a714271ef2 | ||
|
|
21a311e9eb | ||
|
|
4b7a26b12b | ||
|
|
fb35514410 | ||
|
|
88e9c46fce | ||
|
|
5a8c791e4c | ||
|
|
f80718719c | ||
|
|
8f1371dd61 | ||
|
|
91244dd06d | ||
|
|
5c8811441c | ||
|
|
090d440501 | ||
|
|
e123c0fade | ||
|
|
da89636165 | ||
|
|
3eb2607a7a | ||
|
|
51be13b8b1 | ||
|
|
90d1cf702f | ||
|
|
6a0162109b | ||
|
|
25e1fd4f90 | ||
|
|
8e30daa63b | ||
|
|
311cf6e262 | ||
|
|
43ee2bfd1f | ||
|
|
c358567a3f | ||
|
|
b142acbf3f | ||
|
|
5875062bd3 | ||
|
|
20cf458c61 | ||
|
|
72c392a2dc | ||
|
|
bc17291691 | ||
|
|
c2438e093f | ||
|
|
93b639e452 | ||
|
|
0adf8b3765 | ||
|
|
931ae4b926 | ||
|
|
59d000f792 | ||
|
|
a5348a54ee | ||
|
|
bb777da84a | ||
|
|
06c76daba2 | ||
|
|
ecd0d3605b | ||
|
|
d1160855d4 | ||
|
|
700f090331 | ||
|
|
390bdcb77f | ||
|
|
138b00fdc4 | ||
|
|
d169a38761 | ||
|
|
3c9e01f4b8 | ||
|
|
610f32ae5c | ||
|
|
e84d608638 | ||
|
|
349e38cad8 | ||
|
|
90796d8932 | ||
|
|
d5ac8d0ff1 | ||
|
|
7df9a7f074 | ||
|
|
b56665b65b | ||
|
|
6891fe2fce | ||
|
|
dee7724ec2 | ||
|
|
caca9e4f6a | ||
|
|
fb34a6f3d1 | ||
|
|
2b65a547a1 | ||
|
|
5fd3adcf80 | ||
|
|
14e8343eaa | ||
|
|
15b870152a | ||
|
|
df84625b15 | ||
|
|
7b41d8f4f9 | ||
|
|
b67f6b3ceb | ||
|
|
e839a60270 | ||
|
|
2db68d61f2 | ||
|
|
455d6c1aff | ||
|
|
1b6df9fa62 | ||
|
|
74052faecf | ||
|
|
aaa890ed8a | ||
|
|
775b0a915b | ||
|
|
c489ae1511 | ||
|
|
6274ba4195 | ||
|
|
09a2f0bf30 | ||
|
|
0f89f7a2ea | ||
|
|
29c1d4a232 | ||
|
|
043166c35b | ||
|
|
a69cee40d3 | ||
|
|
f6192d408e | ||
|
|
688fea67af | ||
|
|
73748072b5 | ||
|
|
92e7482c92 | ||
|
|
9e47778bdd | ||
|
|
8bbf0ba6d5 | ||
|
|
2e2f24596a | ||
|
|
7f2acd73ad | ||
|
|
4a081a691d | ||
|
|
bf60a59fbd | ||
|
|
d08fe34434 | ||
|
|
31904a2bb4 | ||
|
|
0b870de473 | ||
|
|
0ac81eadec | ||
|
|
0aa7edbb06 | ||
|
|
0950fecb2e | ||
|
|
2eace68955 | ||
|
|
c048b8ed2f | ||
|
|
83de80c73d | ||
|
|
9d83e48371 | ||
|
|
f02ea4b1ad | ||
|
|
b56607cfb6 | ||
|
|
caf21766a9 | ||
|
|
c6cfda11ec | ||
|
|
cf2071f3b1 | ||
|
|
38a73e0de3 | ||
|
|
3613949d7e | ||
|
|
e26e18670b | ||
|
|
a22fad2487 | ||
|
|
53c84e030e | ||
|
|
e7285b6000 | ||
|
|
efc518a74a | ||
|
|
483657d520 | ||
|
|
af1eb2113a | ||
|
|
0b52492d92 | ||
|
|
fdb1e9b338 | ||
|
|
cef5a16f05 | ||
|
|
d973746917 | ||
|
|
9063fe0468 | ||
|
|
20e8063185 | ||
|
|
482634a7c7 | ||
|
|
b2f02dfdcd | ||
|
|
36ddd24ce1 | ||
|
|
7b9d01678d | ||
|
|
5bb59f8dff | ||
|
|
107ffe0e09 | ||
|
|
c7d33a479b | ||
|
|
c5400544b0 | ||
|
|
76a797a663 | ||
|
|
d42308a2cd | ||
|
|
bfa6f5c5ed | ||
|
|
c93ac21b90 | ||
|
|
2132355a7b | ||
|
|
ec9ef43868 | ||
|
|
f33c455ecf | ||
|
|
266ddf5570 | ||
|
|
5e31e3ff6b | ||
|
|
c5c8252325 | ||
|
|
36124919b9 | ||
|
|
4ffdca7c8d | ||
|
|
6eaf748d6f | ||
|
|
5a346cd8df | ||
|
|
585cbb135c | ||
|
|
292573e137 | ||
|
|
3492e49433 | ||
|
|
4529e0fa2b | ||
|
|
9a68094b07 | ||
|
|
1ca8e81062 | ||
|
|
9e430e786e | ||
|
|
bb302001f2 | ||
|
|
7c300733e0 | ||
|
|
57b6f6f1eb | ||
|
|
5bddf66240 | ||
|
|
c8fc611182 | ||
|
|
cbd1058523 | ||
|
|
e0d67f4750 | ||
|
|
5b2c0214db | ||
|
|
511c69b14e | ||
|
|
9ebe6dc841 | ||
|
|
f2bed66119 | ||
|
|
96eebb87af | ||
|
|
716ee0ca50 | ||
|
|
6492215005 | ||
|
|
ab5c337b22 | ||
|
|
16d82332cd | ||
|
|
023ffbafc9 | ||
|
|
8ec8b902f6 | ||
|
|
ae4916e7bf | ||
|
|
73699ae901 | ||
|
|
910c60236e | ||
|
|
9b989dd35e | ||
|
|
9400dbeba2 | ||
|
|
33f6c4dfc9 | ||
|
|
52941d9f50 | ||
|
|
4cdda1fab6 | ||
|
|
67749672fd | ||
|
|
23b6dfb0a9 | ||
|
|
c98eeb9f88 | ||
|
|
ec0c391467 | ||
|
|
7305149729 | ||
|
|
556094d15d | ||
|
|
22c7965314 | ||
|
|
4fd8f81686 | ||
|
|
3d650ff5c8 | ||
|
|
9e2bcdf8a5 | ||
|
|
d2d85f1a2d | ||
|
|
b90a5835da | ||
|
|
54c418c07b | ||
|
|
d4083791c1 | ||
|
|
0ed403ded1 | ||
|
|
f8b064f28b | ||
|
|
38973f07a0 | ||
|
|
1f5bfe9e4d | ||
|
|
1d0b1dafed | ||
|
|
2571f65ac4 | ||
|
|
f52fd34879 | ||
|
|
3610c34b4a | ||
|
|
30390816df | ||
|
|
9c77f2f843 | ||
|
|
c7fa4c5180 | ||
|
|
66d544fb0a | ||
|
|
7f62f07d0b | ||
|
|
2829ec1aae | ||
|
|
97ffb0633d | ||
|
|
f378429786 | ||
|
|
f755d89b2a | ||
|
|
a8e200ab03 | ||
|
|
68bec95772 | ||
|
|
fde9529a31 | ||
|
|
0d044a7468 | ||
|
|
ee4b9c1d8f | ||
|
|
a7bd3deb76 | ||
|
|
9e69b213b0 | ||
|
|
f75ac01959 | ||
|
|
3eafc2b31c | ||
|
|
b39f48e8d6 | ||
|
|
4346e2dc6f | ||
|
|
85122128bf | ||
|
|
5a58ea3ffb | ||
|
|
e1237da088 | ||
|
|
b4eebf5ead | ||
|
|
922a825648 | ||
|
|
3602d439a5 | ||
|
|
1718d8e885 | ||
|
|
f58f3ac31a | ||
|
|
6e65b556b4 | ||
|
|
d86597b92e | ||
|
|
ce667c5784 | ||
|
|
13a939f88e | ||
|
|
52ae7cad7f | ||
|
|
eacad46c9b | ||
|
|
1bd8fc7154 | ||
|
|
50ccb1b7d8 | ||
|
|
c693553365 | ||
|
|
6c3e4bc202 | ||
|
|
92d9a2dbd8 | ||
|
|
5df24d23c0 | ||
|
|
1215b5044c | ||
|
|
b1263ec4df | ||
|
|
19e85bde8b | ||
|
|
cbe71f4fd4 | ||
|
|
52afd836ac | ||
|
|
095a29a4a0 | ||
|
|
49ff9f8b09 | ||
|
|
457c1e933a | ||
|
|
f5e56f0da9 | ||
|
|
0d8df5e97c | ||
|
|
92af09660c | ||
|
|
435e7e08f3 | ||
|
|
2516c42c08 | ||
|
|
19dc4fd1b1 | ||
|
|
0305cc7506 | ||
|
|
5854929085 | ||
|
|
232e560724 | ||
|
|
994de5cdc2 | ||
|
|
dcc303ad37 | ||
|
|
84ecc4d13d | ||
|
|
eb338b1d0b | ||
|
|
1b1261f4f6 | ||
|
|
3fff156344 | ||
|
|
3d39238045 | ||
|
|
705b176992 | ||
|
|
1c2e150899 | ||
|
|
8af820c58e | ||
|
|
940a4836a7 | ||
|
|
1ef2fa0f84 | ||
|
|
7efdf90100 | ||
|
|
be930740cf | ||
|
|
241b49ac23 | ||
|
|
77499dbdad | ||
|
|
a4c688f126 | ||
|
|
5ee753e989 | ||
|
|
77c6c16096 | ||
|
|
2105ccc791 | ||
|
|
e03af03acb | ||
|
|
041a43be97 | ||
|
|
53180baddd | ||
|
|
b88613a6f1 | ||
|
|
dbc5455de0 | ||
|
|
17357eba33 | ||
|
|
ff9ab1907b | ||
|
|
0b9ebb04c8 | ||
|
|
10a3b3a046 | ||
|
|
7cf852ab52 | ||
|
|
2341df8998 | ||
|
|
190e71d3c4 | ||
|
|
c0a9b90715 | ||
|
|
6d13774fd0 | ||
|
|
41252ccaa6 | ||
|
|
ff05a35991 | ||
|
|
8b7e9eaeb6 | ||
|
|
7f80eb0ef2 | ||
|
|
ef151c2ef4 | ||
|
|
e7cad8dd36 | ||
|
|
c4edb2f6a0 | ||
|
|
11709e6d48 | ||
|
|
0b0fcc411d | ||
|
|
1aadcc863f | ||
|
|
9ac167e66c | ||
|
|
1530873df5 | ||
|
|
75a5b4fa21 | ||
|
|
b6c45da7bc | ||
|
|
5e30673281 | ||
|
|
d38c611a18 | ||
|
|
570bc557f5 | ||
|
|
c1f4152cae | ||
|
|
0472362abc | ||
|
|
b732b60520 | ||
|
|
fc1f988654 | ||
|
|
7ef93c4a11 | ||
|
|
247aa3e685 | ||
|
|
aa0292bad6 | ||
|
|
08cd608ac2 | ||
|
|
f85a32dc08 | ||
|
|
b5deb69ef7 | ||
|
|
872883f710 | ||
|
|
3d402e7bdd | ||
|
|
862480c470 | ||
|
|
98b5d7f034 | ||
|
|
e5c5a929ec | ||
|
|
d39ee392b9 | ||
|
|
b574c6c950 | ||
|
|
074c984f3b | ||
|
|
2817ca529d | ||
|
|
4f932d0a56 | ||
|
|
2dd931dc8f | ||
|
|
c7ab2ecb44 | ||
|
|
8466ab6ed9 | ||
|
|
7b74905973 | ||
|
|
ecfb5a0a94 | ||
|
|
967cb74aa5 | ||
|
|
34daf8f38d | ||
|
|
e12359821c | ||
|
|
eea41e6c05 | ||
|
|
36d1e75719 | ||
|
|
35e93c8ce1 | ||
|
|
d603b01733 | ||
|
|
6c66b5df82 | ||
|
|
3b59e21407 | ||
|
|
d0e74ac4cb | ||
|
|
c04aa3d753 | ||
|
|
f3fade7ed2 | ||
|
|
79d8e837e8 | ||
|
|
c39795fa9f | ||
|
|
4a7c55a382 | ||
|
|
7e4396552e | ||
|
|
40219f2a67 | ||
|
|
ce35c176ee | ||
|
|
a852f03214 | ||
|
|
7c8b43d91b | ||
|
|
ecf763b24b | ||
|
|
8ad4fc52e3 | ||
|
|
7e48f6fd2b | ||
|
|
5c81832cde | ||
|
|
569458d691 | ||
|
|
c825bf4606 | ||
|
|
567846156c | ||
|
|
14f1ab992c | ||
|
|
42cb9291fc | ||
|
|
aa2bf97078 | ||
|
|
6976db961b | ||
|
|
1823543706 | ||
|
|
c452b8be69 | ||
|
|
53612938b6 | ||
|
|
ccb64480a8 | ||
|
|
4f0a172036 | ||
|
|
ca45eba76b | ||
|
|
8f58543a4c | ||
|
|
453242e06a | ||
|
|
249a564ac7 | ||
|
|
701c822e1a | ||
|
|
2ca4b6e8d4 | ||
|
|
fe060e4489 | ||
|
|
6dc29ec746 | ||
|
|
8b9ac89205 | ||
|
|
74bbd490d7 | ||
|
|
7a5f89ea87 | ||
|
|
bdcddb88e4 | ||
|
|
cccc7971c1 | ||
|
|
82d2ca915d | ||
|
|
319dc0b19e | ||
|
|
2573f0f2af | ||
|
|
641244103f | ||
|
|
1b7909d914 | ||
|
|
9d7dfd8f5f | ||
|
|
42edef2313 | ||
|
|
7ad6677b90 | ||
|
|
ce19c34b8b | ||
|
|
d675e3781f | ||
|
|
2164a98abe | ||
|
|
b61ce58f4c | ||
|
|
7a11c8fa9a | ||
|
|
62438ec4f6 | ||
|
|
afcc6a9a3e | ||
|
|
b6a094064a | ||
|
|
70b8eb6513 | ||
|
|
e4c7a0c98b | ||
|
|
67573e7a8a | ||
|
|
c60dce4504 | ||
|
|
8250d3d42f | ||
|
|
5407c8aa65 | ||
|
|
d282634264 | ||
|
|
fff0e6dd30 | ||
|
|
a1ccdc672c | ||
|
|
6802da55ed | ||
|
|
57dae50cf7 | ||
|
|
4bce809fab | ||
|
|
2ff2cdab79 | ||
|
|
76839dcd59 | ||
|
|
effd5451b6 | ||
|
|
00ac74f944 | ||
|
|
728f1969ce | ||
|
|
fab757f9dd | ||
|
|
fa006ba947 | ||
|
|
2b61fb0fcf | ||
|
|
62bcd3b669 | ||
|
|
0fc394174c | ||
|
|
14015aebc7 | ||
|
|
5acdcea0b0 | ||
|
|
709d3b9219 | ||
|
|
0f028e73d3 | ||
|
|
f0fa1f1a1d | ||
|
|
0a52e41c3d | ||
|
|
9ef750956c | ||
|
|
b70d541224 | ||
|
|
a8299738d2 | ||
|
|
e789309827 | ||
|
|
f8066454a8 | ||
|
|
a80c8e6d1b | ||
|
|
3dc8541aee | ||
|
|
b7cd003b4c | ||
|
|
bae90633a5 | ||
|
|
56eff84f30 | ||
|
|
375ae7cecb | ||
|
|
ac8a9358ff | ||
|
|
8bc900eef9 | ||
|
|
845a85ed1f | ||
|
|
a1a7a8abf8 | ||
|
|
9cc4dca5b2 | ||
|
|
ea244506d3 | ||
|
|
9827414e92 | ||
|
|
549cf37127 | ||
|
|
237d5ce7c3 | ||
|
|
05fc72c611 | ||
|
|
5d889b71aa | ||
|
|
8641d15fc7 | ||
|
|
e4fc742990 | ||
|
|
a27dfe895f | ||
|
|
098d4b4dcc | ||
|
|
765ca02255 | ||
|
|
186dec0ad9 | ||
|
|
14a6d143bc | ||
|
|
ade5a4fa10 | ||
|
|
85d3ae8fce | ||
|
|
fb200278ae | ||
|
|
34da29bef0 | ||
|
|
f164fbb150 | ||
|
|
fe1537bb12 | ||
|
|
69cc336cef | ||
|
|
d05030f99a | ||
|
|
9699d095c5 | ||
|
|
6ca2d7a37c | ||
|
|
b0c4944a6c | ||
|
|
d25925d525 | ||
|
|
07a6834216 | ||
|
|
69f1f51460 | ||
|
|
8b30a2c5f2 | ||
|
|
65a534ebae | ||
|
|
ac0a154fc4 | ||
|
|
1b510007fd | ||
|
|
692c363264 | ||
|
|
cf5d88c69d | ||
|
|
109f49e522 | ||
|
|
53e3f7a1b0 | ||
|
|
c7d3e162b9 | ||
|
|
7b2bb34a36 | ||
|
|
c7b1082954 | ||
|
|
aa18d0dd1a | ||
|
|
711d0382f3 | ||
|
|
7b02c39172 | ||
|
|
b178f11bea | ||
|
|
42da8a7d15 | ||
|
|
bd9b62d7de | ||
|
|
98fcd94614 | ||
|
|
06e7112db1 | ||
|
|
9ba023b0fd | ||
|
|
ff63c0fff2 | ||
|
|
421dbcae80 | ||
|
|
4c321967f4 | ||
|
|
b3c0138074 | ||
|
|
4b7c862ac8 | ||
|
|
cf4b99710c | ||
|
|
d25e0121a6 | ||
|
|
213a339d34 | ||
|
|
d2205dc361 | ||
|
|
21e0586add | ||
|
|
cbbe200c98 | ||
|
|
fbeddc7b19 | ||
|
|
1ed6c85b5d | ||
|
|
c7f10dbcbc | ||
|
|
81f747c75b | ||
|
|
a76dc0515c | ||
|
|
bb77ecbd73 | ||
|
|
5d35e7d78b | ||
|
|
e20c4e7027 | ||
|
|
3977df70f4 | ||
|
|
7f72a8bb39 | ||
|
|
de27e9fcb8 | ||
|
|
76bd94ddb5 | ||
|
|
651e209f07 | ||
|
|
448ec1e0ee | ||
|
|
6e2afeee3c | ||
|
|
edce49467c | ||
|
|
2934027437 | ||
|
|
b2250cda79 | ||
|
|
96d69b349f | ||
|
|
4a6ae0380a | ||
|
|
e339ddd227 | ||
|
|
afaf6c9e19 | ||
|
|
e21eaf8606 | ||
|
|
a43a650d17 | ||
|
|
17cb742964 | ||
|
|
9d8231b253 | ||
|
|
5bf2ea95e5 | ||
|
|
2f48330d74 | ||
|
|
b0b516a990 | ||
|
|
1057271163 | ||
|
|
296d5df16f | ||
|
|
b2abe00b14 | ||
|
|
793d665d80 | ||
|
|
bbbe596e72 | ||
|
|
c3c148f5db | ||
|
|
4b8f1d2d20 | ||
|
|
8a3222ed54 | ||
|
|
9f82af2e12 | ||
|
|
2536e5146c | ||
|
|
98b0502e20 | ||
|
|
25c1198c0a | ||
|
|
a6e31596d6 | ||
|
|
c9b3cd6fc0 | ||
|
|
2c18d1d39b | ||
|
|
28895e3e04 | ||
|
|
f8ef044226 | ||
|
|
b8da5750c7 | ||
|
|
fbdc0f79a8 | ||
|
|
ea7f666e36 | ||
|
|
48ff8a7e1b | ||
|
|
033a378e14 | ||
|
|
a3d19f246e | ||
|
|
ec67215bc2 | ||
|
|
f207bef4a8 | ||
|
|
41bb944c26 | ||
|
|
38eb33367d | ||
|
|
5ae59006fb | ||
|
|
e66e7d4a03 | ||
|
|
34bbfaf256 | ||
|
|
abd323a232 | ||
|
|
97ba1d0be1 | ||
|
|
deb211a420 | ||
|
|
9481eed7b8 | ||
|
|
50c457d877 | ||
|
|
a544a0d15e | ||
|
|
8c26ac5fca | ||
|
|
d56e0de9fd | ||
|
|
5132152334 | ||
|
|
ef6ba7e585 | ||
|
|
695a9d19d4 | ||
|
|
45682dff9b | ||
|
|
47c5653bc0 | ||
|
|
033ebc802a | ||
|
|
14e0fb66fb | ||
|
|
18d9756fc5 | ||
|
|
f976548fa1 | ||
|
|
a3fed6836d | ||
|
|
78d89f83da | ||
|
|
66b93b0c83 | ||
|
|
fe06ead2e2 | ||
|
|
71e5b1b866 | ||
|
|
35ac2d6297 | ||
|
|
ff33d13822 | ||
|
|
ffb02d1d6c | ||
|
|
86f7e85ce9 | ||
|
|
cd6318ba84 | ||
|
|
7385b8ced2 | ||
|
|
a36ccd4157 | ||
|
|
29a3459649 | ||
|
|
8dd7df989d | ||
|
|
d40b9a9ba6 | ||
|
|
dd5d34f7aa | ||
|
|
5685c8430f | ||
|
|
723a195d89 | ||
|
|
68a20cba27 | ||
|
|
27802e54e6 | ||
|
|
3e91ca3bc3 | ||
|
|
5a4e98bd71 | ||
|
|
225fe66afa | ||
|
|
619f0ca3e9 | ||
|
|
fa3f4cd06b | ||
|
|
7694d2e676 | ||
|
|
ea6792f21b | ||
|
|
5e4dace755 | ||
|
|
276dbf5d42 | ||
|
|
0ca2685bf3 | ||
|
|
4bab97ec62 | ||
|
|
47bd5f6291 | ||
|
|
7ee1441b8e | ||
|
|
034270a119 | ||
|
|
9e4bff03d9 | ||
|
|
29b9954954 | ||
|
|
3aa62b9eeb | ||
|
|
d8bd976204 | ||
|
|
3ccb8f5dc8 | ||
|
|
cb05990260 | ||
|
|
8a2c21c88c | ||
|
|
204cd81462 | ||
|
|
71505b5419 | ||
|
|
50e958e2e3 | ||
|
|
3ffab58cbf | ||
|
|
febb9e2fe0 | ||
|
|
b1af1b7254 | ||
|
|
32a4da1826 | ||
|
|
cc44eef174 | ||
|
|
c608a5890a | ||
|
|
52253908eb | ||
|
|
a50956cdb0 | ||
|
|
ee55e4b216 | ||
|
|
9d041926d7 | ||
|
|
72ea2de25c | ||
|
|
4b559c2278 | ||
|
|
327ecf1aed | ||
|
|
8fc893ce08 | ||
|
|
0ec0e10c0f | ||
|
|
38c7a01743 | ||
|
|
a481b5ce60 | ||
|
|
7786db1040 | ||
|
|
200aa0d319 | ||
|
|
c8bb543907 | ||
|
|
de7ecf45d1 | ||
|
|
f25298ed9e | ||
|
|
d4ea2fbd93 | ||
|
|
79c51fb21a | ||
|
|
c57c9b5f18 | ||
|
|
823cd73d33 | ||
|
|
54db4b6e34 | ||
|
|
112399d67c | ||
|
|
01b80d8798 | ||
|
|
f6a3f36a13 | ||
|
|
d674e23987 | ||
|
|
51aebf5e40 | ||
|
|
2ec6d2f1d7 | ||
|
|
9f94917a2d | ||
|
|
06f2104750 | ||
|
|
b1e1e36236 | ||
|
|
9eb2056ac6 | ||
|
|
0c3cb22e83 | ||
|
|
92f27ba273 | ||
|
|
47d682e7c1 | ||
|
|
75d84b67ff | ||
|
|
be8f5ca5da | ||
|
|
c7910a6183 | ||
|
|
98afc28762 | ||
|
|
4cd1349a5a | ||
|
|
cebac64264 | ||
|
|
172125e03b | ||
|
|
15006091b4 | ||
|
|
2175f1d957 | ||
|
|
d445cbfe25 | ||
|
|
5fc56c342d | ||
|
|
e5350d03a8 | ||
|
|
097daf3dc1 | ||
|
|
3c3dc85187 | ||
|
|
a775a667f6 | ||
|
|
a1a7a69aeb | ||
|
|
ff549ab337 | ||
|
|
464651503e | ||
|
|
2f93250c8e | ||
|
|
22ce7ba750 | ||
|
|
acbb09f6a1 | ||
|
|
900dd23ae7 | ||
|
|
0f391776aa | ||
|
|
817fb613ab | ||
|
|
2f57ea0160 | ||
|
|
f5d5aedf9d | ||
|
|
c5114e9bf1 | ||
|
|
7514aed437 | ||
|
|
f4d381c9d4 | ||
|
|
8698036f7c | ||
|
|
21f04cfd46 | ||
|
|
074cf62cc9 | ||
|
|
a66f833c90 | ||
|
|
d704d23d39 | ||
|
|
e2570aec4a | ||
|
|
6b97fde9ab | ||
|
|
30adf1bcbf | ||
|
|
f205b49a54 | ||
|
|
5c7e18696e | ||
|
|
c78b00b0fc | ||
|
|
b05d6e1e1b | ||
|
|
da0bce655c | ||
|
|
d4dcbcc9d5 | ||
|
|
f132e5b87b | ||
|
|
872475e82b | ||
|
|
66d062bfda | ||
|
|
a514ceb62f | ||
|
|
b0d8a5bc41 | ||
|
|
8f4bb5130e | ||
|
|
9386589558 | ||
|
|
5945289a81 | ||
|
|
53346cc85b | ||
|
|
a6fad3ac4e | ||
|
|
cb7e2b5d5c | ||
|
|
0f764416a3 | ||
|
|
c9e0012bf7 | ||
|
|
457f2a677a | ||
|
|
ced56ee41f | ||
|
|
4e910f1f22 | ||
|
|
34bceebace | ||
|
|
b4f802ba77 | ||
|
|
3d9d464870 | ||
|
|
a7e21427f9 | ||
|
|
bdbf10294b | ||
|
|
8588430cf0 | ||
|
|
d920bb5c17 | ||
|
|
64fe9bf59d | ||
|
|
101b0bf41f | ||
|
|
019865b5ee | ||
|
|
799d34a1f1 | ||
|
|
951d533ed3 | ||
|
|
459eb0ef7b | ||
|
|
f710105bd9 | ||
|
|
4998e3ce40 | ||
|
|
d739b374a4 | ||
|
|
bd61ebcbb6 | ||
|
|
3963275092 | ||
|
|
a796e0fe67 | ||
|
|
52ac61fa1d | ||
|
|
29ca7665b1 | ||
|
|
d9bdb814f4 | ||
|
|
3dfb094a08 | ||
|
|
7ce1818a7f | ||
|
|
6e6eff7991 | ||
|
|
aa9c98f081 | ||
|
|
cdf0ad45f0 | ||
|
|
1b97b6673f | ||
|
|
721d432bc6 | ||
|
|
e513a784eb | ||
|
|
ff8da78992 | ||
|
|
84a69ce982 | ||
|
|
7d743f8678 | ||
|
|
3f24e15392 | ||
|
|
0f86bb6874 | ||
|
|
05ee7a2ab2 | ||
|
|
b9321433d0 | ||
|
|
62791401e9 | ||
|
|
4d28bba9cc | ||
|
|
1f3660e1f3 | ||
|
|
95ff44e205 | ||
|
|
987a164092 | ||
|
|
1b5b11fd5b | ||
|
|
ddcde52e27 | ||
|
|
ea2da84535 | ||
|
|
abed8ee574 | ||
|
|
556c59a9c7 | ||
|
|
ad2d085b24 | ||
|
|
d7209102b8 | ||
|
|
14e1ba6795 | ||
|
|
65b56081ce | ||
|
|
eafb51cbfa | ||
|
|
3444ae296e | ||
|
|
4f2fff5da6 | ||
|
|
144483a45d | ||
|
|
53345b2bb0 | ||
|
|
5d6bc429b0 | ||
|
|
a4faf61613 | ||
|
|
fdd516598d | ||
|
|
70da6990c4 | ||
|
|
e8b18d0805 | ||
|
|
1ca9e8678c | ||
|
|
94670149fe | ||
|
|
8e253c2972 | ||
|
|
6e15c6d9cb | ||
|
|
ca00e90ad6 | ||
|
|
b1d76ea661 | ||
|
|
059d428cfa | ||
|
|
a4b50eb357 | ||
|
|
0dfd5aa11d | ||
|
|
2b63ccd145 | ||
|
|
97cec5ec38 | ||
|
|
31fb5a3616 | ||
|
|
7b7130d67d | ||
|
|
6707ad55ff | ||
|
|
89aa73b63a | ||
|
|
bb7453a002 | ||
|
|
8cea29dcb0 | ||
|
|
d5d74ec8d6 | ||
|
|
9b000b94ac | ||
|
|
82ed9fcc83 | ||
|
|
cd53283935 | ||
|
|
3faddf76f8 | ||
|
|
6e24ae2f4f | ||
|
|
66912580c8 | ||
|
|
219dd830e1 | ||
|
|
3d5cdcc78e | ||
|
|
ab1d43fae3 | ||
|
|
2d51f3c23d | ||
|
|
f9447cf7aa | ||
|
|
c6ed0bfc7d | ||
|
|
2d4621b1a6 | ||
|
|
3bf929b4a5 | ||
|
|
ebed01ba86 | ||
|
|
880d005347 | ||
|
|
e8ef216de8 | ||
|
|
baa453594a | ||
|
|
9c767d5c49 | ||
|
|
e0892bd2fa | ||
|
|
315be7c465 | ||
|
|
9d34dc0954 | ||
|
|
bdedd43e3c | ||
|
|
97e779675e | ||
|
|
2ef4216886 | ||
|
|
8c9764a57e | ||
|
|
eb94eb1a6d | ||
|
|
12e3fb99eb | ||
|
|
2bd90a26a8 | ||
|
|
24db3a4cb1 | ||
|
|
0d05ea1730 | ||
|
|
9c13b3c1bf | ||
|
|
492d9d16eb | ||
|
|
c4cd0eb683 | ||
|
|
287f7b9818 | ||
|
|
15b5a3e0c1 | ||
|
|
cf93c43ef2 | ||
|
|
380c24537b | ||
|
|
6200bc7e02 | ||
|
|
e92465c894 | ||
|
|
6f432d221a | ||
|
|
b8ddca4e76 | ||
|
|
f343ee9f7f | ||
|
|
9a8c4c6fdd | ||
|
|
96f2dc0454 | ||
|
|
e0988ef186 | ||
|
|
a154174fa1 | ||
|
|
042861f065 | ||
|
|
0f776af050 | ||
|
|
166e50924f | ||
|
|
efb34ede56 | ||
|
|
22b55eb223 | ||
|
|
f5d9027206 | ||
|
|
9dcbeff21a | ||
|
|
0cc7c4d0a2 | ||
|
|
b0ca65b720 | ||
|
|
e3eb3eb7bf | ||
|
|
b8b2c92227 | ||
|
|
424dde5da6 | ||
|
|
ce7e636987 | ||
|
|
c51f61ba56 | ||
|
|
91623bcf7a | ||
|
|
34e14a3521 | ||
|
|
6c1a79b342 | ||
|
|
6af5014866 | ||
|
|
16f53dc1b1 | ||
|
|
df09fe0684 | ||
|
|
e765764cea | ||
|
|
2e63bcb5c3 | ||
|
|
e231f0c34e | ||
|
|
8155fe7b3f | ||
|
|
6fe1bcdff2 | ||
|
|
b6b488bd46 | ||
|
|
d97cc0cadc | ||
|
|
2a3c742be9 | ||
|
|
cdee86dbcb | ||
|
|
60264e2bfc | ||
|
|
19fb315500 | ||
|
|
66710659c9 | ||
|
|
de5a34c485 | ||
|
|
e0c7ba3874 | ||
|
|
9e58fbee56 | ||
|
|
5315941f88 | ||
|
|
3ffeb0250b | ||
|
|
451e6bb406 | ||
|
|
58d680bd59 | ||
|
|
79eb708adb | ||
|
|
1282e62781 | ||
|
|
4af501feee | ||
|
|
ef7c24f6de | ||
|
|
62edd02a22 | ||
|
|
6f22edc8f3 | ||
|
|
27bba1c2da | ||
|
|
c95bc22f0e | ||
|
|
844bab253d | ||
|
|
b8372487cf | ||
|
|
8cc38466e6 | ||
|
|
14935b1a52 | ||
|
|
f7b14cd9ba | ||
|
|
9d1e61ef8d | ||
|
|
8c912c1b3e | ||
|
|
1ff6ae0195 | ||
|
|
641bf456fa | ||
|
|
f21eaabb15 | ||
|
|
7d38336e67 | ||
|
|
f37ec78d10 | ||
|
|
eb0f92dcd0 | ||
|
|
ee06235cf4 | ||
|
|
48dfe9054d | ||
|
|
c7e39e67aa | ||
|
|
86e51a11b7 | ||
|
|
3c0e98280d | ||
|
|
c54c9f7955 | ||
|
|
614c404bf4 | ||
|
|
c1ebcd49fc | ||
|
|
49551614fe | ||
|
|
b2b8603f23 | ||
|
|
4a6ecda8f8 | ||
|
|
b65d3c25e1 | ||
|
|
65f5ec1c38 | ||
|
|
b8b225eb84 | ||
|
|
c20239b9e8 | ||
|
|
a8df7228b3 | ||
|
|
b8ebc0efd8 | ||
|
|
5ee86faf80 | ||
|
|
3d6524b2fa | ||
|
|
82b671b234 | ||
|
|
3ad6de784f |
@@ -14,6 +14,7 @@ common --worker_sandboxing
|
||||
common --local_test_jobs=64
|
||||
common --jobs=64
|
||||
|
||||
# Keep these C++ standard flags in sync with tools/copts.bzl and scripts/shardok_cpp_config.sh.
|
||||
common --cxxopt="--std=c++23"
|
||||
common --cxxopt="-Wno-deprecated-non-prototype"
|
||||
common --per_file_copt=src/test/cpp/.*@-Wno-character-conversion
|
||||
@@ -37,6 +38,8 @@ build:ubsan --strip=never
|
||||
build:ubsan --copt=-fno-omit-frame-pointer
|
||||
build:ubsan --copt=-Wno-macro-redefined
|
||||
build:ubsan --copt=-fsanitize=undefined
|
||||
# Protobuf's arena implementation trips UBSan alignment checks in external code on macOS.
|
||||
build:ubsan --copt=-fno-sanitize=alignment
|
||||
build:ubsan --linkopt=-fsanitize=undefined
|
||||
test:ubsan --test_env=UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
|
||||
|
||||
|
||||
+10
-18
@@ -2,25 +2,17 @@ Checks: >
|
||||
-*,
|
||||
bugprone-*,
|
||||
performance-*,
|
||||
readability-*,
|
||||
modernize-*,
|
||||
cppcoreguidelines-*,
|
||||
modernize-use-nullptr,
|
||||
modernize-use-override,
|
||||
modernize-use-auto,
|
||||
modernize-use-nodiscard,
|
||||
readability-braces-around-statements,
|
||||
readability-qualified-auto,
|
||||
readability-redundant-member-init,
|
||||
cppcoreguidelines-pro-type-cstyle-cast,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-cppcoreguidelines-avoid-magic-numbers,
|
||||
-cppcoreguidelines-macro-usage,
|
||||
-cppcoreguidelines-owning-memory,
|
||||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
-cppcoreguidelines-pro-type-const-cast,
|
||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
-cppcoreguidelines-pro-type-union-access,
|
||||
-cppcoreguidelines-pro-type-vararg,
|
||||
-modernize-use-trailing-return-type,
|
||||
-readability-convert-member-functions-to-static,
|
||||
-readability-function-cognitive-complexity,
|
||||
-readability-identifier-length,
|
||||
-readability-magic-numbers
|
||||
-bugprone-branch-clone,
|
||||
-bugprone-signed-char-misuse
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: 'src/(main|test)/cpp/net/eagle0/(shardok|common)/.*'
|
||||
FormatStyle: file
|
||||
|
||||
@@ -12,6 +12,10 @@ on:
|
||||
- '.bazelrc'
|
||||
- 'ci/github_actions/ensure_bazel_installed.sh'
|
||||
- 'ci/github_actions/summarize_bazel_bep.py'
|
||||
- '.clang-tidy'
|
||||
- 'scripts/run-clang-tidy.sh'
|
||||
- 'scripts/check_shardok_clang_tidy.sh'
|
||||
- 'scripts/sync_bazel_xcode.sh'
|
||||
- '.github/actions/setup-bazel/**'
|
||||
- '.github/workflows/bazel_test.yml'
|
||||
- '!src/main/csharp/**'
|
||||
@@ -26,6 +30,10 @@ on:
|
||||
- '.bazelrc'
|
||||
- 'ci/github_actions/ensure_bazel_installed.sh'
|
||||
- 'ci/github_actions/summarize_bazel_bep.py'
|
||||
- '.clang-tidy'
|
||||
- 'scripts/run-clang-tidy.sh'
|
||||
- 'scripts/check_shardok_clang_tidy.sh'
|
||||
- 'scripts/sync_bazel_xcode.sh'
|
||||
- '.github/actions/setup-bazel/**'
|
||||
- '.github/workflows/bazel_test.yml'
|
||||
- '!src/main/csharp/**'
|
||||
@@ -78,6 +86,8 @@ jobs:
|
||||
node-version: 'lts/*'
|
||||
- name: Check JavaScript syntax
|
||||
run: node --check src/main/go/net/eagle0/admin_server/static/map_editor.js
|
||||
- name: Check Shardok clang-tidy gate
|
||||
run: ./scripts/check_shardok_clang_tidy.sh
|
||||
|
||||
test:
|
||||
runs-on: [self-hosted, bazel]
|
||||
@@ -112,6 +122,8 @@ jobs:
|
||||
lfs: false
|
||||
- name: Setup Bazel
|
||||
uses: ./.github/actions/setup-bazel
|
||||
- name: Sync Bazel Xcode config
|
||||
run: ./scripts/sync_bazel_xcode.sh
|
||||
- name: Run tests
|
||||
run: bazel test --build_event_json_file=test.json //src/test/... //src/main/go/...
|
||||
- name: Summarize Bazel build metrics
|
||||
|
||||
@@ -19,6 +19,7 @@ on:
|
||||
- 'src/main/resources/**'
|
||||
- 'ci/BUILD.bazel'
|
||||
- 'ci/github_actions/ensure_bazel_installed.sh'
|
||||
- 'scripts/sync_bazel_xcode.sh'
|
||||
- '.github/actions/setup-bazel/**'
|
||||
- 'MODULE.bazel'
|
||||
- 'MODULE.bazel.lock'
|
||||
@@ -41,6 +42,7 @@ on:
|
||||
- 'ci/BUILD.bazel'
|
||||
- 'ci/github_actions/ensure_bazel_installed.sh'
|
||||
- 'ci/github_actions/fetch_lfs.sh'
|
||||
- 'scripts/sync_bazel_xcode.sh'
|
||||
- '.github/actions/setup-bazel/**'
|
||||
- 'go.mod'
|
||||
- 'go.sum'
|
||||
@@ -125,6 +127,10 @@ jobs:
|
||||
if: steps.check-latest.outputs.skip != 'true'
|
||||
uses: ./.github/actions/setup-bazel
|
||||
|
||||
- name: Sync Bazel Xcode config
|
||||
if: steps.check-latest.outputs.skip != 'true'
|
||||
run: ./scripts/sync_bazel_xcode.sh
|
||||
|
||||
- name: Fetch LFS files needed for admin server
|
||||
if: steps.check-latest.outputs.skip != 'true'
|
||||
env:
|
||||
@@ -255,7 +261,7 @@ jobs:
|
||||
echo "=== All images pushed successfully ==="
|
||||
|
||||
deploy:
|
||||
runs-on: [self-hosted, bazel]
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-all]
|
||||
if: needs.build-all.outputs.skip_build != 'true' && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_images == 'true'))
|
||||
environment: production
|
||||
@@ -334,25 +340,11 @@ jobs:
|
||||
ssh-keyscan -H "$DO_DROPLET_IP" >> ~/.ssh/known_hosts 2>/dev/null || true
|
||||
|
||||
- name: Download warmup binary
|
||||
id: download-warmup
|
||||
continue-on-error: true
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: warmup-binary
|
||||
path: scripts/bin/
|
||||
|
||||
- name: Build warmup binary fallback
|
||||
if: steps.download-warmup.outcome != 'success'
|
||||
run: |
|
||||
echo "::warning::warmup-binary artifact was unavailable; rebuilding warmup binary before deploy"
|
||||
./ci/github_actions/ensure_bazel_installed.sh
|
||||
bazel build \
|
||||
--platforms=//:linux_x86_64 \
|
||||
--extra_toolchains=@llvm_toolchain_linux//:cc-toolchain-x86_64-linux \
|
||||
//ci:warmup_tar
|
||||
mkdir -p scripts/bin
|
||||
tar -xf bazel-bin/ci/warmup_tar.tar -C scripts/bin --strip-components=1
|
||||
|
||||
- name: Copy config files to droplet
|
||||
run: |
|
||||
# Create directory structure on remote
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
name: Eagle0pedia Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
paths:
|
||||
- 'docs/eagle0pedia/**'
|
||||
- 'ci/github_actions/ensure_bazel_installed.sh'
|
||||
- '.github/actions/setup-bazel/**'
|
||||
- '.github/workflows/eagle0pedia_build.yml'
|
||||
- 'MODULE.bazel'
|
||||
- 'MODULE.bazel.lock'
|
||||
- '.bazelrc'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'docs/eagle0pedia/**'
|
||||
- 'ci/github_actions/ensure_bazel_installed.sh'
|
||||
- '.github/actions/setup-bazel/**'
|
||||
- '.github/workflows/eagle0pedia_build.yml'
|
||||
- 'MODULE.bazel'
|
||||
- 'MODULE.bazel.lock'
|
||||
- '.bazelrc'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [self-hosted, bazel]
|
||||
steps:
|
||||
- name: Prepare workspace
|
||||
run: |
|
||||
chmod -R u+w eagle0pedia-dist 2>/dev/null || true
|
||||
rm -rf eagle0pedia-dist
|
||||
|
||||
- name: Prepare non-LFS checkout
|
||||
env:
|
||||
GIT_CONFIG_GLOBAL: ${{ runner.temp }}/gitconfig-no-lfs
|
||||
GIT_CONFIG_NOSYSTEM: "1"
|
||||
run: |
|
||||
git config --global --unset-all filter.lfs.process || true
|
||||
git config --global filter.lfs.smudge "cat"
|
||||
git config --global filter.lfs.clean "cat"
|
||||
git config --global filter.lfs.required false
|
||||
if [ -d ".git" ]; then
|
||||
git config --local --unset-all filter.lfs.process || true
|
||||
git config --local filter.lfs.smudge "cat"
|
||||
git config --local filter.lfs.clean "cat"
|
||||
git config --local filter.lfs.required false
|
||||
fi
|
||||
rm -f .git/hooks/post-checkout .git/hooks/post-merge .git/hooks/pre-push
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
env:
|
||||
GIT_CONFIG_GLOBAL: ${{ runner.temp }}/gitconfig-no-lfs
|
||||
GIT_CONFIG_NOSYSTEM: "1"
|
||||
with:
|
||||
persist-credentials: false
|
||||
lfs: false
|
||||
|
||||
- name: Setup Bazel
|
||||
uses: ./.github/actions/setup-bazel
|
||||
|
||||
- name: Build Eagle0pedia
|
||||
run: bazel build //docs/eagle0pedia:site
|
||||
|
||||
- name: Stage static site artifact
|
||||
run: |
|
||||
rm -rf eagle0pedia-dist
|
||||
mkdir -p eagle0pedia-dist
|
||||
cp -R bazel-bin/docs/eagle0pedia/dist/. eagle0pedia-dist/
|
||||
chmod -R u+w eagle0pedia-dist
|
||||
|
||||
- name: Upload static site artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: eagle0pedia-dist
|
||||
path: eagle0pedia-dist/
|
||||
if-no-files-found: error
|
||||
retention-days: 3
|
||||
@@ -177,10 +177,12 @@ jobs:
|
||||
env:
|
||||
DO_CDN_PAT: ${{ secrets.DO_CDN_PAT }}
|
||||
run: |
|
||||
UNITY_VERSION=$(grep "m_EditorVersion:" src/main/csharp/net/eagle0/clients/unity/eagle0/ProjectSettings/ProjectVersion.txt | head -1 | sed 's/m_EditorVersion: //')
|
||||
UNITY_MAJOR_MINOR=$(echo "$UNITY_VERSION" | sed -E 's/^([0-9]+)\.([0-9]+).*/\1.\2/')
|
||||
curl -s -X DELETE "https://api.digitalocean.com/v2/cdn/endpoints/8c98df29-6f0c-4704-8e82-ca40a2b81aa8/cache" \
|
||||
-H "Authorization: Bearer $DO_CDN_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"files": ["addressables/iOS/*"]}' \
|
||||
-d "{\"files\": [\"addressables/iOS/$UNITY_MAJOR_MINOR/*\"]}" \
|
||||
--fail || echo "Warning: CDN purge failed (non-fatal)"
|
||||
|
||||
- name: Archive Build Log
|
||||
|
||||
@@ -267,6 +267,7 @@ jobs:
|
||||
runs-on: [self-hosted, macOS, notarize]
|
||||
outputs:
|
||||
deployed_version: ${{ steps.deploy-mac.outputs.deployed_version }}
|
||||
deployed_unity_major_minor: ${{ steps.deploy-mac.outputs.deployed_unity_major_minor }}
|
||||
concurrency:
|
||||
group: mac-deploy-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
@@ -495,6 +496,9 @@ jobs:
|
||||
rm "$SPARKLE_PRIVATE_KEY_PATH"
|
||||
|
||||
echo "deployed_version=$VERSION" >> $GITHUB_OUTPUT
|
||||
UNITY_VERSION=$(grep "m_EditorVersion:" src/main/csharp/net/eagle0/clients/unity/eagle0/ProjectSettings/ProjectVersion.txt | head -1 | sed 's/m_EditorVersion: //')
|
||||
UNITY_MAJOR_MINOR=$(echo "$UNITY_VERSION" | sed -E 's/^([0-9]+)\.([0-9]+).*/\1.\2/')
|
||||
echo "deployed_unity_major_minor=$UNITY_MAJOR_MINOR" >> $GITHUB_OUTPUT
|
||||
|
||||
# Artifact cleanup is handled by the cleanup job on ubuntu-latest
|
||||
- name: Cleanup build directory
|
||||
@@ -515,7 +519,7 @@ jobs:
|
||||
curl -s -X DELETE "https://api.digitalocean.com/v2/cdn/endpoints/8c98df29-6f0c-4704-8e82-ca40a2b81aa8/cache" \
|
||||
-H "Authorization: Bearer $DO_CDN_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"files": ["mac/*", "addressables/StandaloneOSX/*"]}' \
|
||||
-d '{"files": ["mac/*", "addressables/StandaloneOSX/${{ needs.deploy-mac.outputs.deployed_unity_major_minor }}/*"]}' \
|
||||
--fail || echo "Warning: CDN purge failed (non-fatal)"
|
||||
|
||||
curl -X POST "https://admin.eagle0.net/notify-update?platform=mac&version=${{ needs.deploy-mac.outputs.deployed_version }}&required=false" \
|
||||
|
||||
@@ -20,6 +20,7 @@ on:
|
||||
- 'ci/github_actions/ensure_bazel_installed.sh'
|
||||
- 'scripts/build_eagle_ci.sh'
|
||||
- 'scripts/build_shardok_ci.sh'
|
||||
- 'scripts/build_shardok_linux_arm64_ci.sh'
|
||||
- '.github/actions/setup-bazel/**'
|
||||
- '.github/workflows/server_build.yml'
|
||||
|
||||
@@ -83,6 +84,7 @@ jobs:
|
||||
'src/main/cpp/',
|
||||
'src/main/protobuf/net/eagle0/shardok/',
|
||||
'scripts/build_shardok_ci.sh',
|
||||
'scripts/build_shardok_linux_arm64_ci.sh',
|
||||
];
|
||||
|
||||
const shared = matches(sharedPatterns);
|
||||
@@ -106,6 +108,10 @@ jobs:
|
||||
name: 'Shardok server',
|
||||
command: './scripts/build_shardok_ci.sh',
|
||||
});
|
||||
include.push({
|
||||
name: 'Shardok Linux ARM64 server',
|
||||
command: './scripts/build_shardok_linux_arm64_ci.sh',
|
||||
});
|
||||
}
|
||||
core.setOutput('build_matrix', JSON.stringify({include}));
|
||||
|
||||
|
||||
@@ -196,7 +196,9 @@ jobs:
|
||||
echo "Also tagged as: registry.digitalocean.com/eagle0/shardok-server:arm64-latest"
|
||||
|
||||
deploy-hetzner:
|
||||
runs-on: [self-hosted, bazel]
|
||||
# Keep this on a self-hosted Mac runner for IPv6 reachability to Hetzner,
|
||||
# but do not require a Bazel runner slot for artifact transport/deploy work.
|
||||
runs-on: [self-hosted, macOS, ARM64]
|
||||
needs: [build-shardok-arm64]
|
||||
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_images == 'true')
|
||||
environment: production
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
name: Shardok Sanitizer Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
paths:
|
||||
- "src/main/cpp/net/eagle0/shardok/**"
|
||||
- "src/test/cpp/net/eagle0/shardok/**"
|
||||
- "src/main/protobuf/net/eagle0/shardok/**"
|
||||
- "src/main/protobuf/net/eagle0/common/**"
|
||||
- "WORKSPACE"
|
||||
- "MODULE.bazel"
|
||||
- "MODULE.bazel.lock"
|
||||
- "BUILD.bazel"
|
||||
- ".bazelrc"
|
||||
- ".github/actions/setup-bazel/**"
|
||||
- ".github/workflows/shardok_sanitizer_test.yml"
|
||||
- "ci/github_actions/ensure_bazel_installed.sh"
|
||||
- "ci/github_actions/summarize_bazel_bep.py"
|
||||
pull_request:
|
||||
paths:
|
||||
- "src/main/cpp/net/eagle0/shardok/**"
|
||||
- "src/test/cpp/net/eagle0/shardok/**"
|
||||
- "src/main/protobuf/net/eagle0/shardok/**"
|
||||
- "src/main/protobuf/net/eagle0/common/**"
|
||||
- "WORKSPACE"
|
||||
- "MODULE.bazel"
|
||||
- "MODULE.bazel.lock"
|
||||
- "BUILD.bazel"
|
||||
- ".bazelrc"
|
||||
- ".github/actions/setup-bazel/**"
|
||||
- ".github/workflows/shardok_sanitizer_test.yml"
|
||||
- "ci/github_actions/ensure_bazel_installed.sh"
|
||||
- "ci/github_actions/summarize_bazel_bep.py"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
shardok-sanitizer-test:
|
||||
name: Shardok ${{ matrix.name }}
|
||||
runs-on: [self-hosted, bazel]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: ASan
|
||||
config: asan
|
||||
- name: UBSan
|
||||
config: ubsan
|
||||
|
||||
steps:
|
||||
- name: Ensure Git LFS available for checkout
|
||||
run: |
|
||||
COMMON_PATHS=(/opt/homebrew/bin /usr/local/bin)
|
||||
for path in "${COMMON_PATHS[@]}"; do
|
||||
if [ -d "$path" ]; then
|
||||
echo "$path" >> "$GITHUB_PATH"
|
||||
export PATH="$path:$PATH"
|
||||
fi
|
||||
done
|
||||
|
||||
if command -v git-lfs >/dev/null 2>&1; then
|
||||
git-lfs version
|
||||
exit 0
|
||||
fi
|
||||
|
||||
brew install git-lfs
|
||||
git-lfs version
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
lfs: false
|
||||
- name: Setup Bazel
|
||||
uses: ./.github/actions/setup-bazel
|
||||
- name: Run Shardok sanitizer tests
|
||||
run: bazel test --config=${{ matrix.config }} --build_event_json_file=${{ matrix.config }}.json //src/test/cpp/net/eagle0/shardok/...
|
||||
- name: Summarize Bazel build metrics
|
||||
if: always()
|
||||
run: python3 ci/github_actions/summarize_bazel_bep.py ${{ matrix.config }}.json
|
||||
- name: Archive sanitizer test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: shardok-${{ matrix.config }}.json
|
||||
path: ${{ matrix.config }}.json
|
||||
retention-days: 3
|
||||
@@ -11,6 +11,11 @@
|
||||
**NEVER kill Unity without asking the user first.** The user might be actively using the Unity Editor. Do not kill,
|
||||
force-quit, terminate, or otherwise stop Unity processes unless the user explicitly approves that specific action.
|
||||
|
||||
**NEVER change Unity's default/open scene as part of running checks.** Unity batchmode or editor validation may write
|
||||
scene-selection churn such as `ProjectSettings/EditorBuildSettings.asset`, `ProjectSettings/SceneTemplateSettings.json`,
|
||||
or scene files simply because a different scene was open or loaded. Treat those as unintended local environment changes:
|
||||
do not stage them, and restore them before committing unless the user explicitly asked to change scenes/build settings.
|
||||
|
||||
## CRITICAL GIT RULES (NEVER VIOLATE)
|
||||
|
||||
**NEVER use `git -C`.** Just run `git` directly from the cwd — it finds the repo via `.git` discovery. Do not `cd` to the repo root either (see the no-`cd` bash rule above).
|
||||
@@ -29,6 +34,16 @@ If you catch yourself about to run `git push origin main` or `git push origin <b
|
||||
|
||||
If you catch yourself about to run `gh pr merge`, STOP. Only the user merges PRs.
|
||||
|
||||
## Commit History During Review
|
||||
|
||||
Prefer new follow-up commits over amending existing commits once a PR is open and the user is actively reviewing or
|
||||
testing it. This preserves working interim states so the user can inspect, compare, or return to a known-good point
|
||||
while improvements continue.
|
||||
|
||||
Use `git commit --amend` and force-push only when the user explicitly asks for history cleanup, when fixing metadata
|
||||
before review has started, or when repairing a local commit that has not been pushed. If you believe squashing is the
|
||||
right choice despite an open review, explain why and ask first.
|
||||
|
||||
## Worktree Usage
|
||||
|
||||
Prefer using the current worktree for small requested fixes. Create a separate worktree only when the user asks for one,
|
||||
@@ -58,6 +73,15 @@ For PRs expected to trigger substantial Bazel work in CI, run the relevant Bazel
|
||||
workstation is fast, and local Bazel runs can help hydrate the remote cache for the CI builders while still giving
|
||||
earlier signal on failures.
|
||||
|
||||
## Cleanup PR Batching
|
||||
|
||||
When making mechanical cleanup changes, group 3-5 files per PR when the files are receiving the same kind of change
|
||||
and can be reviewed as one pattern. Do not open one PR per file for nearly identical few-line cleanups, such as replacing
|
||||
the same unsafe accessor pattern with the same contextual failure pattern across multiple Scala files.
|
||||
|
||||
Keep separate PRs for changes that involve different semantics, materially different risk, unrelated subsystems, or
|
||||
files whose tests/validation strategy makes them better reviewed independently.
|
||||
|
||||
## GitHub CLI PR Bodies
|
||||
|
||||
When creating or editing PR descriptions with multiline bodies, write the body to a temporary markdown file and pass it
|
||||
|
||||
+19
-1
@@ -29,6 +29,23 @@ bazel_dep(name = "rules_nodejs", version = "6.7.4")
|
||||
bazel_dep(name = "rules_pkg", version = "1.2.0")
|
||||
bazel_dep(name = "rules_shell", version = "0.8.0")
|
||||
|
||||
multiple_version_override(
|
||||
module_name = "aspect_rules_js",
|
||||
versions = [
|
||||
"2.3.8",
|
||||
"3.2.2",
|
||||
],
|
||||
)
|
||||
|
||||
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
|
||||
npm.npm_translate_lock(
|
||||
name = "eagle0pedia_npm",
|
||||
pnpm_lock = "//docs/eagle0pedia:pnpm-lock.yaml",
|
||||
run_lifecycle_hooks = False,
|
||||
update_pnpm_lock = False,
|
||||
)
|
||||
use_repo(npm, "eagle0pedia_npm")
|
||||
|
||||
#
|
||||
# Language Support - Scala
|
||||
#
|
||||
@@ -282,7 +299,7 @@ oci.pull(
|
||||
# Base image for Admin Server (Alpine for lightweight Go binary)
|
||||
oci.pull(
|
||||
name = "alpine_linux",
|
||||
digest = "sha256:a2d49ea686c2adfe3c992e47dc3b5e7fa6e6b5055609400dc2acaeb241c829f4",
|
||||
digest = "sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b",
|
||||
image = "docker.io/library/alpine",
|
||||
platforms = ["linux/amd64"],
|
||||
tag = "3.24",
|
||||
@@ -365,6 +382,7 @@ maven.install(
|
||||
"org.xerial:sqlite-jdbc:3.53.2.0",
|
||||
|
||||
# Postgres for production history benchmarking and migration work
|
||||
"com.zaxxer:HikariCP:6.3.3",
|
||||
"org.postgresql:postgresql:42.7.11",
|
||||
],
|
||||
duplicate_version_warning = "error",
|
||||
|
||||
Generated
+516
-63
File diff suppressed because one or more lines are too long
@@ -5,8 +5,7 @@ set -x
|
||||
|
||||
COMMAND_LOG="$(bazel info command_log)"
|
||||
bazel build \
|
||||
//src/main/cpp/net/eagle0/shardok:shardok-server \
|
||||
//src/main/cpp/net/eagle0/shardok:shardok-inspector
|
||||
//src/main/cpp/net/eagle0/shardok:shardok-server
|
||||
STATUS="$?"
|
||||
|
||||
if [ $STATUS -eq 0 ]
|
||||
@@ -26,7 +25,6 @@ echo "Setting up Shardok files..."
|
||||
/bin/cp -R ./bazel-bin/src/main/cpp/net/eagle0/shardok/shardok-server ./shardok/
|
||||
/bin/mkdir -p ./shardok/shardok-server.runfiles/net_eagle0/src/main/
|
||||
/bin/cp -R ./bazel-bin/src/main/cpp/net/eagle0/shardok/shardok-server.runfiles/net_eagle0/src/main/resources ./shardok/shardok-server.runfiles/net_eagle0/src/main/
|
||||
/bin/cp -R ./bazel-bin/src/main/cpp/net/eagle0/shardok/shardok-inspector ./shardok/
|
||||
|
||||
echo "tar & zip shardok files..."
|
||||
/bin/tar cfh - shardok | /usr/bin/pigz > ./deploy/shardok.tar.gz
|
||||
|
||||
@@ -40,19 +40,6 @@ if [ -f "$INFO_PLIST" ]; then
|
||||
/usr/libexec/PlistBuddy -c "Set :ITSAppUsesNonExemptEncryption false" "$INFO_PLIST" 2>/dev/null \
|
||||
|| /usr/libexec/PlistBuddy -c "Add :ITSAppUsesNonExemptEncryption bool false" "$INFO_PLIST"
|
||||
echo "Set ITSAppUsesNonExemptEncryption=false in Info.plist"
|
||||
|
||||
# Remove UIApplicationSceneManifest if present.
|
||||
# Unity 6 generates this key, which opts the app into the iOS scene-based
|
||||
# lifecycle. This breaks Application.deepLinkActivated because iOS routes
|
||||
# deep link URLs through UISceneDelegate instead of UIApplicationDelegate,
|
||||
# and Unity doesn't implement the scene delegate path.
|
||||
# See: https://issuetracker.unity3d.com/issues/in-135632
|
||||
if /usr/libexec/PlistBuddy -c "Print :UIApplicationSceneManifest" "$INFO_PLIST" 2>/dev/null; then
|
||||
echo "Found UIApplicationSceneManifest in Info.plist — removing to fix deep link handling"
|
||||
/usr/libexec/PlistBuddy -c "Delete :UIApplicationSceneManifest" "$INFO_PLIST"
|
||||
else
|
||||
echo "No UIApplicationSceneManifest in Info.plist (deep links should work)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Unity always generates "Unity-iPhone" as the main app scheme
|
||||
|
||||
@@ -13,7 +13,10 @@ set -euxo pipefail
|
||||
BUILD_TARGET=$1
|
||||
WORKSPACE=$(pwd)
|
||||
UNITY_PROJECT="$WORKSPACE/src/main/csharp/net/eagle0/clients/unity/eagle0"
|
||||
SERVER_DATA="$UNITY_PROJECT/ServerData/$BUILD_TARGET"
|
||||
UNITY_VERSION=$(grep "m_EditorVersion:" "$UNITY_PROJECT/ProjectSettings/ProjectVersion.txt" | head -1 | sed 's/m_EditorVersion: //')
|
||||
UNITY_MAJOR_MINOR=$(echo "$UNITY_VERSION" | sed -E 's/^([0-9]+)\.([0-9]+).*/\1.\2/')
|
||||
ADDRESSABLES_PREFIX="addressables/$BUILD_TARGET/$UNITY_MAJOR_MINOR"
|
||||
SERVER_DATA="$UNITY_PROJECT/ServerData/$BUILD_TARGET/$UNITY_MAJOR_MINOR"
|
||||
|
||||
# DigitalOcean Spaces configuration (same region as other eagle0 buckets)
|
||||
DO_ENDPOINT="https://sfo3.digitaloceanspaces.com"
|
||||
@@ -75,7 +78,7 @@ summarize_pending_uploads() {
|
||||
sorted_uploads_file=$(mktemp)
|
||||
trap 'rm -f "$sync_args_file" "$uploads_file" "$sorted_uploads_file"' RETURN
|
||||
|
||||
aws s3 sync "$SERVER_DATA" "s3://$DO_BUCKET/addressables/$BUILD_TARGET/" \
|
||||
aws s3 sync "$SERVER_DATA" "s3://$DO_BUCKET/$ADDRESSABLES_PREFIX/" \
|
||||
--endpoint-url "$DO_ENDPOINT" \
|
||||
--acl public-read \
|
||||
--size-only \
|
||||
@@ -178,7 +181,7 @@ if [ ! -d "$SERVER_DATA" ]; then
|
||||
fi
|
||||
|
||||
echo "Uploading Addressables bundles from $SERVER_DATA"
|
||||
echo "Target: s3://$DO_BUCKET/addressables/$BUILD_TARGET/"
|
||||
echo "Target: s3://$DO_BUCKET/$ADDRESSABLES_PREFIX/"
|
||||
|
||||
# Configure AWS CLI for DigitalOcean Spaces
|
||||
export AWS_ACCESS_KEY_ID="$ACCESS_KEY_ID"
|
||||
@@ -193,13 +196,13 @@ summarize_pending_uploads
|
||||
#
|
||||
# --delete removes files in destination that don't exist in source.
|
||||
# --acl public-read makes files publicly accessible.
|
||||
aws s3 sync "$SERVER_DATA" "s3://$DO_BUCKET/addressables/$BUILD_TARGET/" \
|
||||
aws s3 sync "$SERVER_DATA" "s3://$DO_BUCKET/$ADDRESSABLES_PREFIX/" \
|
||||
--endpoint-url "$DO_ENDPOINT" \
|
||||
--acl public-read \
|
||||
--size-only \
|
||||
--delete
|
||||
|
||||
aws s3 sync "$SERVER_DATA" "s3://$DO_BUCKET/addressables/$BUILD_TARGET/" \
|
||||
aws s3 sync "$SERVER_DATA" "s3://$DO_BUCKET/$ADDRESSABLES_PREFIX/" \
|
||||
--endpoint-url "$DO_ENDPOINT" \
|
||||
--acl public-read \
|
||||
--exclude "*" \
|
||||
@@ -208,4 +211,4 @@ aws s3 sync "$SERVER_DATA" "s3://$DO_BUCKET/addressables/$BUILD_TARGET/" \
|
||||
--include "*.json"
|
||||
|
||||
echo "Addressables upload complete"
|
||||
echo "Files available at: https://assets.eagle0.net/addressables/$BUILD_TARGET/"
|
||||
echo "Files available at: https://assets.eagle0.net/$ADDRESSABLES_PREFIX/"
|
||||
|
||||
@@ -39,6 +39,13 @@ services:
|
||||
EAGLE_POSTGRES_USER: "${EAGLE_POSTGRES_USER:-}"
|
||||
EAGLE_POSTGRES_PASSWORD: "${EAGLE_POSTGRES_PASSWORD:-}"
|
||||
EAGLE_POSTGRES_SSLMODE: "${EAGLE_POSTGRES_SSLMODE:-require}"
|
||||
EAGLE_POSTGRES_MAX_POOL_SIZE: "${EAGLE_POSTGRES_MAX_POOL_SIZE:-7}"
|
||||
EAGLE_POSTGRES_MIN_IDLE: "${EAGLE_POSTGRES_MIN_IDLE:-0}"
|
||||
EAGLE_POSTGRES_CONNECTION_TIMEOUT_MILLIS: "${EAGLE_POSTGRES_CONNECTION_TIMEOUT_MILLIS:-10000}"
|
||||
EAGLE_POSTGRES_IDLE_TIMEOUT_MILLIS: "${EAGLE_POSTGRES_IDLE_TIMEOUT_MILLIS:-120000}"
|
||||
EAGLE_POSTGRES_MAX_LIFETIME_MILLIS: "${EAGLE_POSTGRES_MAX_LIFETIME_MILLIS:-1500000}"
|
||||
EAGLE_POSTGRES_KEEPALIVE_TIME_MILLIS: "${EAGLE_POSTGRES_KEEPALIVE_TIME_MILLIS:-300000}"
|
||||
EAGLE_POSTGRES_LEAK_DETECTION_THRESHOLD_MILLIS: "${EAGLE_POSTGRES_LEAK_DETECTION_THRESHOLD_MILLIS:-60000}"
|
||||
# JWT public key for token validation (auth service handles signing)
|
||||
# Reads from /etc/eagle0/keys/public.pem via shared volume
|
||||
# Auth token for Shardok on Hetzner (required)
|
||||
@@ -95,6 +102,13 @@ services:
|
||||
EAGLE_POSTGRES_USER: "${EAGLE_POSTGRES_USER:-}"
|
||||
EAGLE_POSTGRES_PASSWORD: "${EAGLE_POSTGRES_PASSWORD:-}"
|
||||
EAGLE_POSTGRES_SSLMODE: "${EAGLE_POSTGRES_SSLMODE:-require}"
|
||||
EAGLE_POSTGRES_MAX_POOL_SIZE: "${EAGLE_POSTGRES_MAX_POOL_SIZE:-7}"
|
||||
EAGLE_POSTGRES_MIN_IDLE: "${EAGLE_POSTGRES_MIN_IDLE:-0}"
|
||||
EAGLE_POSTGRES_CONNECTION_TIMEOUT_MILLIS: "${EAGLE_POSTGRES_CONNECTION_TIMEOUT_MILLIS:-10000}"
|
||||
EAGLE_POSTGRES_IDLE_TIMEOUT_MILLIS: "${EAGLE_POSTGRES_IDLE_TIMEOUT_MILLIS:-120000}"
|
||||
EAGLE_POSTGRES_MAX_LIFETIME_MILLIS: "${EAGLE_POSTGRES_MAX_LIFETIME_MILLIS:-1500000}"
|
||||
EAGLE_POSTGRES_KEEPALIVE_TIME_MILLIS: "${EAGLE_POSTGRES_KEEPALIVE_TIME_MILLIS:-300000}"
|
||||
EAGLE_POSTGRES_LEAK_DETECTION_THRESHOLD_MILLIS: "${EAGLE_POSTGRES_LEAK_DETECTION_THRESHOLD_MILLIS:-60000}"
|
||||
# JWT public key for token validation (auth service handles signing)
|
||||
# Reads from /etc/eagle0/keys/public.pem via shared volume
|
||||
SHARDOK_AUTH_TOKEN: "${SHARDOK_AUTH_TOKEN:-}"
|
||||
|
||||
@@ -71,7 +71,7 @@ LLM settings can be changed at runtime via the admin console:
|
||||
1. Navigate to Admin Console → Settings
|
||||
2. Change `LlmProvider` to select vendor (gemini, openai, claude)
|
||||
3. Change the corresponding model name setting:
|
||||
- `GeminiModelName` (default: gemini-3.1-flash-lite-preview)
|
||||
- `GeminiModelName` (default: gemini-3.1-flash-lite)
|
||||
- `OpenAiModelName` (default: gpt-4.1-mini)
|
||||
- `ClaudeModelName` (default: claude-3-5-haiku-20241022)
|
||||
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
# Text Client Operator Guide
|
||||
|
||||
This guide covers operating the Eagle text client against a running Eagle server. It does not cover game strategy.
|
||||
|
||||
## Authentication And Startup
|
||||
|
||||
The current bearer-token file is:
|
||||
|
||||
```
|
||||
/private/tmp/eagle0-text-client-token.txt
|
||||
```
|
||||
|
||||
If that file is absent or authentication fails, stop and ask the user for a current bearer token. Do not invent a token or use another user's credentials.
|
||||
|
||||
Start the production client with:
|
||||
|
||||
```bash
|
||||
bazel run //src/main/scala/net/eagle0/eagle/text_client:eagle_text_client -- --tls --host prod.eagle0.net --port 443 --bearer-token-file /private/tmp/eagle0-text-client-token.txt
|
||||
```
|
||||
|
||||
At the `eagle0>` prompt, use `lobby` to list running games and available new-game leaders. To resume a game, use:
|
||||
|
||||
```text
|
||||
stream <game-id>
|
||||
```
|
||||
|
||||
Wait for `subscription: success=true` before posting a command.
|
||||
|
||||
## Inspecting State
|
||||
|
||||
Use these commands before acting:
|
||||
|
||||
```text
|
||||
status
|
||||
state
|
||||
commands
|
||||
commands-json
|
||||
```
|
||||
|
||||
`state` is the concise map and owned-province view. `state-json` prints the complete view. `commands-json` includes the exact fields, IDs, resource amounts, and command choices currently accepted by the server. Each entry also includes a `post-json` template for its corresponding selected command.
|
||||
|
||||
Generated text is stored locally during the client process. Use `text <text-id>` for a text ID without spaces, such as `text hn_105`. Province leaders in `state` are resolved through this store when their names have been received.
|
||||
|
||||
## Posting Eagle Commands
|
||||
|
||||
Use the available-command data from `commands-json` to select a command, then post a matching selected command:
|
||||
|
||||
```text
|
||||
post-json <province-id> <SelectedCommandType> <JSON>
|
||||
```
|
||||
|
||||
Templates contain the accepted JSON field names and default values. Replace zero
|
||||
IDs, `UNKNOWN` enum values, empty collections, and other placeholders with a legal
|
||||
choice from the available-command payload before posting. Where a selected command
|
||||
must echo server data, such as a ransom offer, the client copies that data into the
|
||||
template automatically.
|
||||
|
||||
For example:
|
||||
|
||||
```text
|
||||
post-json 13 ImproveSelectedCommand {"improvementType":"ECONOMY","actingHeroId":105,"lockType":true}
|
||||
post-rest 13
|
||||
post-feast 13
|
||||
```
|
||||
|
||||
The client has shortcuts for `post-rest`, `post-return`, `post-feast`, riot decisions, and battle aftermath. The authoritative selected-command schemas are defined in:
|
||||
|
||||
```text
|
||||
src/main/protobuf/net/eagle0/eagle/api/selected_command.proto
|
||||
```
|
||||
|
||||
Only post a selected command that is currently listed as available. A successful request prints `post-command: SUCCESS`; do not assume a command was accepted until that response or a later game update arrives.
|
||||
|
||||
Some actions enter a temporary subcommand state. For example, trading is operated as:
|
||||
|
||||
```text
|
||||
post-json <province-id> TravelSelectedCommand {}
|
||||
post-json <province-id> TradeSelectedCommand {"tradeType":"BUY_FOOD","amount":<amount>}
|
||||
post-return <province-id>
|
||||
```
|
||||
|
||||
After each step, run `commands-json` again. The server will reject a nested command, such as `TradeSelectedCommand`, if its parent state has not been entered.
|
||||
|
||||
## March Warnings
|
||||
|
||||
Marches may produce a warning before being sent. Review it, then resubmit only when intentional:
|
||||
|
||||
```text
|
||||
post-json --force <province-id> MarchSelectedCommand <JSON>
|
||||
```
|
||||
|
||||
`MarchSelectedCommand.marchingUnits` contains combat units. Each selected battalion is paired with a distinct hero in the same combat-unit entry; do not submit battalion-only entries.
|
||||
|
||||
## Shardok Battles
|
||||
|
||||
When a battle is active, inspect it with:
|
||||
|
||||
```text
|
||||
shardok-units
|
||||
shardok-commands
|
||||
```
|
||||
|
||||
Post one of the currently listed command indices with:
|
||||
|
||||
```text
|
||||
post-shardok <index>
|
||||
```
|
||||
|
||||
Omit the optional roll value during normal play. The server then generates any
|
||||
roll required by the selected command. To override that roll for deterministic
|
||||
testing, append an integer value:
|
||||
|
||||
```text
|
||||
post-shardok <index> <integer-roll>
|
||||
```
|
||||
|
||||
`roll` is a placeholder in command usage, not a literal argument. Only an
|
||||
integer is accepted, and the override has an effect only for Shardok commands
|
||||
that support a client-supplied roll.
|
||||
|
||||
For a specific active battle:
|
||||
|
||||
```text
|
||||
post-shardok <shardok-game-id> <index>
|
||||
post-shardok <shardok-game-id> <index> <integer-roll>
|
||||
```
|
||||
|
||||
The battle ID may be omitted only when exactly one outstanding battle currently
|
||||
has postable commands. If multiple battles have commands, the client refuses the
|
||||
ambiguous shorthand; use the battle ID printed by `shardok-commands`. Battles
|
||||
removed from Eagle's outstanding-battle list are no longer postable, and a
|
||||
Shardok update with no available commands clears the previous command list.
|
||||
|
||||
Use `shardok-commands-json` or `shardok-units-json` when the concise output omits a needed field.
|
||||
|
||||
## Reconnects And Shutdown
|
||||
|
||||
The client automatically recreates a failed gRPC stream and re-subscribes to the active game. It retains its in-process `ClientTextStore`, so a reconnect should announce:
|
||||
|
||||
```text
|
||||
Reconnecting to game <game-id> with saved text state.
|
||||
```
|
||||
|
||||
Followed by a successful subscription without replaying the full generated-text catalog. Do not start a second client merely because a stream reports `GOAWAY`, `UNAVAILABLE`, or `RST_STREAM`; wait for the automatic reconnect and subscription acknowledgment.
|
||||
|
||||
The text store is in memory. A newly launched process performs an initial text sync once, then retains byte offsets for reconnects during that process.
|
||||
|
||||
Use `quit` to close the client cleanly. Use `drop <game-id>` only when intentionally abandoning that game.
|
||||
@@ -0,0 +1,44 @@
|
||||
load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_run_binary")
|
||||
load("@eagle0pedia_npm//:defs.bzl", "npm_link_all_packages")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
exports_files([
|
||||
"package.json",
|
||||
"pnpm-lock.yaml",
|
||||
])
|
||||
|
||||
npm_link_all_packages()
|
||||
|
||||
filegroup(
|
||||
name = "site_sources",
|
||||
srcs = glob([
|
||||
"src/**",
|
||||
"astro.config.mjs",
|
||||
"package.json",
|
||||
"tsconfig.json",
|
||||
]),
|
||||
)
|
||||
|
||||
js_binary(
|
||||
name = "astro",
|
||||
data = [
|
||||
":node_modules",
|
||||
],
|
||||
entry_point = "tools/astro-cli.mjs",
|
||||
)
|
||||
|
||||
js_run_binary(
|
||||
name = "site",
|
||||
srcs = [
|
||||
":node_modules",
|
||||
":site_sources",
|
||||
],
|
||||
args = ["build"],
|
||||
chdir = package_name(),
|
||||
env = {
|
||||
"ASTRO_TELEMETRY_DISABLED": "1",
|
||||
},
|
||||
out_dirs = ["dist"],
|
||||
tool = ":astro",
|
||||
)
|
||||
@@ -0,0 +1,48 @@
|
||||
# Eagle0pedia Site
|
||||
|
||||
Eagle0pedia is a Starlight static site. CI validates it through Bazel, while
|
||||
DigitalOcean App Platform builds and hosts it directly as a static site.
|
||||
|
||||
## Local Build
|
||||
|
||||
```bash
|
||||
bazel build //docs/eagle0pedia:site
|
||||
```
|
||||
|
||||
The generated site is written to:
|
||||
|
||||
```text
|
||||
bazel-bin/docs/eagle0pedia/dist
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
||||
Eagle0pedia is hosted by DigitalOcean App Platform as a static site. Use these
|
||||
component settings:
|
||||
|
||||
```text
|
||||
Resource type: Static Site
|
||||
Source directory: docs/eagle0pedia
|
||||
Build command: corepack enable && pnpm install --frozen-lockfile && pnpm build
|
||||
Output directory: dist
|
||||
HTTP route: /
|
||||
Domain: pedia.eagle0.net
|
||||
```
|
||||
|
||||
The App Platform build uses the normal Starlight package scripts:
|
||||
|
||||
```text
|
||||
npm run build
|
||||
```
|
||||
|
||||
Set this App Platform environment variable:
|
||||
|
||||
```text
|
||||
ASTRO_TELEMETRY_DISABLED=1
|
||||
```
|
||||
|
||||
CI still validates the Bazel build:
|
||||
|
||||
```text
|
||||
bazel build //docs/eagle0pedia:site
|
||||
```
|
||||
@@ -0,0 +1,56 @@
|
||||
import { defineConfig } from "astro/config";
|
||||
import starlight from "@astrojs/starlight";
|
||||
|
||||
export default defineConfig({
|
||||
site: "https://pedia.eagle0.net",
|
||||
integrations: [
|
||||
starlight({
|
||||
title: "Eagle0pedia",
|
||||
description: "Reference guide for Eagle0 commands, systems, and game concepts.",
|
||||
customCss: ["./src/styles/custom.css"],
|
||||
editLink: {
|
||||
baseUrl: "https://github.com/nolen777/eagle0/edit/main/docs/eagle0pedia/src/content/docs/",
|
||||
},
|
||||
sidebar: [
|
||||
{
|
||||
label: "Reference",
|
||||
items: [
|
||||
{ label: "Eagle0pedia", slug: "" },
|
||||
{
|
||||
label: "Concepts",
|
||||
items: [
|
||||
{ label: "Game Concepts", slug: "concepts" },
|
||||
{ label: "Victory and Defeat", slug: "concepts/victory-and-defeat" },
|
||||
{ label: "Who You Command", slug: "concepts/command-authority" },
|
||||
{ label: "Eagle Round Flow", slug: "concepts/eagle-round-flow" },
|
||||
{ label: "March and Battle Timeline", slug: "concepts/march-timeline" },
|
||||
{ label: "Information and Recon", slug: "concepts/information-and-recon" },
|
||||
{ label: "From Eagle to Shardok", slug: "concepts/eagle-to-shardok" },
|
||||
{ label: "Shardok Battles", slug: "concepts/shardok-battles" },
|
||||
{ label: "Shardok Combat Fundamentals", slug: "concepts/shardok-combat" },
|
||||
{
|
||||
label: "Shardok Victory Conditions",
|
||||
slug: "concepts/shardok-victory-conditions",
|
||||
},
|
||||
],
|
||||
},
|
||||
{ label: "Eagle Commands", slug: "commands" },
|
||||
{ label: "Shardok Commands", slug: "shardok-commands" },
|
||||
{ label: "Heroes", slug: "heroes" },
|
||||
{ label: "Battalions", slug: "battalions" },
|
||||
{ label: "Factions", slug: "factions" },
|
||||
{ label: "Provinces", slug: "provinces" },
|
||||
{ label: "Integration Notes", slug: "integration" },
|
||||
],
|
||||
},
|
||||
],
|
||||
social: [
|
||||
{
|
||||
icon: "github",
|
||||
label: "GitHub",
|
||||
href: "https://github.com/nolen777/eagle0",
|
||||
},
|
||||
],
|
||||
}),
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "eagle0pedia",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@9.15.9",
|
||||
"scripts": {
|
||||
"build": "astro build",
|
||||
"dev": "astro dev",
|
||||
"preview": "astro preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/starlight": "^0.36.0",
|
||||
"astro": "^5.11.0",
|
||||
"sharp": "^0.34.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.8.0"
|
||||
},
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": []
|
||||
}
|
||||
}
|
||||
Generated
+4378
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
import { defineCollection } from "astro:content";
|
||||
import { docsSchema } from "@astrojs/starlight/schema";
|
||||
|
||||
export const collections = {
|
||||
docs: defineCollection({ schema: docsSchema() }),
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
title: Battalions
|
||||
description: Troop count, type, training, armament, morale, heroes, and the battalion lifecycle.
|
||||
---
|
||||
|
||||
Battalions are Eagle's organized troop formations and become units in [Shardok battles](/concepts/shardok-battles/) when attached to heroes.
|
||||
|
||||
## Reading a battalion
|
||||
|
||||
- **Troops** are its current soldiers. Casualties and starvation reduce this number; reaching zero destroys the battalion.
|
||||
- **Type** determines movement, damage, battlefield limits, and whether an attached hero can cast or use stealth.
|
||||
- **TRN (training)** increases the damage the battalion delivers. It is raised with [Train](/commands/#train).
|
||||
- **ARM (armament)** reduces normal damage the battalion takes. It is raised with [Arm Troops](/commands/#arm-troops) and cannot exceed the province's effective infrastructure.
|
||||
- **Morale** affects combat performance and gates many tactical actions. It changes through battle effects.
|
||||
|
||||
## How the combat factors work
|
||||
|
||||
These values do different jobs; they are not interchangeable ratings that simply add into one combat score.
|
||||
|
||||
- **Training** scales the battalion type's melee and missile damage bonuses. Higher training therefore means more damage per troop. It also affects some command-specific odds, including the chance to stun on a [Charge](/shardok-commands/#charge).
|
||||
- **Armament** scales the battalion type's resistances and reduces incoming normal damage. Each type and damage category has its own resistance profile, so the same ARM value does not protect every battalion equally. Penetrating damage bypasses this normal armament reduction. If the unit can use [Archery](/shardok-commands/#archery), armament also determines its starting volleys: currently one volley per 10 ARM, rounded down, plus any bonus from its battalion type.
|
||||
- **Morale** changes the battalion's damage swing. Most units also need at least 10 morale to use normal tactical commands.
|
||||
- **Hero vigor** is an action constraint and current energy reserve, not battalion armor. A hero-bearing unit normally needs at least 10 vigor to act, and special effects can spend or reduce it.
|
||||
- **Troop count** multiplies battalion damage: more surviving troops deliver more total battalion damage. It also determines how many soldiers remain available to absorb casualties.
|
||||
- **Battalion type** supplies the base damage, training bonus, resistance profile, armament benefit, movement costs, charge multiplier, and special capabilities.
|
||||
- **Hero stats** contribute separately. Charisma and bravery affect battalion combat swings, while a hero also contributes personal damage and enables stat- or profession-based commands.
|
||||
|
||||
Exact enemy training, armament, hero stats, or other details may be hidden. Use only the information your faction has revealed; the game does not promise that an unknown value is zero.
|
||||
|
||||
## Battalion types
|
||||
|
||||
### Light Infantry
|
||||
|
||||
The basic flexible foot formation. It is inexpensive, has the largest normal infantry capacity, can carry casting heroes, and allows [Ranger](/heroes/#ranger) stealth. Its protection gains from ARM are useful but lower than those of heavy formations.
|
||||
|
||||
### Heavy Infantry
|
||||
|
||||
Slower and more expensive to train and equip, with fewer troops per full battalion. Heavy Infantry starts with substantial physical resistance and generally gains more protection from ARM than light formations. It also delivers heavier melee damage, but cannot cast or hide.
|
||||
|
||||
### Light Cavalry
|
||||
|
||||
Fast on open terrain and especially effective when charging: its charge deals 1.2 times normal unit damage. A charge spends only the terrain-entry cost, so Light Cavalry may move or use another available command afterward when it retains AP.
|
||||
|
||||
### Heavy Cavalry
|
||||
|
||||
The most expensive normal formation, with the smallest capacity and highest food cost. It combines strong built-in resistance and armament scaling with the largest charge multiplier, 1.5. Like Light Cavalry, it can sometimes act again after charging if AP remains.
|
||||
|
||||
### Longbowmen
|
||||
|
||||
A ranged specialist that is always [archery](/shardok-commands/#archery)-capable and receives two bonus volleys in addition to those provided by ARM. It can also support casting and stealth-capable heroes. Longbow attacks include penetrating missile damage. Because penetrating damage bypasses normal armament reduction, trained Longbowmen can inflict heavy casualties even on well-armed troops. They are comparatively poorly protected by their own ARM.
|
||||
|
||||
### Undead
|
||||
|
||||
An exceptional formation created through necromantic effects rather than ordinary recruitment. Undead have high capacity, do not consume food or use normal morale, can cross ocean terrain, and are vulnerable to [Holy Wave](/shardok-commands/#holy-wave). Their combat and movement rules differ enough that they should not be evaluated like a normal recruitable battalion.
|
||||
|
||||
## Heroes and units
|
||||
|
||||
A Shardok unit normally combines one hero and one battalion. The hero supplies stats, vigor, profession commands, and special capabilities; the battalion supplies troops, type, training, armament, movement, morale, and damage profile. A profession alone may not be enough: casting requires a casting-capable battalion, and Ranger stealth requires a stealth-capable one.
|
||||
|
||||
## Creating and changing battalions
|
||||
|
||||
[**Organize Troops**](/commands/#organize-troops) creates, resizes, merges, transfers, or dismisses battalions. New troops cost gold and begin without training or armament. Transfers preserve weighted training and armament. Empty battalions are removed.
|
||||
|
||||
Use [**Train**](/commands/#train) to improve eligible battalions in the province and [**Arm Troops**](/commands/#arm-troops) while traveling to buy higher armament. Province economy and agriculture affect which types can be raised; effective infrastructure limits equipment.
|
||||
|
||||
## Movement, food, and battle
|
||||
|
||||
[March](/commands/#march) moves selected battalions with their heroes and supplies. Stationed and moving battalions consume food. A shortage spends the remaining food and can reduce battalions by up to 20 percent in one consumption event.
|
||||
|
||||
Battle results return surviving troop counts and statuses to Eagle. Battalions may survive with casualties, be destroyed, flee with their heroes, be captured/secured, or become the new garrison after conquest.
|
||||
|
||||
See [Organize Troops](/commands/#organize-troops), [Train](/commands/#train), [Arm Troops](/commands/#arm-troops), and [Shardok Battles](/concepts/shardok-battles/#units).
|
||||
@@ -0,0 +1,636 @@
|
||||
---
|
||||
title: Eagle Commands
|
||||
description: Strategic command reference for Eagle command panels.
|
||||
---
|
||||
|
||||
Eagle commands are the strategic actions a faction can take from a province command panel. The server advertises available commands with `AvailableCommand`, and the client posts the matching `SelectedCommand`.
|
||||
|
||||
Most commands belong to the province currently acting this turn. Some are reaction commands, such as resolving diplomacy offers, handling captured heroes, or choosing a battle aftermath decision.
|
||||
|
||||
<span class="command-reference-marker" aria-hidden="true"></span>
|
||||
|
||||
<!--
|
||||
Source map for numeric command details:
|
||||
- Alms: src/main/resources/net/eagle0/eagle/settings.tsv fields almsSupportIncreasePerFood=0.01, almsPaladinSupportMultiplier=4, maxAlmsFood=1000; applied in src/main/scala/net/eagle0/eagle/library/actions/impl/command/AlmsCommand.scala and src/main/scala/net/eagle0/eagle/library/actions/availability/AvailableAlmsCommandFactory.scala.
|
||||
- Feast: settings fields loyaltyGainFromFeast=10, vigorGainFromFeast=10, feastGoldCostPerHero=20; applied in src/main/scala/net/eagle0/eagle/library/actions/impl/command/FeastCommand.scala and src/main/scala/net/eagle0/eagle/library/actions/availability/AvailableFeastCommandFactory.scala.
|
||||
- Hero Gift: settings fields loyaltyIncreasePerGold=0.25 and maxGiftGold=100; applied in src/main/scala/net/eagle0/eagle/library/actions/impl/command/HeroGiftCommand.scala and src/main/scala/net/eagle0/eagle/library/actions/availability/AvailableHeroGiftCommandFactory.scala.
|
||||
- Rest: settings field restVigorGain=15; applied in src/main/scala/net/eagle0/eagle/library/actions/impl/command/RestCommand.scala.
|
||||
- Vigor costs: src/main/resources/net/eagle0/eagle/settings.tsv fields actionVigorCost=15, reconVigorCost=30, apprehendOutlawVigorCost=30, controlWeatherVigorDelta=-40, startEpidemicVigorDelta=-30, vigorGainFromFeast=10, restVigorGain=15.
|
||||
- Divine: divinable heroes are unaffiliated heroes with RecruitmentInfo.NotDivined; see src/main/scala/net/eagle0/eagle/library/actions/availability/AvailableDivineCommandsFactory.scala and src/main/scala/net/eagle0/eagle/library/actions/impl/command/DivineCommand.scala.
|
||||
- Issue Orders: order availability comes from src/main/scala/net/eagle0/eagle/library/actions/availability/AvailableIssueOrdersCommandFactory.scala; vassal order behavior comes from src/main/scala/net/eagle0/eagle/library/actions/impl/action/PerformVassalCommandsPhaseAction.scala, src/main/scala/net/eagle0/eagle/library/util/command_choice_helpers/CommandChoiceHelpers.scala, and src/main/scala/net/eagle0/eagle/library/util/command_choice_helpers/ExpandCommandSelector.scala.
|
||||
- Send Supplies: shipment scheduling comes from src/main/scala/net/eagle0/eagle/library/actions/impl/command/SendSuppliesCommand.scala; arrival comes from src/main/scala/net/eagle0/eagle/library/actions/impl/action/PerformProvinceMoveResolutionAction.scala and src/main/scala/net/eagle0/eagle/library/actions/impl/action/ShipmentArrivedAction.scala; timing/loss settings are src/main/resources/net/eagle0/eagle/settings.tsv fields turnsToResolveShipment=1 and shipSuppliesLoss=0.1.
|
||||
- Battle Aftermath Decision: availability comes from src/main/scala/net/eagle0/eagle/library/actions/availability/AvailableBattleAftermathDecisionCommandFactory.scala; selection comes from src/main/scala/net/eagle0/eagle/library/actions/impl/command/BattleAftermathDecisionCommand.scala; finalization comes from src/main/scala/net/eagle0/eagle/library/actions/impl/action/FinalizeAftermathAction.scala.
|
||||
- Manage Prisoners: availability comes from src/main/scala/net/eagle0/eagle/library/actions/availability/AvailableManagePrisonersCommandFactory.scala; option effects come from src/main/scala/net/eagle0/eagle/library/actions/impl/command/ManagePrisonersCommand.scala; prisoner move/return timing comes from src/main/scala/net/eagle0/eagle/library/actions/impl/action/EndPlayerCommandsPhaseAction.scala; settings include prisonerEscapeChance=0.01.
|
||||
- Handle Captured Hero: availability comes from src/main/scala/net/eagle0/eagle/library/actions/availability/AvailableHandleCapturedHeroCommandFactory.scala; option effects come from src/main/scala/net/eagle0/eagle/library/actions/impl/command/HandleCapturedHeroesCommand.scala; deferred aftermath effects come from src/main/scala/net/eagle0/eagle/library/actions/impl/action/EndBattleAftermathPhaseAction.scala; settings include startingLoyalty=60 and truceMonthsFromReturningLeader=12.
|
||||
-->
|
||||
|
||||
## Normal Command Phase Commands
|
||||
|
||||
Most command phase actions spend the acting province's turn.
|
||||
|
||||
### Alms
|
||||
|
||||
<b>Hero requirements:</b> None. [Paladins](/heroes/#paladin) get a bonus.
|
||||
|
||||
<b>Vigor cost:</b> 15.
|
||||
|
||||
<b>Available when:</b> the acting province has food to give and an eligible hero with enough vigor.
|
||||
|
||||
<b>Effect:</b> Give up to 1000 food from the acting province as charity. The province gains 1 [support](/provinces/#support) per 100 food, capped by the province's maximum 100 support. Paladins multiply the support gain by 4, so a Paladin gives 4 support per 100 food. The acting hero spends vigor and gains charisma XP.
|
||||
|
||||
<b>Selection:</b> choose an amount of food and the acting hero.
|
||||
|
||||
### Apprehend Outlaw
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> 30.
|
||||
|
||||
<b>Available when:</b> an [outlaw hero](/factions/#free-heroes) is present in the acting province and an eligible hero has enough vigor.
|
||||
|
||||
<b>Effect:</b> Attempt to capture the outlaw. On success, the outlaw is removed from the province's unaffiliated heroes and re-added as a prisoner with a bias against the imprisoning faction. The acting hero spends vigor, and the game creates a deferred notification/story request.
|
||||
|
||||
<b>Selection:</b> choose the outlaw, an optional battalion, and the acting hero.
|
||||
|
||||
### Control Weather
|
||||
|
||||
<b>Hero requirements:</b> [Mage](/heroes/#mage).
|
||||
|
||||
<b>Vigor cost:</b> 40.
|
||||
|
||||
<b>Available when:</b> a Mage has enough vigor and the acting province or an adjacent province has a valid weather change.
|
||||
|
||||
<b>Effect:</b> Change weather in a target province. Available options can start or end blizzards and droughts. The target province receives a deferred weather change, and the acting hero records a weather backstory event, spends or gains the configured vigor delta, and gains wisdom XP.
|
||||
|
||||
<b>Selection:</b> choose the weather control type, target province, and acting hero.
|
||||
|
||||
### Diplomacy
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> 15 from the messenger hero.
|
||||
|
||||
<b>Available when:</b> a diplomatic option is valid against another faction and an eligible messenger hero can be sent.
|
||||
|
||||
<b>Effect:</b> Send a hero to another faction with a diplomatic proposal. The target faction receives the offer at the end of the current round, after any battles this round have taken place. Truce, invitation, alliance, break-alliance, and ransom options create [incoming diplomacy offers](/factions/#incoming-diplomacy-offers) for the target faction and story-generation requests. Most diplomacy options spend gold, remove the messenger hero from the acting province, and cost the messenger vigor.
|
||||
|
||||
<b>Selection:</b> choose the diplomacy option, target faction, and sent hero.
|
||||
|
||||
### Exile Vassal
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> this province has at least one [vassal](/heroes/#vassals).
|
||||
|
||||
<b>Effect:</b> Remove the selected vassal from your faction.
|
||||
|
||||
<b>Selection:</b> choose the hero to exile.
|
||||
|
||||
### Feast
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None. This restores up to 10 vigor for each ruling-faction hero in the province.
|
||||
|
||||
<b>Gold cost:</b> 20 gold for each ruling-faction hero in the province, multiplied by the province [price index](/provinces/#price-index) and rounded up. For example, a province with 3 ruling-faction heroes and a 1.25 price index pays 75 gold.
|
||||
|
||||
<b>Available when:</b> the acting province can pay the full feast cost.
|
||||
|
||||
<b>Effect:</b> Hold a feast in the acting province. Every ruling-faction hero in the province gains up to 10 loyalty, capped at 100, and up to 10 vigor, capped by constitution. Faction leaders do not gain loyalty, but can still gain vigor. The province spends gold, the price index may change, and feast-spending quest counters can advance.
|
||||
|
||||
<b>Selection:</b> no additional choices.
|
||||
|
||||
### Hero Gift
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> the province has a non-leader hero with less than 100 LOY and gold available to give.
|
||||
|
||||
<b>Effect:</b> Send up to 100 gold as a gift to the selected hero. Loyalty gain depends on the gold amount, the recipient province's price index, and the hero's current loyalty: the base gain is 0.25 loyalty per gold, divided by price index, capped by the remaining room to 100 LOY.
|
||||
|
||||
<b>Selection:</b> choose the recipient hero and amount.
|
||||
|
||||
### Improve
|
||||
|
||||
<b>Hero requirements:</b> None. [Engineers](/heroes/#engineer) get a bonus.
|
||||
|
||||
<b>Vigor cost:</b> 15.
|
||||
|
||||
<b>Available when:</b> a hero has enough vigor and the province has an available improvement or devastation repair option.
|
||||
|
||||
<b>Effect:</b> Improve a province using one of the available improvement types. [Economy, agriculture, and infrastructure](/provinces/#development-stats) rise toward 100; [devastation](/provinces/#devastation) repair reduces all three devastation tracks. The acting hero spends vigor and gains strength/agility XP, and the improvement can optionally be locked as the province's preferred type.
|
||||
|
||||
<b>Selection:</b> choose the improvement type, acting hero, and whether to lock the type.
|
||||
|
||||
### Issue Orders
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None. This does not take your turn.
|
||||
|
||||
<b>Available when:</b> a faction leader is acting and your faction controls more than one province. This command does not take your turn.
|
||||
|
||||
<b>Effect:</b> Set [standing orders](/provinces/#province-orders) for your provinces. Orders guide vassal-ruled provinces during the [Vassal Commands phase](/concepts/eagle-round-flow/#vassal-commands); provinces led directly by faction leaders are still commanded directly. Vassals may still handle urgent problems first, such as defense, riots, severe fatigue, low support, beast suppression, loyalty management, or other immediately available crisis commands.
|
||||
|
||||
<b>Selection:</b> submit the new province orders and the new focus province, or clear the focus province.
|
||||
|
||||
#### Order Meanings
|
||||
|
||||
##### Entrust
|
||||
|
||||
Use the vassal's judgment. If the province borders an enemy, the vassal tends to act like **Mobilize**. Otherwise, the vassal tends to act like **Develop**.
|
||||
|
||||
##### Develop
|
||||
|
||||
Build up the province. The vassal may send away surplus gold and food toward your focus province, if one is set, or otherwise toward the nearest faction leader. Then it prefers **Improve** actions that raise economy, agriculture, infrastructure, or repair devastation. If nothing useful is available, the province rests.
|
||||
|
||||
##### Mobilize
|
||||
|
||||
Prepare for war. The vassal may ship excess gold and food toward your focus province, if one is set, or otherwise toward the nearest faction leader. Then it may organize troops, arm troops, improve infrastructure when it limits training, train battalions, and fall back to improvement or rest.
|
||||
|
||||
##### Expand
|
||||
|
||||
Look for growth or attack opportunities. The vassal first tries to march into neutral provinces, usually leaving enough heroes behind to keep the origin province held. If expansion is not practical, it may spread heroes among your existing provinces, attack enemies when appropriate, improve the province, or rest.
|
||||
|
||||
### March
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> 15 from each marching hero.
|
||||
|
||||
<b>Available when:</b> the acting province has movable heroes, battalions, gold, or food and at least one valid destination.
|
||||
|
||||
<b>Effect:</b> Move heroes, battalions, gold, and food from one province to another. The selected units and supplies leave the origin province immediately, each marching hero spends vigor and gains wisdom XP, and the destination receives an [incoming army](/provinces/#incoming-armies) scheduled for the next round.
|
||||
|
||||
If the destination is already ruled by your faction when the army arrives, the heroes, battalions, gold, and food enter the province during the next round's Province Move Resolution phase, before riots, vassal commands, and player commands.
|
||||
|
||||
If the destination is neutral or hostile, the army does not simply appear in the province at Province Move Resolution. It is set up as a hostile army later in that same next round, after player commands. A neutral province can then be taken in the Uncontested Conquest phase; a defended province can lead into attack, defense, battle request, and battle resolution phases. Until one of those outcomes resolves, the marching heroes are still in the moving army rather than ruling the destination.
|
||||
|
||||
<!-- Sources:
|
||||
- March scheduling: src/main/scala/net/eagle0/eagle/library/actions/impl/command/MarchCommand.scala
|
||||
- Friendly arrival timing: src/main/scala/net/eagle0/eagle/library/actions/impl/action/PerformProvinceMoveResolutionAction.scala
|
||||
- Hostile setup and neutral conquest timing:
|
||||
src/main/scala/net/eagle0/eagle/library/actions/impl/action/PerformHostileArmySetupAction.scala
|
||||
src/main/scala/net/eagle0/eagle/library/actions/impl/action/PerformUncontestedConquestAction.scala
|
||||
- Phase order: src/main/scala/net/eagle0/eagle/model/state/RoundPhase.scala
|
||||
-->
|
||||
|
||||
<b>Selection:</b> choose origin, destination, gold, food, and marching units.
|
||||
|
||||
### Organize Troops
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> the acting province has battalions to manage, troops to reorganize, or gold to raise new troops.
|
||||
|
||||
<b>Effect:</b> Create, resize, merge, transfer, or dismiss battalions in the acting province. New troops cost gold and enter with no training or armament, while transferred troops preserve weighted training and armament. Empty battalions are destroyed, new battalions get generated names and initial backstory requests, and the province price index may change from the gold spend.
|
||||
|
||||
<b>Selection:</b> submit changed battalions and new battalions, including troop movements and new troop counts.
|
||||
|
||||
### Recon
|
||||
|
||||
<b>Hero requirements:</b> [Ranger](/heroes/#ranger).
|
||||
|
||||
<b>Vigor cost:</b> 30.
|
||||
|
||||
<b>Available when:</b> a Ranger has enough vigor and there is a valid target province to scout.
|
||||
|
||||
<b>Effect:</b> Send a hero to scout another province.
|
||||
|
||||
<b>Selection:</b> choose the acting hero and target province.
|
||||
|
||||
### Rest
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None. This restores up to 15 vigor for each ruling-faction hero in the province.
|
||||
|
||||
<b>Available when:</b> the acting province can spend its turn resting.
|
||||
|
||||
<b>Effect:</b> Have the acting province rest for the turn. Faction heroes in the province regain up to 15 vigor, capped by constitution, and rest-related quest counters can advance.
|
||||
|
||||
<b>Selection:</b> no additional choices.
|
||||
|
||||
### Send Supplies
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> 15.
|
||||
|
||||
<b>Available when:</b> the acting province has supplies to send, an eligible hero, and a valid destination province.
|
||||
|
||||
<b>Effect:</b> Send gold and food from the acting province to another province. The origin province loses the full selected amount immediately, and the destination receives an [incoming shipment](/provinces/#incoming-shipments) scheduled for the next round.
|
||||
|
||||
Shipments arrive during the next round's Province Move Resolution phase, before riots, hero departures, vassal commands, player commands, battles, and food consumption. That means food shipped this way is available to feed the destination province later in the same round it arrives. When the shipment arrives, 10% is lost in transit and the destination receives the remaining gold and food, rounded down.
|
||||
|
||||
<b>Selection:</b> choose gold, food, acting hero, and destination province.
|
||||
|
||||
### Start Epidemic
|
||||
|
||||
<b>Hero requirements:</b> [Necromancer](/heroes/#necromancer).
|
||||
|
||||
<b>Vigor cost:</b> 30.
|
||||
|
||||
<b>Available when:</b> a Necromancer has enough vigor and the acting province or an adjacent province can receive an epidemic.
|
||||
|
||||
<b>Effect:</b> Start an epidemic in the target province.
|
||||
|
||||
<b>Selection:</b> choose the target province and acting hero.
|
||||
|
||||
### Suppress Beasts
|
||||
|
||||
<b>Hero requirements:</b> None. Heroes with any profession get a power bonus.
|
||||
|
||||
<b>Vigor cost:</b> 15 on success, plus any vigor lost to casualties. If the hero is killed, the command fails.
|
||||
|
||||
<b>Available when:</b> the acting province has a [beast event](/provinces/#province-events) and an eligible hero.
|
||||
|
||||
<b>Effect:</b> Send a hero, optionally with a battalion, to suppress beasts in the acting province. The fight rolls beast power, applies casualties to the battalion and/or hero, removes the beast event on success or failure, and creates a story notification. Success can award gold, food, support, hero XP, and battalion backstory; failure can kill the hero and destroy the battalion.
|
||||
|
||||
<b>Selection:</b> choose the hero and optional battalion.
|
||||
|
||||
### Swear Kinship
|
||||
|
||||
<b>Hero requirements:</b> The target hero must have at least 95 loyalty.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> the faction head is in the province, your faction has fewer than 5 faction leaders, and another hero in the province has at least 95 loyalty.
|
||||
|
||||
<b>Effect:</b> Choose a hero for a kinship bond. A hero who swears kinship becomes a [faction leader](/heroes/#faction-leaders).
|
||||
|
||||
<b>Selection:</b> choose the hero to swear kinship with.
|
||||
|
||||
### Train
|
||||
|
||||
<b>Hero requirements:</b> None. [Champions](/heroes/#champion) get a bonus.
|
||||
|
||||
<b>Vigor cost:</b> 15.
|
||||
|
||||
<b>Available when:</b> a hero has enough vigor and the province has at least one battalion with less than 100 TRN.
|
||||
|
||||
<b>Effect:</b> Raise the TRN of all trainable battalions in the province. The more troops are present, the lower the amount raised. The acting hero spends vigor and gains charisma, strength, and agility XP.
|
||||
|
||||
<b>Selection:</b> choose the acting hero.
|
||||
|
||||
### Travel
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> 15.
|
||||
|
||||
<b>Available when:</b> the acting province can enter the traveling command state.
|
||||
|
||||
<b>Effect:</b> Unlock the traveling commands below. Once you are traveling, you can use as many traveling commands as you want in the same round before using Return to come back to camp.
|
||||
|
||||
<b>Selection:</b> no additional choices.
|
||||
|
||||
## Traveling Commands
|
||||
|
||||
You must use Travel before these commands appear. Once you are traveling, you can use as many traveling commands as you want in one round before using Return to come back to camp.
|
||||
|
||||
### Arm Troops
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> you are traveling, the province has gold, and at least one battalion can raise ARM without exceeding effective infrastructure.
|
||||
|
||||
<b>Effect:</b> Spend gold to raise armament on existing battalions. New armament must be higher than the battalion's current armament and cannot exceed the province's effective infrastructure. The province spends gold, the price index may change, and each armed battalion records a backstory event.
|
||||
|
||||
<b>Selection:</b> choose the battalions to arm and how much armament each receives.
|
||||
|
||||
### Decline Quest
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> you are traveling and an [unaffiliated hero](/heroes/#unaffiliated-heroes) quest is available in the province.
|
||||
|
||||
<b>Effect:</b> Decline one of the unaffiliated hero quests available in the acting province.
|
||||
|
||||
<b>Selection:</b> choose the hero whose quest should be declined.
|
||||
|
||||
### Divine
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Gold cost:</b> 100 gold per selected hero, multiplied by the province [price index](/provinces/#price-index) and rounded to the nearest whole gold for each hero. The total cost is that per-hero cost multiplied by the number of selected heroes. For example, divining 3 heroes at a 1.25 price index costs 375 gold.
|
||||
|
||||
<b>Available when:</b> you are traveling, the province can pay the cost for at least one hero, and there are free heroes who are not yet ready to join your faction but might be won over.
|
||||
|
||||
<b>Effect:</b> Spend gold to divine one or more [free heroes](/factions/#free-heroes). For each divined hero, you receive details about what could impress them enough to become recruitable. Fulfill that ask, and the hero can later appear under Recruit Heroes. The province spends gold, and the price index may change.
|
||||
|
||||
<b>Selection:</b> choose the heroes to divine.
|
||||
|
||||
### Manage Prisoners
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> you are traveling and the province has prisoner heroes with available management options.
|
||||
|
||||
<b>Effect:</b> Choose what happens to ordinary prisoners in the province. These are heroes who are already in the prisoner state, not newly captured heroes still waiting for a battle aftermath decision.
|
||||
|
||||
<b>Selection:</b> choose the prisoner and management option.
|
||||
|
||||
#### Options
|
||||
|
||||
##### Execute
|
||||
|
||||
<b>Effect:</b> Kill the prisoner and remove them from the game.
|
||||
|
||||
##### Exile
|
||||
|
||||
<b>Available when:</b> the prisoner is not a faction leader.
|
||||
|
||||
<b>Effect:</b> Turn the prisoner into an outlaw in the same province.
|
||||
|
||||
##### Release
|
||||
|
||||
<b>Available when:</b> the prisoner is not a faction leader.
|
||||
|
||||
<b>Effect:</b> Release the prisoner as a traveler in the same province. Released prisoners are no longer in your custody, but they do not automatically join another faction.
|
||||
|
||||
##### Move
|
||||
|
||||
<b>Available when:</b> you control an adjacent province.
|
||||
|
||||
<b>Effect:</b> Send the prisoner to one adjacent province ruled by your faction. The prisoner leaves the origin province now and arrives at the destination at the end of the Player Commands phase. There is a 1% chance the prisoner escapes during the move; if that happens, they become an outlaw in the destination province instead of remaining a prisoner.
|
||||
|
||||
##### Return
|
||||
|
||||
<b>Available when:</b> the prisoner is a faction leader and their faction still controls at least one province.
|
||||
|
||||
<b>Effect:</b> Return the prisoner to their faction. They leave your custody now and rejoin their faction at the end of the Player Commands phase as a ruling hero in one of that faction's provinces.
|
||||
|
||||
Ordinary prisoners cannot be returned this way. Faction leader prisoners cannot be released or exiled, but they can be executed, moved within your territory, or returned if their faction still exists.
|
||||
|
||||
### Recruit Heroes
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> you are traveling and unaffiliated heroes in the province are willing to join.
|
||||
|
||||
<b>Effect:</b> Recruit available unaffiliated heroes in the acting province. Recruited heroes join the faction at starting loyalty, move from the province's unaffiliated hero list into its ruling faction heroes, and receive a recruitment backstory event.
|
||||
|
||||
<b>Selection:</b> choose the heroes to recruit.
|
||||
|
||||
### Return
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> you are traveling.
|
||||
|
||||
<b>Effect:</b> Return from the traveling command state to the normal strategic flow.
|
||||
|
||||
<b>Selection:</b> no additional choices.
|
||||
|
||||
### Trade
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> you are traveling and the province has enough gold or food for at least one trade.
|
||||
|
||||
<b>Effect:</b> Buy or sell food using the acting province's gold and food stores. Food buy and sell prices are based on the province price index. Buying spends gold and adds food; selling removes food and adds gold. The price index may change after the trade.
|
||||
|
||||
<b>Selection:</b> choose buy or sell and the amount of food.
|
||||
|
||||
## Special and Conditional Commands
|
||||
|
||||
These commands appear only when the game is resolving a special situation, response, or pending decision.
|
||||
|
||||
### Attack Decision
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> an attack decision is pending.
|
||||
|
||||
<b>Effect:</b> Choose how to respond to a pending attack opportunity or battle decision. The command shows involved armies, acting units, and the available attack decision types. See [Attack and Defense Decisions](/concepts/eagle-to-shardok/#attack-and-defense-decisions) for how this fits into battle creation.
|
||||
|
||||
<b>Selection:</b> choose one available attack decision.
|
||||
|
||||
### Defend
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> a province is under attack and can commit defenders.
|
||||
|
||||
<b>Effect:</b> Respond to an incoming attack by committing a defending army. The selected defenders become the province's defending army. If flee provinces are available, one must be selected as the army's fallback destination. See [Attack and Defense Decisions](/concepts/eagle-to-shardok/#attack-and-defense-decisions) for what happens next.
|
||||
|
||||
<b>Selection:</b> choose defending units and, when available, an optional flee province.
|
||||
|
||||
### Handle Captured Hero
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> a newly captured hero needs a battle aftermath decision.
|
||||
|
||||
<b>Effect:</b> Decide what happens to a hero captured during [battle aftermath](/concepts/eagle-to-shardok/#aftermath) or conquest. Captured heroes are not yet ordinary prisoners. If you imprison one, they become a normal prisoner and can later be handled with Manage Prisoners.
|
||||
|
||||
<b>Selection:</b> choose the captured hero and the handling option.
|
||||
|
||||
#### Options
|
||||
|
||||
##### Recruit
|
||||
|
||||
<b>Available when:</b> the captured hero is not a faction leader, has not already refused recruitment, and is not someone who will never join your faction.
|
||||
|
||||
<b>Effect:</b> Try to persuade the captured hero to join you immediately. The chance depends on your faction head, your faction's prestige, and the captured hero. On success, the hero joins your faction in the captured province with 60 loyalty. On failure, the hero refuses; you cannot try to recruit that captured hero again from this aftermath decision and must choose another option.
|
||||
|
||||
##### Imprison
|
||||
|
||||
<b>Effect:</b> Keep the hero as a prisoner in the captured province. This converts them into an ordinary prisoner when the aftermath resolves.
|
||||
|
||||
##### Exile
|
||||
|
||||
<b>Available when:</b> the captured hero is not a faction leader whose faction still controls a province.
|
||||
|
||||
<b>Effect:</b> Cast the hero out as an outlaw in the captured province when the aftermath resolves.
|
||||
|
||||
##### Execute
|
||||
|
||||
<b>Effect:</b> Kill the captured hero and remove them from the game when the aftermath resolves.
|
||||
|
||||
##### Return
|
||||
|
||||
<b>Available when:</b> the captured hero is a faction leader and their faction still controls at least one province.
|
||||
|
||||
<b>Effect:</b> Return the captured faction leader to the closest province ruled by their old faction when the aftermath resolves. Returning a captured leader creates a 12-month truce between your faction and theirs.
|
||||
|
||||
### Handle Riot
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> Depends on the option. Crack Down can cost vigor; Give and Do Nothing do not.
|
||||
|
||||
<b>Available when:</b> a province has a riot.
|
||||
|
||||
<b>Effect:</b> Respond to a [riot](/provinces/#province-events) in the acting province. The client presents this as one command with multiple response options. The [province leader](/provinces/#ruling-faction-and-ruling-hero)'s Charisma matters, even if a different hero is selected to crack down: leader Charisma improves gift success and makes forceful crackdowns face smaller riots.
|
||||
|
||||
If you fail to stop the riot, or if the riot is still unresolved when the riot phase ends, the riot happens. The province loses 25 support, gains 25 economy devastation, gains 25 infrastructure devastation, and the riot event is removed.
|
||||
|
||||
<!-- Sources:
|
||||
- Riot options: src/main/scala/net/eagle0/eagle/library/actions/impl/command/HandleRiotGiveCommand.scala
|
||||
src/main/scala/net/eagle0/eagle/library/actions/impl/command/HandleRiotCrackDownCommand.scala
|
||||
src/main/scala/net/eagle0/eagle/library/actions/impl/command/HandleRiotDoNothingCommand.scala
|
||||
- Riot consequences: src/main/scala/net/eagle0/eagle/library/actions/impl/command/HandleRiotUtils.scala
|
||||
- Riot settings: src/main/scala/net/eagle0/eagle/library/settings/BUILD.bazel
|
||||
-->
|
||||
|
||||
#### Options
|
||||
|
||||
##### Crack Down
|
||||
|
||||
<b>Vigor cost:</b> 15 on success, plus any vigor lost to casualties. If the hero is killed, the command fails.
|
||||
|
||||
<b>Effect:</b> Try to suppress the riot by force using a hero and optionally a battalion. The riot size is random from 100 to 1500, but the province leader's Charisma, not the selected acting hero's Charisma, reduces the roll before the size is calculated. Higher leader Charisma therefore makes the riot smaller and easier to defeat.
|
||||
|
||||
Casualties are based on riot size against the power of the acting hero and any attached battalion. If a battalion is used, casualties hit the battalion first; the battalion can be destroyed, and excess casualties can injure or kill the acting hero. If no battalion is used, casualties hit the acting hero directly.
|
||||
|
||||
Crack Down succeeds if the acting hero survives. On success, the riot event is removed and the acting hero spends 15 vigor, gains Strength and Agility XP, and may take additional vigor damage from casualties. If a battalion helped and survived, its size is reduced by its casualties. A successful crackdown does not directly reduce support, add devastation, or change loyalty; the cost is the violence itself.
|
||||
|
||||
Crack Down fails if the acting hero is killed. A failed crackdown does not stop the riot; the riot will still occur and apply the normal riot damage.
|
||||
|
||||
<b>Selection:</b> choose the acting hero and an optional battalion.
|
||||
|
||||
##### Do Nothing
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Effect:</b> Let the riot proceed without intervention. The riot will occur, causing the normal riot damage: -25 support, +25 economy devastation, and +25 infrastructure devastation.
|
||||
|
||||
<b>Selection:</b> no additional choices.
|
||||
|
||||
##### Give
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Effect:</b> Offer either food or gold to address the riot. You cannot combine food and gold in the same response. The maximum useful gift is 1000 food or 500 gold, and the selected amount is spent whether the attempt succeeds or fails.
|
||||
|
||||
Gift success is probabilistic. The chance is based on the province leader's Charisma plus the fraction of the maximum gift you gave: larger gifts help, and more leader Charisma helps. A partial gift can fail. On success, the riot event is removed. On failure, the gift is still spent and the riot will still occur.
|
||||
|
||||
<b>Selection:</b> choose a food amount or a gold amount.
|
||||
|
||||
### Please Recruit Me
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> unaffiliated heroes ask to join.
|
||||
|
||||
<b>Effect:</b> Respond to unaffiliated heroes who are asking to join a province.
|
||||
|
||||
<b>Selection:</b> choose the province, hero, and whether to accept.
|
||||
|
||||
### Resolve Alliance Offer
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> another faction offers an alliance.
|
||||
|
||||
<b>Effect:</b> Accept or reject an [incoming alliance offer](/factions/#incoming-diplomacy-offers).
|
||||
|
||||
<b>Selection:</b> choose the originating faction and the resolution.
|
||||
|
||||
### Resolve Break Alliance
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> another faction tries to break an alliance.
|
||||
|
||||
<b>Effect:</b> Respond to a faction attempting to break an alliance.
|
||||
|
||||
<b>Selection:</b> choose the originating faction and the resolution.
|
||||
|
||||
### Resolve Invitation
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> another faction sends an invitation.
|
||||
|
||||
<b>Effect:</b> Accept or reject an invitation from another faction.
|
||||
|
||||
<b>Selection:</b> choose the originating faction and the resolution.
|
||||
|
||||
### Resolve Ransom Offer
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> another faction makes a ransom offer.
|
||||
|
||||
<b>Effect:</b> Accept or reject an incoming ransom offer.
|
||||
|
||||
<b>Selection:</b> choose the offering faction, the ransom offer, and the resolution.
|
||||
|
||||
### Resolve Truce Offer
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> another faction offers a truce.
|
||||
|
||||
<b>Effect:</b> Accept or reject an incoming truce offer.
|
||||
|
||||
<b>Selection:</b> choose the originating faction and the resolution.
|
||||
|
||||
### Resolve Tribute
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> another faction demands tribute.
|
||||
|
||||
<b>Effect:</b> Decide whether to pay demanded tribute. The command shows the demanding factions, requested tribute, their rough strength, and the acting province's available food and gold.
|
||||
|
||||
<b>Selection:</b> choose the demanding faction and whether tribute is paid.
|
||||
|
||||
### Battle Aftermath Decision
|
||||
|
||||
<b>Hero requirements:</b> None.
|
||||
|
||||
<b>Vigor cost:</b> None.
|
||||
|
||||
<b>Available when:</b> multiple allied attacking factions won the same province and Eagle needs to decide which claimant keeps it.
|
||||
|
||||
<b>Effect:</b> Decide what your surviving claimant army does during [battle aftermath](/concepts/eagle-to-shardok/#aftermath) after a shared victory. If no ally has claimed the province yet, you may choose **Keep Province** and become the conqueror. If an ally has already claimed it, you must withdraw.
|
||||
|
||||
Keeping the province finalizes conquest: your surviving non-fled heroes become the new ruling heroes, surviving battalions become the province battalions, support is reset to 0, province orders reset to **Entrust**, and non-fled defenders or former ruling heroes can become prisoners.
|
||||
|
||||
Withdrawing sends your surviving units to an adjacent province as a moving army. You may take up to the gold and food your claimant army brought into the battle. The withdrawal army arrives next round and does not use the normal Send Supplies transit loss.
|
||||
|
||||
<b>Selection:</b> choose whether to keep the province or withdraw. If withdrawing, choose destination province and supplies to take.
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
title: Who You Command
|
||||
description: Faction leaders, vassals, province turns, and direct control.
|
||||
---
|
||||
|
||||
Eagle commands are issued through provinces, but who chooses a province's action depends on its ruling hero. The key distinction is between **faction leaders**, whom the player commands directly, and **vassals**, who govern automatically.
|
||||
|
||||
## Leadership roles
|
||||
|
||||
| Role | Directly commanded? | Main purpose |
|
||||
| --- | --- | --- |
|
||||
| Faction head | Yes | Defines the faction and provides its original leadership |
|
||||
| Other faction leader | Yes | Gives the player another directly controlled leader and a successor |
|
||||
| Vassal | No | Rules a province according to standing orders and local needs |
|
||||
| Unaffiliated hero | No | May be recruited, divined, apprehended, or otherwise interacted with |
|
||||
|
||||
The faction head is also a faction leader. **Swear Kinship** can promote a loyal faction hero into an additional faction leader. A faction leader who rules a province lets the player choose that province's normal command directly.
|
||||
|
||||
## Province turns
|
||||
|
||||
Most strategic actions belong to the province currently acting. During **Player Commands**, provinces led by faction leaders present their available commands to the player. A normal command such as Train, Improve, March, or Rest spends that province's turn.
|
||||
|
||||
The hero selected for a command is its actor, but selecting a different hero does not create another province turn. Several heroes may be eligible to perform the same province action; the player chooses which hero pays vigor and receives the associated experience.
|
||||
|
||||
Some commands explicitly do not take the turn. For example, **Issue Orders** changes standing instructions without consuming the acting province's normal action. The command reference labels these exceptions.
|
||||
|
||||
## Vassal-led provinces
|
||||
|
||||
A vassal-led province acts during **Vassal Commands**, before the main Player Commands phase. The vassal chooses an action using:
|
||||
|
||||
- the province's standing order: Entrust, Develop, Mobilize, or Expand;
|
||||
- the faction's focus province;
|
||||
- urgent local needs such as defense, riots, fatigue, low support, or beasts; and
|
||||
- the commands actually available in the province.
|
||||
|
||||
Standing orders guide a vassal; they do not guarantee one exact command. A vassal may address a crisis before following a long-term development or expansion preference.
|
||||
|
||||
## Multiple leaders and provinces
|
||||
|
||||
Gaining more faction leaders does not give one province several normal actions. It expands direct control:
|
||||
|
||||
- A leader can directly rule a province instead of leaving it to a vassal.
|
||||
- Leaders in different provinces can make those provinces player-controlled.
|
||||
- Leaders provide succession if the faction head dies.
|
||||
|
||||
Heroes who are present but do not rule the province can still be selected for eligible commands. Province leadership determines who chooses the action, not which local hero must perform it.
|
||||
|
||||
## A simple example
|
||||
|
||||
Suppose your faction controls three provinces:
|
||||
|
||||
1. Your faction head rules the capital. You choose its action during Player Commands.
|
||||
2. A second faction leader rules the frontier. You choose that province's action too.
|
||||
3. A vassal rules a farming province with Develop orders. The vassal chooses its own action during Vassal Commands.
|
||||
|
||||
The result is two direct player decisions and one automatic vassal decision, assuming no riot, diplomacy offer, battle decision, or other special phase adds another required choice.
|
||||
|
||||
## Special decisions
|
||||
|
||||
Attack decisions, defense decisions, diplomacy responses, prisoner handling, riots, and battle aftermath are conditional decisions rather than extra normal province turns. They appear only when the current game state requires them and can pause the shared phase until every required faction responds.
|
||||
|
||||
See [Eagle Round Flow](/concepts/eagle-round-flow/) for phase timing and [Eagle Commands](/commands/) for which actions consume a turn.
|
||||
@@ -0,0 +1,189 @@
|
||||
---
|
||||
title: Eagle Round Flow
|
||||
description: How Eagle strategic rounds advance, including simultaneous player action.
|
||||
---
|
||||
|
||||
<!--
|
||||
Source map:
|
||||
- Phase enum: src/main/protobuf/net/eagle0/eagle/common/round_phase.proto.
|
||||
- Phase advancement: src/main/scala/net/eagle0/eagle/library/RoundPhaseAdvancer.scala.
|
||||
- Command availability by phase: src/main/scala/net/eagle0/eagle/library/actions/availability/AvailableCommandsFactory.scala.
|
||||
- Result visibility/filtering: src/main/scala/net/eagle0/eagle/library/ActionResultFilter.scala and src/main/scala/net/eagle0/eagle/library/util/view_filters/.
|
||||
-->
|
||||
|
||||
Eagle is a simultaneous-turn strategy game. During a phase, every faction gets the chance to act in parallel. The game does not fully resolve the phase just because one player chooses a command; it waits until every required player choice has been made, then advances the phase and reveals the results each faction is allowed to know.
|
||||
|
||||
That means two things matter:
|
||||
|
||||
- Your orders are not a private single-player timeline. Other factions may be choosing their own commands at the same time.
|
||||
- You do not automatically see every action in the world. You see your faction's results, your allies' visible results, and information your faction has earned through scouting, battle revelations, diplomacy, or province control.
|
||||
|
||||
## Round Shape
|
||||
|
||||
Most rounds follow this broad rhythm:
|
||||
|
||||
1. Upkeep and automatic world changes happen.
|
||||
2. Vassals and players issue strategic commands.
|
||||
3. Marching armies arrive, attacks are decided, and battles are requested.
|
||||
4. Shardok battles resolve outside the strategic map.
|
||||
5. Eagle applies battle results, aftermath choices, diplomacy, recon, and end-of-round changes.
|
||||
|
||||
Some phases are player-facing. Others are bookkeeping phases that advance automatically unless a special decision is needed.
|
||||
|
||||
## One Round Is One Month
|
||||
|
||||
The strategic date advances once per complete Eagle round, not once per command. A
|
||||
command submitted during Player Commands belongs to the current month's round. The
|
||||
server then continues through the remaining phases and starts the next round, whose
|
||||
New Round processing advances the date by one month.
|
||||
|
||||
In a one-player game, the automatic phases may finish so quickly that it looks as
|
||||
though the command itself advanced the month. If a decision or battle is pending,
|
||||
the game remains in the same round and month until that work is complete.
|
||||
|
||||
## Phase Diagram
|
||||
|
||||
This diagram groups the detailed phases into their player-visible states:
|
||||
|
||||
```text
|
||||
New Round and upkeep
|
||||
|
|
||||
v
|
||||
Province movement and events
|
||||
|
|
||||
+----> Riot or recruitment decision? ----> wait for commands
|
||||
|
|
||||
v
|
||||
Vassal Commands -> Player Commands --------------> wait for every required faction
|
||||
|
|
||||
v
|
||||
Conquest setup -> Attack Decision -> Defense Decision
|
||||
|
|
||||
v
|
||||
Battle Request and food use
|
||||
|
|
||||
v
|
||||
Battle Resolution ----------> wait for all Shardok battles
|
||||
|
|
||||
v
|
||||
Battle Aftermath -----------> wait for pending choices
|
||||
|
|
||||
v
|
||||
Diplomacy Resolution -------> wait for pending replies
|
||||
|
|
||||
v
|
||||
Recon Resolution
|
||||
|
|
||||
+-----------------> next month's New Round
|
||||
```
|
||||
|
||||
"Wait" means the phase does not advance yet. The server may be waiting for your
|
||||
choice, another faction's choice, or an external Shardok battle result.
|
||||
|
||||
## Automatic Upkeep
|
||||
|
||||
These phases usually advance without direct player input:
|
||||
|
||||
### New Round
|
||||
|
||||
The game starts a new strategic round. Provinces, heroes, factions, and long-running state are updated for the new date.
|
||||
|
||||
### Prisoner Exchange
|
||||
|
||||
The game resolves automatic prisoner exchange state.
|
||||
|
||||
### Province Events
|
||||
|
||||
Province events such as local problems or opportunities are processed.
|
||||
|
||||
### Forced Turn Back
|
||||
|
||||
Armies that must turn back do so before normal movement resolution.
|
||||
|
||||
### Province Move Resolution
|
||||
|
||||
Moving armies arrive at their destinations, supplies move, and incoming hostile groups are created where armies meet resistance.
|
||||
|
||||
### Hero Departures
|
||||
|
||||
Heroes who are ready to leave unaffiliated states or temporary situations may depart.
|
||||
|
||||
### Unaffiliated Hero Actions
|
||||
|
||||
Unaffiliated heroes may move, appear, escape, or otherwise act without belonging to a faction.
|
||||
|
||||
### Hostile Army Setup
|
||||
|
||||
The game prepares hostile army groups before conquest or battle decisions.
|
||||
|
||||
### Uncontested Conquest
|
||||
|
||||
If an attacker reaches a province with no defending force, the conquest can resolve without a Shardok battle.
|
||||
|
||||
### Truce Turn Back
|
||||
|
||||
Armies affected by truces may turn back instead of fighting.
|
||||
|
||||
### Battle Request
|
||||
|
||||
Eagle creates Shardok battles for provinces where attackers and defenders must fight.
|
||||
|
||||
### Food Consumption
|
||||
|
||||
Armies consume food before or around battle handling.
|
||||
|
||||
### Battle Resolution
|
||||
|
||||
Eagle waits for outstanding Shardok battles to report results. If there are none, the phase advances automatically.
|
||||
|
||||
### Recon Resolution
|
||||
|
||||
Recon results are applied after the relevant strategic activity has completed.
|
||||
|
||||
## Player Decision Phases
|
||||
|
||||
These phases can pause until required players have submitted decisions.
|
||||
|
||||
### Handle Riot
|
||||
|
||||
If your province has a riot, you may need to decide how to respond before the round can continue.
|
||||
|
||||
### Please Recruit Me
|
||||
|
||||
Some unaffiliated heroes may ask to join a faction. The phase waits while available recruitment decisions remain.
|
||||
|
||||
### Vassal Commands
|
||||
|
||||
Vassals choose province actions for provinces they rule. Vassals lead provinces and make their own choices, so these commands can happen before the direct player command phase.
|
||||
|
||||
### Player Commands
|
||||
|
||||
This is the main strategic command phase. Each player acts for provinces and heroes they can command directly. Every player is acting within the same phase, so your command is submitted into a shared strategic moment rather than immediately revealing a global timeline.
|
||||
|
||||
See [Eagle commands](/commands/) for the command reference.
|
||||
|
||||
### Attack Decision
|
||||
|
||||
When an army reaches a hostile province, the attacking side may need to choose whether to attack.
|
||||
|
||||
### Defense Decision
|
||||
|
||||
The defending side may need to decide how to respond to an incoming attack.
|
||||
|
||||
### Battle Aftermath
|
||||
|
||||
After Shardok results return to Eagle, winners may need to decide what happens to conquered provinces, captured heroes, or multiple allied claimants.
|
||||
|
||||
### Diplomacy Resolution
|
||||
|
||||
Diplomatic offers are resolved after players choose how to answer them. Offers can be accepted, rejected, invalidated, or lead to consequences such as imprisonment.
|
||||
|
||||
## Simultaneous Information
|
||||
|
||||
For a focused explanation of public, hidden, and potentially stale observations, see [Information and Recon](/concepts/information-and-recon/).
|
||||
|
||||
The important habit is to think in phases, not in a fully visible turn order.
|
||||
|
||||
If two factions both issue orders during Player Commands, those orders belong to the same command phase. When the phase ends, each faction receives the filtered results it is allowed to observe. Your own actions are visible to you. Allied and nearby events may be visible depending on game state. Enemy actions may be hidden until scouts, battles, diplomacy, or later consequences reveal them.
|
||||
|
||||
This is why Eagle often feels less like "I move, then you move" and more like issuing orders into a living world, then discovering what happened.
|
||||
@@ -0,0 +1,135 @@
|
||||
---
|
||||
title: From Eagle to Shardok
|
||||
description: How strategic Eagle armies become tactical Shardok battles.
|
||||
---
|
||||
|
||||
<!--
|
||||
Source map:
|
||||
- Movement resolution: src/main/scala/net/eagle0/eagle/library/actions/impl/action/PerformProvinceMoveResolutionAction.scala.
|
||||
- Battle setup phase: src/main/scala/net/eagle0/eagle/library/actions/impl/action/PerformHostileArmySetupAction.scala.
|
||||
- Uncontested conquest: src/main/scala/net/eagle0/eagle/library/actions/impl/action/PerformUncontestedConquestAction.scala.
|
||||
- Battle request creation: src/main/scala/net/eagle0/eagle/library/actions/impl/action/RequestBattlesAction.scala.
|
||||
- Tactical battle resolution back into Eagle: src/main/scala/net/eagle0/eagle/library/actions/impl/action/ResolveBattleAction.scala.
|
||||
- Province held/conquered outcomes: src/main/scala/net/eagle0/eagle/library/actions/impl/action/ProvinceHeldAction.scala and src/main/scala/net/eagle0/eagle/library/actions/impl/action/ProvinceConqueredAction.scala.
|
||||
- Multi-winner aftermath: src/main/scala/net/eagle0/eagle/library/actions/impl/action/MultiVictorBattleSetupAction.scala, src/main/scala/net/eagle0/eagle/library/actions/impl/command/BattleAftermathDecisionCommand.scala, and src/main/scala/net/eagle0/eagle/library/actions/impl/action/FinalizeAftermathAction.scala.
|
||||
- Battle aftermath decisions: src/main/scala/net/eagle0/eagle/library/actions/impl/action/FinalizeAftermathAction.scala and AutoResolveBattleAftermathAction.scala.
|
||||
-->
|
||||
|
||||
Eagle is the strategic layer. Shardok is the tactical layer. The two connect when armies meet in a province and Eagle needs a battlefield result instead of a simple strategic update.
|
||||
|
||||
## Strategic Movement
|
||||
|
||||
For a compact round-by-round view of the entire process, see [March and Battle Timeline](/concepts/march-timeline/).
|
||||
|
||||
In Eagle, armies move through the March command. A moving army has an origin province, destination province, arrival round, heroes, battalions, and supplies.
|
||||
|
||||
Because Eagle is simultaneous, multiple factions can send armies during the same strategic phase. Those armies arrive later during movement resolution, after every relevant player has had the chance to submit orders for the phase.
|
||||
|
||||
## Arrival
|
||||
|
||||
When an army reaches its destination, the first question is whether it is friendly to the province's current ruler.
|
||||
|
||||
Friendly armies arrive during Province Move Resolution. Their heroes, battalions, gold, and food enter the destination province at that point.
|
||||
|
||||
Hostile armies do not immediately enter the province. They are converted into hostile army groups later in the round, after player commands, with one group per attacking faction. Each group keeps the armies, units, supplies, and approach direction from the province it marched from.
|
||||
|
||||
After hostile setup, Eagle checks for cases that do not need a tactical battle:
|
||||
|
||||
- If a hostile army reaches an unruled province, the largest army group takes it during Uncontested Conquest. Ties are broken by troop power and then a deterministic random tie-breaker.
|
||||
- If a single attacking army is attacking and there is no defending army, Eagle can resolve the attack directly as a conquest.
|
||||
- If diplomacy or truces apply, armies may turn back before fighting.
|
||||
|
||||
Otherwise, the player may see attack or defense decision phases before a battle is requested.
|
||||
|
||||
## Attack and Defense Decisions
|
||||
|
||||
Hostile army groups first wait for an attack decision. An attacking faction can choose whether to press the attack when the game asks for that decision.
|
||||
|
||||
If an attack proceeds against a ruled province, the defender may need to choose a defending army. The chosen defenders become the province's defending army. If a fallback province is available, the defender may also need to choose where the army should flee or retreat if Shardok produces that outcome.
|
||||
|
||||
## Battle Creation
|
||||
|
||||
When Eagle creates a Shardok battle, it sends:
|
||||
|
||||
- The province's Shardok map.
|
||||
- The attacking armies.
|
||||
- The defending army, if any.
|
||||
- Each side's food for the battle.
|
||||
- Victory conditions for each player.
|
||||
- The battle type and battle id.
|
||||
|
||||
Attackers in a normal province assault are trying to take the province. Defenders are trying to hold it or survive long enough for the attacker to fail.
|
||||
|
||||
The battle food sent to Shardok is limited. Attackers bring up to one month of food consumption from their carried supplies. Defenders bring up to one month of food consumption from the province's food, and that food is removed from the province when the battle is created.
|
||||
|
||||
## Tactical Resolution
|
||||
|
||||
The battle then runs in Shardok. Players place units, move, attack, use profession commands, spend Action Points, and try to satisfy their victory conditions.
|
||||
|
||||
Eagle waits in the battle resolution phase until outstanding Shardok battles report back.
|
||||
|
||||
See [Shardok battles](/concepts/shardok-battles/) for the tactical overview and [Shardok victory conditions](/concepts/shardok-victory-conditions/) for battle-ending rules.
|
||||
|
||||
## Returning To Eagle
|
||||
|
||||
When Shardok reports a result, Eagle applies battle consequences before deciding who owns the province.
|
||||
|
||||
The battle result can change:
|
||||
|
||||
- Hero locations and status.
|
||||
- Battalion size and survival.
|
||||
- Captured heroes and prisoners.
|
||||
- Supplies brought by attacking armies.
|
||||
- Province devastation.
|
||||
- Quest progress and battle history.
|
||||
- Prestige. Winners gain battle prestige; losers lose battle prestige.
|
||||
|
||||
Battles add devastation to the battle province. Surviving units may return, flee, become outlaws, be secured, or be captured depending on the tactical result.
|
||||
|
||||
Attackers' remaining gold and food are added to the battle province as part of battle resolution. If the defender holds the province, those supplies become part of the defended province. If an attacker later conquers it, the province changes hands with the supplies already present.
|
||||
|
||||
## If The Defender Wins
|
||||
|
||||
If the defending side wins, the province remains with its current ruler.
|
||||
|
||||
Attackers who did not flee, become outlaws, or get otherwise secured may be captured by the defending faction. Captured attacker battalions can be destroyed. The defender receives a Province Held result and any captured heroes become prisoners in the province.
|
||||
|
||||
## If One Attacker Wins
|
||||
|
||||
If exactly one attacking faction wins, that faction conquers the province directly.
|
||||
|
||||
Conquest does several things at once:
|
||||
|
||||
- Sets the conquering faction as the province's ruler.
|
||||
- Removes the old ruling-faction heroes from the province.
|
||||
- Adds the surviving non-fled conquering heroes as the new ruling-faction heroes.
|
||||
- Replaces the province battalions with the surviving conquering battalions.
|
||||
- Clears the defending army.
|
||||
- Sets province support to 0.
|
||||
- Resets province orders to **Entrust**.
|
||||
- Captures non-fled defenders and former ruling heroes as prisoners.
|
||||
- Clears the old owner's focus province if this province was their focus.
|
||||
- Clears recon on the province for all factions.
|
||||
|
||||
Prisoners already held in the conquered province can also be freed. Prisoners from the conquering faction join the new rulers at freed-prisoner loyalty. Prisoners from allied factions are sent toward the closest allied province when possible; if no allied province exists, they can become outlaws.
|
||||
|
||||
## If Multiple Allied Attackers Win
|
||||
|
||||
If multiple attacking factions win together, Eagle cannot automatically know who should keep the province. It creates a pending conquest decision for the surviving attacking claimants.
|
||||
|
||||
During Battle Aftermath, each claimant may be asked to choose:
|
||||
|
||||
- **Keep Province:** claim the province. Only one claimant can keep it.
|
||||
- **Withdraw:** leave for an adjacent province, taking up to the gold and food that claimant brought into the battle.
|
||||
|
||||
If an ally has already claimed the province, the remaining claimants must withdraw. If only one undecided claimant remains and nobody has claimed the province, Eagle auto-resolves that claimant as keeping it.
|
||||
|
||||
When aftermath finalizes, the keeper conquers the province through the same conquest rules as a single attacking winner. Withdrawing claimants become incoming armies to their chosen adjacent provinces, arriving next round with the gold and food they chose to take. These aftermath withdrawals do not apply shipment transit loss.
|
||||
|
||||
## Aftermath
|
||||
|
||||
Some battle results need another Eagle decision before the round can continue. This happens mainly when multiple allied attackers win the same province or when captured heroes create follow-up handling decisions.
|
||||
|
||||
Battle Aftermath happens after tactical results return but before the strategic round fully moves on. It is not a second Shardok battle; it is Eagle deciding ownership, withdrawals, supplies, and captured-hero consequences from the battle that already ended.
|
||||
|
||||
Captured heroes can create separate follow-up decisions after this. Those decisions determine what the capturing faction does with the hero now that the battle result has placed them in custody.
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: Game Concepts
|
||||
description: Player-facing explanations of Eagle and Shardok systems.
|
||||
---
|
||||
|
||||
These pages explain how Eagle0's major systems fit together. Use them when you want the big picture behind the command reference.
|
||||
|
||||
## Eagle
|
||||
|
||||
- [Victory and defeat](victory-and-defeat/) explains the strategic objective, leadership succession, faction destruction, and how the game ends.
|
||||
- [Who you command](command-authority/) explains faction heads, faction leaders, vassals, province turns, and direct control.
|
||||
- [Eagle round flow](eagle-round-flow/) explains how a strategic round advances, why actions are simultaneous, and when players see results.
|
||||
- [Information and recon](information-and-recon/) explains public, hidden, scouted, and potentially stale knowledge.
|
||||
- [From Eagle to Shardok](eagle-to-shardok/) explains how strategic movement turns into tactical battles and how battle results return to Eagle.
|
||||
- [March and battle timeline](march-timeline/) follows one army from order submission through arrival, battle, and aftermath.
|
||||
|
||||
## Shardok
|
||||
|
||||
- [Shardok combat fundamentals](shardok-combat/) explains turns, rounds, AP, movement, attacks, terrain, morale, and vigor.
|
||||
- [Shardok battles](shardok-battles/) explains tactical setup, turns, units, morale, vigor, terrain, and battle aftermath.
|
||||
- [Shardok victory conditions](shardok-victory-conditions/) explains how tactical battles end.
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
title: Information and Recon
|
||||
description: Public, private, stale, and scouted information in simultaneous Eagle rounds.
|
||||
---
|
||||
|
||||
Eagle does not give every faction a current view of the whole world. Results are filtered by province control, faction knowledge, scouting, diplomacy, alliances, and battle participation.
|
||||
|
||||
## Three kinds of uncertainty
|
||||
|
||||
- **Not present:** the game state confirms that something is absent.
|
||||
- **Not visible:** it may exist, but your faction has not earned that information.
|
||||
- **Known as of a date:** your faction observed it previously, but simultaneous actions may have changed it.
|
||||
|
||||
A blank enemy field can mean that the value is not visible; it does not necessarily mean the value is zero. An old observation describes the recorded date rather than guaranteeing the current state.
|
||||
|
||||
## Province information
|
||||
|
||||
Public province information can include identity, ruler, known events, known incoming armies, and an **as of** date. Full local information adds resources, caps, support, food consumption, battalions, heroes, orders, shipments, and events.
|
||||
|
||||
Controlling a province normally gives your faction its detailed state. Losing control does not mean every remembered fact remains current; the date tells you when the displayed knowledge was established.
|
||||
|
||||
## Simultaneous orders
|
||||
|
||||
Enemy factions choose during the same phase. Between an observation and a later arrival, a province may receive troops, change ruler, form a truce, or launch its own army. Observing a target does not reserve or freeze its state.
|
||||
|
||||
## Strategic Recon
|
||||
|
||||
Recon requires an eligible Ranger and targets a province not ruled by the acting faction. The command creates pending reconnaissance rather than instantly granting omniscience. Results are applied during **Recon Resolution**, after the relevant strategic activity.
|
||||
|
||||
Recon improves what your faction knows about the target at that point in the round. Later actions can make those details stale. The observation date records when that knowledge was established.
|
||||
|
||||
## Other ways information is earned
|
||||
|
||||
- Ruling a province exposes its local state.
|
||||
- Battle participants learn information revealed by the tactical encounter and its result.
|
||||
- Diplomacy reveals offers and relationship changes to the involved factions.
|
||||
- Allied or nearby events may be visible when the game state permits it.
|
||||
- Moving next to, scouting, or revealing hidden Shardok units affects tactical knowledge separately from strategic Recon.
|
||||
|
||||
Alliance does not make every hidden fact in the world public. Each faction can still have knowledge that the other does not.
|
||||
|
||||
## Example
|
||||
|
||||
In round 8, Recon reports an enemy frontier province with one battalion. You March toward it during round 9. The enemy simultaneously sends reinforcements. Your report was truthful as of round 8, but it did not promise that the round-9 defenders would be unchanged.
|
||||
|
||||
See [Eagle Round Flow](/concepts/eagle-round-flow/#simultaneous-information), [Recon](/commands/#recon), and [Provinces](/provinces/) for related rules.
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
title: March and Battle Timeline
|
||||
description: Where an army is from order submission through arrival and battle aftermath.
|
||||
---
|
||||
|
||||
March is a delayed strategic order. Selected heroes, battalions, gold, and food leave the origin immediately, but they do not enter the destination until later processing.
|
||||
|
||||
## The timeline
|
||||
|
||||
| When | State | What happens |
|
||||
| --- | --- | --- |
|
||||
| Player Commands, round N | March submitted | Forces and supplies leave the origin and form a moving army scheduled for round N+1. Each marching hero spends vigor. |
|
||||
| Province Move Resolution, round N+1 | Arrival checked | An army already friendly to the destination enters it. A hostile arrival waits outside rather than entering. |
|
||||
| After Player Commands, round N+1 | Hostile Army Setup | Hostile arrivals become attacking groups, one per faction, preserving their approach direction and carried supplies. |
|
||||
| Uncontested Conquest | No tactical defense needed | An unruled destination can be claimed without Shardok. Competing groups are compared by size, power, and a deterministic tie-breaker. |
|
||||
| Attack and Defense Decisions | A ruled province is contested | Attackers decide whether to press the attack; defenders may choose an army and fallback destination. Truces can turn armies back. |
|
||||
| Battle Request and Resolution | Shardok battle | Eagle sends armies, map, limited battle food, and victory conditions to Shardok, then waits for a result. |
|
||||
| Battle Aftermath | Consequences applied | Eagle resolves ownership, survivors, prisoners, supplies, devastation, prestige, and any allied-claimant decisions. |
|
||||
|
||||
## Friendly arrival
|
||||
|
||||
If your faction already rules the destination during Province Move Resolution, the army's heroes, battalions, and supplies enter the province. They are then present before later phases such as player commands and food consumption.
|
||||
|
||||
## Neutral or hostile arrival
|
||||
|
||||
A marching army does not occupy a neutral or enemy province during movement resolution. It remains a moving/hostile force until conquest or battle processing decides the outcome. This distinction matters for hero location, province leadership, and food.
|
||||
|
||||
An unruled province may be conquered without a tactical battle. A ruled and defended province can require attack and defense decisions followed by Shardok.
|
||||
|
||||
## Food and gold
|
||||
|
||||
Carried supplies travel with the army. Moving armies consume their own food while incoming. If food is insufficient, their battalions can suffer starvation losses.
|
||||
|
||||
When a normal province battle is created, attackers bring at most one month of food consumption from their carried food. Defenders receive at most one month from province food, removed when the battle is created. Remaining attacking supplies are applied to the battle province during resolution; whoever ultimately controls the province may therefore inherit them.
|
||||
|
||||
## One attacker wins
|
||||
|
||||
One victorious attacking faction conquers the province. Its surviving, non-fled heroes and battalions become the new ruling force, support becomes 0, orders reset to Entrust, and eligible defenders can become prisoners.
|
||||
|
||||
## Allied attackers win together
|
||||
|
||||
Eagle cannot automatically choose which allied winner keeps the province. Claimants enter Battle Aftermath. One may keep it; the others withdraw to adjacent provinces with permitted shares of the supplies they brought. Those withdrawals become incoming armies for the next round.
|
||||
|
||||
## Before confirming March
|
||||
|
||||
- Confirm the destination and arrival delay.
|
||||
- Leave enough heroes behind to retain the origin if necessary.
|
||||
- Carry enough food for transit and the intended battle.
|
||||
- Remember that the destination's ruler or diplomacy can change before arrival.
|
||||
- Expect an additional attack, defense, or aftermath decision when the army arrives.
|
||||
|
||||
See [March](/commands/#march) for selection rules and [From Eagle to Shardok](/concepts/eagle-to-shardok/) for detailed battle consequences.
|
||||
@@ -0,0 +1,80 @@
|
||||
---
|
||||
title: Shardok Battles
|
||||
description: How tactical Shardok battles work at a high level.
|
||||
---
|
||||
|
||||
<!--
|
||||
Source map:
|
||||
- Shardok battle model: src/main/scala/net/eagle0/eagle/model/state/shardok_battle/ShardokBattle.scala.
|
||||
- Battle creation from Eagle: src/main/scala/net/eagle0/eagle/library/actions/impl/action/RequestBattlesAction.scala.
|
||||
- Battle resolution back into Eagle: src/main/scala/net/eagle0/eagle/library/actions/impl/action/ResolveBattleAction.scala.
|
||||
- Tactical command availability: src/main/cpp/net/eagle0/shardok/library/AvailableCommandsFactory.cpp and command_factories/.
|
||||
- Victory checks: src/main/cpp/net/eagle0/shardok/library/actions/UpdateGameStatusAction.cpp.
|
||||
-->
|
||||
|
||||
Shardok is the tactical battle layer. Eagle decides that a battle should happen, sends armies into Shardok, and later receives the result back.
|
||||
|
||||
For the decision-making basics behind the command list, see [Shardok Combat Fundamentals](/concepts/shardok-combat/).
|
||||
|
||||
## Setup
|
||||
|
||||
At the start of a battle, each side places its units onto valid setup hexes. Some battles include reserve or reinforcement units that enter later. Rangers on stealth-capable units may be able to deploy hidden.
|
||||
|
||||
The map comes from the province where the battle occurs. A province's Shardok map defines terrain, castles, cities, rivers, bridges, water, and critical tiles.
|
||||
|
||||
## Units
|
||||
|
||||
See [Battalions](/battalions/) for troop, type, training, armament, morale, and lifecycle fundamentals.
|
||||
|
||||
A Shardok unit usually represents a hero attached to a battalion. The hero brings stats, vigor, profession abilities, and special command access. The battalion brings troop count, type, morale, training, armament, movement costs, damage profile, and battlefield limits.
|
||||
|
||||
Some commands require a profession. Some also require the attached battalion type to support that role. For example, many spell commands require a unit that can cast, while Ranger stealth depends on a stealth-capable battalion.
|
||||
|
||||
See [Heroes](/heroes/) for professions and [Shardok commands](/shardok-commands/) for command requirements.
|
||||
|
||||
## Action Points
|
||||
|
||||
Units act using Action Points. Moving through terrain spends AP based on the terrain and battalion type. Many major actions require a fixed AP minimum and then consume all remaining AP. The [Shardok command reference](/shardok-commands/) lists each command's AP cost and requirements.
|
||||
|
||||
Unless a command says otherwise, a unit with morale must have at least 10 morale, and a unit with an attached hero must have at least 10 vigor.
|
||||
|
||||
## Turns And Rounds
|
||||
|
||||
Shardok advances tactically while units move, attack, cast, hide, scout, flee, and reinforce. When a side ends its turn, control passes according to the tactical state. At the end of a tactical round, Shardok checks end-of-round victory conditions such as holding critical tiles or surviving to the round limit.
|
||||
|
||||
Some [victory conditions](/concepts/shardok-victory-conditions/), such as last player standing, can end the battle as soon as only one eligible side remains. Others wait until the end of a round so the opposing side has a chance to respond.
|
||||
|
||||
## Terrain
|
||||
|
||||
Terrain matters constantly:
|
||||
|
||||
- It changes movement costs.
|
||||
- It affects damage and resistance.
|
||||
- It can block line of fire.
|
||||
- Castles and cities can become critical objectives.
|
||||
- Water, bridges, ice, fire, and mountains create command-specific constraints.
|
||||
|
||||
Shardok is not just a troop-count comparison. Position, terrain, hidden information, and command timing matter.
|
||||
|
||||
## Hidden Units
|
||||
|
||||
Hidden units are not fully visible to enemies. Ranger abilities, scouting, terrain, movement, and proximity can reveal or preserve hidden information.
|
||||
|
||||
A hidden unit can matter even at battle end. If a losing hidden unit has a capable hero and can flee, it may escape rather than being resolved like an ordinary visible loser.
|
||||
|
||||
## Fleeing, Retreating, And Outlaws
|
||||
|
||||
Units can leave a battle through flee or retreat mechanics when those commands are available. A hero may also become an outlaw through battle consequences. Eagle receives these statuses when Shardok reports the final battle result.
|
||||
|
||||
## Battle Results
|
||||
|
||||
When the battle ends, Shardok reports each player's surviving units, destroyed battalions, fled units, captured or secured units, and victory or loss condition.
|
||||
|
||||
Eagle then applies the result:
|
||||
|
||||
- Defenders who win hold the province.
|
||||
- A single attacking winner can conquer the province.
|
||||
- Multiple allied attacking winners may trigger battle aftermath decisions.
|
||||
- Captured heroes and prisoners can create follow-up decisions.
|
||||
- Battle damage can devastate province economy, agriculture, and infrastructure.
|
||||
- Winning battles can advance quests.
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title: Shardok Combat Fundamentals
|
||||
description: Turns, rounds, Action Points, movement, attacks, terrain, morale, and vigor.
|
||||
---
|
||||
|
||||
Shardok is an objective-based hex battle, not a direct comparison of troop totals. Position, terrain, heroes, hidden information, and command timing determine which force can satisfy its victory conditions.
|
||||
|
||||
## Turns, units, and rounds
|
||||
|
||||
Players act according to the tactical state. A unit spends **Action Points (AP)** to move or use commands. Ending the player turn sets that player's remaining unit AP to 0. After every required side has had its opportunity, the tactical round closes and end-of-round victory conditions are checked.
|
||||
|
||||
## Movement and position
|
||||
|
||||
Movement cost depends on terrain and battalion type. Water, mountains, bridges, ice, fire, castles, and cities can restrict paths or change their value. Enemy proximity can affect hiding and movement choices. Use the highlighted valid targets rather than assuming every adjacent hex is traversable.
|
||||
|
||||
## Attacks and special actions
|
||||
|
||||
Melee and ranged attacks require valid targets and battlefield geometry. Line of fire can be blocked. Damage and resistance depend on the units, heroes, damage profiles, and terrain involved.
|
||||
|
||||
Many major actions require a minimum AP and then consume all remaining AP. The command reference states the exact rule. Unless an entry says otherwise, a morale-using unit needs at least 10 morale, and a unit with a hero needs at least 10 hero vigor.
|
||||
|
||||
## Heroes and battalions
|
||||
|
||||
The battalion provides troops, type, morale, training, armament, movement, and damage behavior. The attached hero provides stats, vigor, profession abilities, and special commands. Profession commands can also require a compatible battalion: casting and Ranger stealth are important examples.
|
||||
|
||||
## Terrain and objectives
|
||||
|
||||
Castles and cities may be defensive positions or critical objectives. Critical-tile victory normally requires a hero-bearing unit on every required tile at the end of the tactical round. Occupying an objective during your turn is therefore not always immediate victory; opponents may receive a chance to respond.
|
||||
|
||||
## Hidden units
|
||||
|
||||
Hidden units are not fully visible. Ranger scouting, adjacency, movement, and terrain can reveal them. Hidden units do not keep a player alive for Last Player Standing, although a capable hidden loser may flee when battle ends.
|
||||
|
||||
See [Shardok Commands](/shardok-commands/) for exact action requirements and [Shardok Victory Conditions](/concepts/shardok-victory-conditions/) for battle-ending checks.
|
||||
@@ -0,0 +1,80 @@
|
||||
---
|
||||
title: Shardok Victory Conditions
|
||||
description: How tactical battles decide winners and losers.
|
||||
---
|
||||
|
||||
<!--
|
||||
Source map:
|
||||
- Victory condition enum: src/main/protobuf/net/eagle0/common/victory_condition.proto.
|
||||
- Shardok victory checks: src/main/cpp/net/eagle0/shardok/library/actions/UpdateGameStatusAction.cpp.
|
||||
- Eagle assignment of battle victory conditions: src/main/scala/net/eagle0/eagle/library/actions/impl/action/RequestBattlesAction.scala.
|
||||
-->
|
||||
|
||||
Shardok battles end when one of the battle's victory conditions is satisfied. Each player has a set of conditions that apply to them.
|
||||
|
||||
In a normal Eagle province assault, attackers usually get **Hold Critical Tiles**, **Last Player Standing**, and **Last Alliance Standing**. The defender usually gets **Last Player Standing** and **Win After Max Rounds**.
|
||||
|
||||
## When conditions are checked
|
||||
|
||||
A **turn** is one player's opportunity to act. A **round** includes the required turns before end-of-round processing. This distinction determines whether the opposing side gets a response.
|
||||
|
||||
| Condition | Typical holder | Check timing |
|
||||
| --- | --- | --- |
|
||||
| Last Player Standing | Attacker and defender | As soon as only one eligible player survives |
|
||||
| Last Alliance Standing | Allied attackers | As soon as the only eligible survivors are mutually allied holders |
|
||||
| Hold Critical Tiles | Attackers | End of the tactical round |
|
||||
| Win After Max Rounds | Defender | End-of-round clock check |
|
||||
| Most Troops Standing | Special battle types | At its configured ending check |
|
||||
|
||||
The battle display's assigned conditions and maximum-round value are authoritative for that battle; the normal-assault assignments above are defaults, not promises for every scenario.
|
||||
|
||||
### Critical-tile response example
|
||||
|
||||
An attacker occupies the final critical tile during their turn. The battle does not end at that movement step. The defender receives the remaining opportunity provided by the tactical round and can retake or contest an objective. If eligible allied attackers still occupy every critical tile when the round closes, Hold Critical Tiles succeeds.
|
||||
|
||||
### Defender-clock example
|
||||
|
||||
The defender does not need to eliminate every attacker when Win After Max Rounds is assigned. The attacker must satisfy an attacking victory condition before the displayed round limit expires. Surviving without taking the objectives can therefore be a loss for the attacker.
|
||||
|
||||
## Last Player Standing
|
||||
|
||||
A player wins if they are the only surviving player and they have this victory condition.
|
||||
|
||||
A player counts as surviving when they still have a visible normal unit with troops, or a visible normal unit with a living hero. Hidden units do not keep a player alive for this check, though some hidden losing units may be able to flee when the battle ends.
|
||||
|
||||
## Last Alliance Standing
|
||||
|
||||
Multiple players can win together if all surviving players are mutually allied and all have this victory condition.
|
||||
|
||||
This is the tactical version of "the only forces left on the field are allies."
|
||||
|
||||
## Win After Max Rounds
|
||||
|
||||
A player wins if the battle lasts past the maximum number of Shardok rounds and they have this victory condition.
|
||||
|
||||
In normal province assaults, this is usually the defender's clock. The attacker has to force a result before time runs out.
|
||||
|
||||
## Hold Critical Tiles
|
||||
|
||||
A player wins by controlling every critical tile on the map. Critical tiles are usually castles or other objective tiles.
|
||||
|
||||
To count, each critical tile must be occupied by a unit belonging to the winning player, and the occupying unit must have an attached hero.
|
||||
|
||||
Allied attackers can also win this way together if allied players collectively occupy all critical tiles, all occupying players have the condition, and the occupants are mutually allied.
|
||||
|
||||
This condition is checked at the end of a tactical round, not immediately after every move, so the defender has a chance to retake objectives before the round closes.
|
||||
|
||||
## Most Troops Standing
|
||||
|
||||
This condition exists in the battle model, but normal Eagle province assaults do not currently assign it to attackers or defenders.
|
||||
|
||||
If a battle type uses it, the winner is the player with the most troops standing when the battle reaches the relevant ending check.
|
||||
|
||||
## What Happens After Victory
|
||||
|
||||
Shardok reports each player as victorious or defeated, including which condition ended the battle. Eagle then turns that tactical result into strategic consequences:
|
||||
|
||||
- A defending winner holds the province.
|
||||
- A single attacking winner conquers the province.
|
||||
- Multiple allied attacking winners may need to decide who keeps the province.
|
||||
- Captured heroes, destroyed battalions, fled units, outlaws, and secured prisoners are applied to the Eagle game state.
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
title: Victory and Defeat
|
||||
description: How factions win, survive leadership losses, and leave the game.
|
||||
---
|
||||
|
||||
Eagle0 is a struggle to become the last surviving faction. The game ends when only one faction remains; that faction wins. If no factions remain, the game ends without a winner.
|
||||
|
||||
## When a faction survives
|
||||
|
||||
A faction remains in the game while it has both:
|
||||
|
||||
- at least one faction leader; and
|
||||
- at least one ruled province or moving army.
|
||||
|
||||
Losing a province is therefore serious, but it is not necessarily immediate defeat. An army already marching can keep a landless faction alive long enough to conquer somewhere else.
|
||||
|
||||
## Losing your faction head
|
||||
|
||||
The death of the faction head does not automatically destroy the faction. Another surviving faction leader succeeds them.
|
||||
|
||||
If no faction leader is available but the faction still has a province or moving army, the strongest surviving vassal can rise to become both faction leader and faction head. The faction is destroyed only if no vassal can succeed.
|
||||
|
||||
Creating additional leaders with **Swear Kinship** protects the faction against a sudden leadership loss. A candidate must belong to the faction, have at least 95 loyalty, and be with the faction head when the command is used.
|
||||
|
||||
## How a faction is destroyed
|
||||
|
||||
A faction is destroyed when either condition is true:
|
||||
|
||||
1. It rules no provinces and has no moving armies.
|
||||
2. It has no faction leaders after the succession check.
|
||||
|
||||
When a faction is destroyed:
|
||||
|
||||
- its provinces become unruled;
|
||||
- its incoming armies are removed and their supplies remain at their destinations;
|
||||
- its heroes lose their faction assignment; and
|
||||
- diplomacy and outstanding offers involving it are removed.
|
||||
|
||||
Those heroes are not necessarily killed. They may remain in the world in unaffiliated states and interact with surviving factions later.
|
||||
|
||||
## Strategic implications
|
||||
|
||||
- Keep a succession option by gaining another leader or maintaining a capable vassal.
|
||||
- Preserve at least one province or viable moving army.
|
||||
- Do not assume an enemy is eliminated merely because its last visible province falls; it may still have an army in motion.
|
||||
- Remember that conquest can release, capture, or displace heroes without destroying their former faction immediately.
|
||||
|
||||
## Quick answers
|
||||
|
||||
**Do I win a battle by killing the enemy faction head?**
|
||||
Not automatically. Leadership succession may keep the faction alive.
|
||||
|
||||
**Am I defeated as soon as I lose my last province?**
|
||||
Not if your faction still has a moving army and a leader.
|
||||
|
||||
**Can a faction with provinces survive after all its leaders die?**
|
||||
Only if a surviving vassal can rise during the succession check.
|
||||
|
||||
**How does the whole game end?**
|
||||
The final surviving faction wins. If every faction is destroyed, there is no winner.
|
||||
|
||||
For tactical battle victory rules, see [Shardok Victory Conditions](/concepts/shardok-victory-conditions/). For leadership roles, see [Heroes](/heroes/#faction-leaders) and [Factions](/factions/#leaders).
|
||||
@@ -0,0 +1,106 @@
|
||||
---
|
||||
title: Factions
|
||||
description: Reference for Eagle factions, leaders, prestige, diplomacy, and province focus.
|
||||
---
|
||||
|
||||
Factions are the political actors in Eagle. They control provinces, command heroes and battalions, negotiate diplomacy, and compete for victory.
|
||||
|
||||
<!-- Sources:
|
||||
- FactionView shape: src/main/protobuf/net/eagle0/eagle/views/faction_view.proto
|
||||
- Relationship levels: src/main/protobuf/net/eagle0/eagle/views/faction_relationship_view.proto
|
||||
- Trust storage: src/main/scala/net/eagle0/eagle/model/state/faction/FactionRelationship.scala
|
||||
- Swear Kinship availability: src/main/scala/net/eagle0/eagle/library/actions/availability/AvailableSwearBrotherhoodCommandFactory.scala
|
||||
- Swear Kinship effect: src/main/scala/net/eagle0/eagle/library/actions/impl/command/SwearBrotherhoodCommand.scala
|
||||
- Leadership and destruction: src/main/scala/net/eagle0/eagle/library/actions/impl/action/CheckForFactionChangesAction.scala
|
||||
- Free hero states and recruitment info: src/main/scala/net/eagle0/eagle/model/state/unaffiliated_hero/UnaffiliatedHeroT.scala
|
||||
- Recruitment availability and odds: src/main/scala/net/eagle0/eagle/library/actions/availability/AvailableRecruitHeroesCommandFactory.scala
|
||||
and src/main/scala/net/eagle0/eagle/library/util/recruitment_odds/RecruitmentOdds.scala
|
||||
- Prestige calculation: src/main/scala/net/eagle0/eagle/library/util/faction_utils/FactionUtils.scala
|
||||
- Truce, alliance, break-alliance, ransom, and imprisonment effects:
|
||||
src/main/scala/net/eagle0/eagle/library/actions/impl/action/diplomacy_helpers/
|
||||
- Trust constants: src/main/scala/net/eagle0/eagle/library/settings/BUILD.bazel
|
||||
-->
|
||||
|
||||
## Faction Head
|
||||
|
||||
The faction head is the hero who represents the faction. In a normal game, this is usually your starting leader: the hero whose ideals, title, and story define what your faction is about.
|
||||
|
||||
If the faction head is killed, another faction leader can take over as faction head. The faction may also be renamed around the new head if that hero has a faction name of their own.
|
||||
|
||||
## Leaders
|
||||
|
||||
[Faction leaders](/heroes/#faction-leaders) are the heroes you can command directly. They are different from [vassals](/heroes/#vassals), who rule provinces for you and make their own choices.
|
||||
|
||||
You can gain more faction leaders with [**Swear Kinship**](/commands/#swear-kinship). The command is available when your faction head is in the province, your faction has fewer than 5 leaders, and another hero in the province has at least 95 loyalty. The new kinship hero becomes a faction leader.
|
||||
|
||||
Faction leaders matter for succession. If the faction head dies, the next available faction leader becomes faction head. If no surviving leader is available to take over immediately, the strongest remaining vassal can rise to become a new faction leader and faction head.
|
||||
|
||||
## Prestige
|
||||
|
||||
Prestige is a high-level measure of faction stature. It is also the main faction-wide factor in whether free heroes are willing to join you.
|
||||
|
||||
You gain prestige by:
|
||||
|
||||
- Controlling more provinces whose support is high enough for taxes. Each supported province is worth 10 prestige.
|
||||
- Winning battles.
|
||||
- Defeating beasts.
|
||||
|
||||
Prestige is not the only recruitment factor. The faction head's charisma, the free hero's power and ambition, the hero's current state, and any personal bias toward or against your faction also matter. But when you want more heroes to take you seriously, prestige is the big strategic lever.
|
||||
|
||||
## Free Heroes
|
||||
|
||||
Free heroes are heroes in a province who do not currently belong to your faction's command structure. The Free Hero panel tells you what state they are in and whether they can be recruited, divined, or managed another way.
|
||||
|
||||
The common states are:
|
||||
|
||||
- **Resident:** A hero living in the province. Residents may be willing to join outright. If they are not ready, they may be divinable: use [**Divine**](/commands/#divine) to learn what would impress them, then fulfill that ask to make them recruitable.
|
||||
- **Traveler:** A hero passing through. You do not know whether a traveler would join you until a faction leader travels there and talks to them. Travelers are harder to recruit than residents, but they might still join if your prestige and other recruitment factors are strong enough. They are also likely to leave the province soon, so they are more time-sensitive than residents.
|
||||
- **Prisoner:** A captured hero. Prisoners start with a strong bias against the faction holding them, but desperation can build over time. Eventually a prisoner may become willing to join, especially if your prestige is high enough.
|
||||
- **Outlaw:** A hostile free hero in the province. Outlaws are not ordinary recruits and will not simply join from the Free Hero panel; you generally deal with them through commands such as [**Apprehend Outlaw**](/commands/#apprehend-outlaw).
|
||||
|
||||
Some free heroes are effectively unavailable until circumstances change. For example, a province without one of your faction leaders cannot recruit from the Free Hero panel, and a hero may refuse forever if they have a permanent reason not to join your faction.
|
||||
|
||||
## Relationships
|
||||
|
||||
Faction relationships have a visible diplomatic state and an internal trust value.
|
||||
|
||||
The visible relationship states are:
|
||||
|
||||
- **Hostile:** The default enemy state. Hostile factions can fight each other.
|
||||
- **Truce:** A temporary peace. Truce offers set a reset date; when that date passes, the relationship returns to hostile. A truce or alliance also causes hostile armies between those factions to turn back during the truce turn-back phase.
|
||||
- **Alliance:** A stronger cooperative relationship. Alliances do not have a reset date. They last until they are broken.
|
||||
|
||||
Trust is a hidden number used by AI diplomacy. Higher trust makes a faction more willing to accept diplomatic offers. Trust changes in a few ways:
|
||||
|
||||
- Trust rises by 1 each new round between every pair of factions.
|
||||
- Accepting a ransom offer raises the offering faction's trust in the faction that accepted it by 25.
|
||||
- Rejecting a ransom offer lowers the offering faction's trust in the rejecting faction by 25.
|
||||
- Imprisoning another faction's ambassador is a major trust hit: the ambassador's faction loses 150 trust toward the imprisoning faction.
|
||||
- Other factions also notice ambassador imprisonment: each neutral faction loses 40 trust toward the imprisoning faction.
|
||||
|
||||
## Incoming Diplomacy Offers
|
||||
|
||||
Incoming offers are unresolved diplomatic proposals from other factions. They become [special and conditional commands](/commands/#special-and-conditional-commands) such as resolving truce offers, alliance offers, invitations, ransom offers, or alliance breaks.
|
||||
|
||||
## Focus Province
|
||||
|
||||
A faction can have a focus province. The focus province helps direct [province orders](/provinces/#province-orders) and AI attention toward a particular province.
|
||||
|
||||
## Faction Destruction
|
||||
|
||||
For a player-oriented overview of winning, losing, and leadership succession, see [Victory and Defeat](/concepts/victory-and-defeat/).
|
||||
|
||||
A faction is destroyed if either of these is true:
|
||||
|
||||
- It has no ruled provinces and no moving armies.
|
||||
- It has no faction leaders left.
|
||||
|
||||
The leader case has one extra succession step. If a faction loses its available leaders but still has provinces or armies, the game first looks for the strongest surviving vassal and promotes that hero to faction leader and faction head. If no vassal can rise, the faction has no faction leaders left and is destroyed.
|
||||
|
||||
When a faction is destroyed:
|
||||
|
||||
- Its provinces lose their ruling faction.
|
||||
- Its incoming armies are removed, and their supplies are left in the province.
|
||||
- Its heroes lose their faction assignment.
|
||||
- Other factions lose relationships and incoming offers involving the destroyed faction.
|
||||
- If only one faction remains, the game ends and that faction wins. If no factions remain, the game ends with no winner.
|
||||
@@ -0,0 +1,234 @@
|
||||
---
|
||||
title: Heroes
|
||||
description: Reference for Eagle heroes, stats, professions, and battlefield roles.
|
||||
---
|
||||
|
||||
Heroes are named characters who lead factions, rule provinces, command troops, perform strategic commands, and appear as units in Shardok battles.
|
||||
|
||||
The player-facing hero model is `HeroView`. It includes identity, faction membership, profession, core stats, personality stats, vigor, loyalty, abilities, portrait path, and backstory text.
|
||||
|
||||
## Core Stats
|
||||
|
||||
- **Strength** affects physical power and contributes to combat-oriented commands.
|
||||
- **Agility** affects mobility, scouting-style competence, and some profession eligibility.
|
||||
- **Constitution** sets a hero's endurance profile and is closely tied to vigor.
|
||||
- **Charisma** affects leadership, loyalty, diplomacy-flavored actions, and some profession eligibility.
|
||||
- **Wisdom** affects knowledge, magic-flavored actions, and some profession eligibility.
|
||||
|
||||
Stats can also have XP values. Strategic commands often spend vigor and grant XP in the stats connected to that action.
|
||||
|
||||
## Personality Stats
|
||||
|
||||
- **Integrity** represents trustworthiness and moral reliability.
|
||||
- **Ambition** represents appetite for power or advancement.
|
||||
- **Gregariousness** represents sociability and ease with other heroes.
|
||||
- **Bravery** represents willingness to face danger.
|
||||
|
||||
These values help drive hero flavor, AI decisions, and story generation.
|
||||
|
||||
## Vigor
|
||||
|
||||
Vigor is a hero's current energy. Many commands require an acting hero and spend vigor. Resting restores vigor up to the hero's constitution.
|
||||
|
||||
## Loyalty
|
||||
|
||||
Loyalty measures a hero's attachment to their faction. Feasts, events, captures, faction bias, and story consequences can move loyalty over time.
|
||||
|
||||
Loyalty is not faction bias. Loyalty describes an affiliated hero's current attachment; bias helps determine whether an unaffiliated or imprisoned hero will join a particular faction.
|
||||
|
||||
## Professions
|
||||
|
||||
Professions give heroes special command access, bonuses, and tactical identity. Some effects are Eagle strategic effects, while others apply only when the hero is attached to a Shardok battle unit.
|
||||
|
||||
Several Shardok profession commands also depend on the attached battalion type. For example, many magic commands require a battalion type that allows casting, and stealth commands require a battalion type that allows stealth.
|
||||
|
||||
### Mage
|
||||
|
||||
Eagle effects:
|
||||
|
||||
- Unlocks **Control Weather** for a mage in the acting province with enough vigor.
|
||||
- Can start or end blizzards and droughts in the acting province or a neighboring province.
|
||||
- Counts as a profession for general hero power and riot-crackdown hero power.
|
||||
- Makes the hero naturally capable of starting fires.
|
||||
|
||||
Shardok effects:
|
||||
|
||||
- Unlocks **Lightning Bolt** when attached to a casting-capable unit.
|
||||
- Unlocks the multi-round **Meteor** command chain: start, target, cast, and cancel.
|
||||
- Unlocks **Freeze Water** on adjacent water when attached to a casting-capable unit.
|
||||
- Improves **Start Fire** odds when the unit can start fires.
|
||||
- Changes hero melee damage from physical damage to magical damage: lightning, cold, fire, and aether essence.
|
||||
- Can influence AI water-crossing evaluation because Mage can freeze water.
|
||||
|
||||
Profession gain:
|
||||
|
||||
- Wisdom is the qualifying stat for Mage.
|
||||
|
||||
### Necromancer
|
||||
|
||||
Eagle effects:
|
||||
|
||||
- Unlocks **Start Epidemic** for a necromancer in the acting province with enough vigor.
|
||||
- Epidemics can target the acting province or neighboring provinces, excluding friendly provinces that already have an epidemic.
|
||||
- Counts as a profession for general hero power and riot-crackdown hero power.
|
||||
|
||||
Shardok effects:
|
||||
|
||||
- Unlocks **Raise Dead** when attached to a casting-capable unit and not already controlling a unit.
|
||||
- Unlocks **Fear** against eligible enemy units when attached to a casting-capable unit.
|
||||
- Raised dead and fear use the hero's charisma and wisdom in their odds.
|
||||
|
||||
Profession gain:
|
||||
|
||||
- Charisma is one qualifying stat for Necromancer.
|
||||
|
||||
### Engineer
|
||||
|
||||
Eagle effects:
|
||||
|
||||
- Is recommended first for **Improve** when an engineer is available.
|
||||
- Adds the configured engineer bonus to province improvements and devastation repair.
|
||||
- Counts as a profession for general hero power and riot-crackdown hero power.
|
||||
|
||||
Shardok effects:
|
||||
|
||||
- Unlocks **Build Bridge** from non-water terrain onto adjacent water.
|
||||
- Unlocks **Repair** for damaged bridges and castles.
|
||||
- Unlocks **Blow Bridge** while standing on a bridge.
|
||||
- Unlocks **Reduce** from a castle or fortified position against enemy units or castles.
|
||||
- Unlocks **Fortify** on fortifiable terrain.
|
||||
- Can influence AI water-crossing evaluation because engineers can create and destroy bridge access.
|
||||
|
||||
Profession gain:
|
||||
|
||||
- Agility is one qualifying stat for Engineer.
|
||||
|
||||
### Paladin
|
||||
|
||||
Eagle effects:
|
||||
|
||||
- Improves **Alms** by multiplying the support gained per food given.
|
||||
- Is sorted first in the **Alms** hero list when eligible.
|
||||
- Counts as a profession for general hero power and riot-crackdown hero power.
|
||||
|
||||
Shardok effects:
|
||||
|
||||
- Unlocks **Holy Wave** when the paladin has enough action points.
|
||||
|
||||
Profession gain:
|
||||
|
||||
- Charisma is one qualifying stat for Paladin.
|
||||
|
||||
### Ranger
|
||||
|
||||
Eagle effects:
|
||||
|
||||
- Unlocks **Recon** for a ranger in the acting province with enough vigor.
|
||||
- Recon can target provinces not ruled by the acting faction, as long as that faction does not already have a pending recon there.
|
||||
- Counts as a profession for general hero power and riot-crackdown hero power.
|
||||
|
||||
Shardok effects:
|
||||
|
||||
- Unlocks **Scout** when attached to a stealth-capable unit.
|
||||
- Unlocks **Hide** when attached to a stealth-capable unit, outside enemy zone of control, and with multiple hideable positions.
|
||||
- Allows defending rangers with stealth-capable units to use hidden placement during setup.
|
||||
- Gives a bonus to **Brave Water** odds when the unit can brave water.
|
||||
- Reveals adjacent hidden enemies while moving.
|
||||
- Prevents adjacent enemies from hiding or remaining hidden when the ranger has enough knowledge to be identified.
|
||||
|
||||
Profession gain:
|
||||
|
||||
- Agility is one qualifying stat for Ranger.
|
||||
|
||||
### Champion
|
||||
|
||||
Eagle effects:
|
||||
|
||||
- Is recommended first for **Train** when a champion is available.
|
||||
- Adds the configured champion bonus to training gained by trainable battalions.
|
||||
- Counts as a profession for general hero power and riot-crackdown hero power.
|
||||
|
||||
Shardok effects:
|
||||
|
||||
- Unlocks **Challenge Duel** against adjacent enemy heroes outside castles.
|
||||
- The target must have an attached hero and must either have enough known vigor to accept or be insufficiently known to rule that out.
|
||||
|
||||
Profession gain:
|
||||
|
||||
- Strength is the qualifying stat for Champion.
|
||||
|
||||
### Warden
|
||||
|
||||
Eagle effects:
|
||||
|
||||
- Improves prisoner recruitment over time. At new round processing, prisoners in a province with a ruling-faction Warden gain additional faction bias toward that province's ruler.
|
||||
- Counts as a profession for general hero power and riot-crackdown hero power.
|
||||
|
||||
Shardok effects:
|
||||
|
||||
- Unlocks **Evacuate Prisoners** when the warden's unit can flee, has enough action points, and hostile captured hero units are present.
|
||||
|
||||
Profession gain:
|
||||
|
||||
- Constitution is the qualifying stat for Warden.
|
||||
|
||||
### NoProfession
|
||||
|
||||
Heroes with no profession have no profession-specific command unlocks. They can still lead, fight, train, improve, march, use many normal strategic commands, and gain a profession later.
|
||||
|
||||
## Profession Gain
|
||||
|
||||
Only heroes with **NoProfession** can gain a profession. At the end of a round, heroes with enough XP can gain stats. If a no-profession hero gains one or more stats, the game checks for profession gain:
|
||||
|
||||
- The hero gets one profession-gain roll for each stat that increased.
|
||||
- A stat must be at least **85 after the stat gains are applied** to qualify a profession.
|
||||
- Eligible professions are based on all post-gain stats at or above 85, not only the stats that increased that round.
|
||||
- Strength qualifies **Champion**.
|
||||
- Agility qualifies **Engineer** and **Ranger**.
|
||||
- Wisdom qualifies **Mage**.
|
||||
- Charisma qualifies **Necromancer** and **Paladin**.
|
||||
- Constitution qualifies **Warden**.
|
||||
|
||||
### Progression example
|
||||
|
||||
A NoProfession hero earns Agility-related XP from strategic actions. During end-of-round progression, enough XP may increase Agility. If the hero's Agility is at least 85 after that increase, Engineer and Ranger are eligible. The hero receives profession-gain rolls for stats that increased; the player does not directly choose between eligible professions.
|
||||
|
||||
If several stats increase together, each increase can create a roll and all post-gain qualifying stats participate in eligibility. A hero who already has a profession does not roll for a replacement.
|
||||
|
||||
### Planning progression
|
||||
|
||||
- Commands award XP in stats associated with the action.
|
||||
- Stat increases and profession checks happen during end-of-round processing, not when XP is awarded.
|
||||
- Reaching 85 in a qualifying stat makes its profession possible but does not guarantee a particular random result.
|
||||
- Choosing which eligible hero performs a command influences who receives its XP.
|
||||
|
||||
## Faction Leaders
|
||||
|
||||
For a side-by-side explanation of direct control, province turns, and vassal automation, see [Who You Command](/concepts/command-authority/).
|
||||
|
||||
Every faction starts with a **faction head**. The faction head is the hero who defines what the faction represents: its political identity, its public story, and the starting point for its leadership.
|
||||
|
||||
Factions can gain additional faction leaders through **Swear Kinship** with another hero. The candidate must already belong to the faction, must have at least 95 loyalty, and must be in a province with the faction head. When the command succeeds, that hero becomes one of the faction's leaders.
|
||||
|
||||
Faction leaders are directly commandable. Vassals, by contrast, lead provinces and make their own choices when their province acts. Promoting a loyal vassal into leadership gives the player more direct control over that hero.
|
||||
|
||||
Faction leaders also provide succession. If the faction head is killed, another available faction leader can take over as the new faction head.
|
||||
|
||||
## Vassals
|
||||
|
||||
A **vassal** is a hero who belongs to your faction and rules one of its provinces, but is not a faction leader. You cannot command vassals directly. Instead, their provinces act during the Vassal Commands phase, when each vassal chooses an action based on the province's standing orders and immediate needs.
|
||||
|
||||
Vassals can be given standing orders with **Issue Orders**, promoted to faction leaders with **Swear Kinship**, or removed from the faction with **Exile Vassal**.
|
||||
|
||||
## Unaffiliated Heroes
|
||||
|
||||
Unaffiliated heroes can appear in provinces before joining a faction. Their province entry includes name, profession, status, leader flag, and recruitment information.
|
||||
|
||||
Common interactions include recruiting them, divining more information about them, declining their quests, or responding when they ask to join.
|
||||
|
||||
## Battle Capabilities
|
||||
|
||||
Hero views expose whether a hero is archery-capable or start-fire-capable. Those capabilities affect Shardok command availability when the hero is represented in battle.
|
||||
|
||||
- **Archery-capable**: the hero needs at least 75 agility.
|
||||
- **Start-fire-capable**: the hero is always capable if they are a Mage. Otherwise, they need at least 70 agility and at least 70 wisdom.
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: Eagle0pedia
|
||||
description: Reference companion for Eagle0 commands, systems, and game concepts.
|
||||
---
|
||||
|
||||
Eagle0pedia is the in-game reference companion for Eagle0. The tutorial answers "what should I do next?"; these pages answer "what does this mean?"
|
||||
|
||||
Eagle0 is a strategy game about factions, heroes, provinces, armies, diplomacy, and tactical battles. The broad strategic layer is **Eagle**: provinces produce food and gold, heroes lead factions or rule as vassals, armies march across the map, and diplomacy shapes the war. When armies clash, battles are resolved in **Shardok**, the tactical hex-based combat system.
|
||||
|
||||
Your strategic goal is to become the last surviving faction. Start with [Victory and Defeat](concepts/victory-and-defeat/) to learn how factions win, survive leadership losses, and leave the game.
|
||||
|
||||
Use these pages when you want a quick reference for commands, hero professions, faction leadership, province stats, or tactical battle options.
|
||||
|
||||
## Sections
|
||||
|
||||
- [Game concepts](concepts/) explains the flow of Eagle rounds, the handoff from Eagle to Shardok, tactical battles, and victory conditions.
|
||||
- [Eagle round flow](concepts/eagle-round-flow/) explains strategic phases and simultaneous player action.
|
||||
- [From Eagle to Shardok](concepts/eagle-to-shardok/) explains how strategic armies become tactical battles.
|
||||
- [Shardok battles](concepts/shardok-battles/) explains tactical battle structure, units, terrain, and aftermath.
|
||||
- [Shardok victory conditions](concepts/shardok-victory-conditions/) explains how tactical battles end.
|
||||
- [Eagle commands](commands/) explains the strategic commands available from province command panels.
|
||||
- [Shardok commands](shardok-commands/) explains tactical battle commands and profession-gated battlefield actions.
|
||||
- [Heroes](heroes/) covers stats, vigor, loyalty, professions, faction leaders, and battle capabilities.
|
||||
- [Battalions](battalions/) covers troop count, type, training, armament, morale, heroes, and battlefield outcomes.
|
||||
- [Factions](factions/) covers faction heads, leaders, prestige, diplomacy, and focus provinces.
|
||||
- [Provinces](provinces/) covers province stats, supplies, orders, armies, maps, castles, and unaffiliated heroes.
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: Integration Notes
|
||||
description: Technical notes for Eagle0pedia links, deployment, and review.
|
||||
---
|
||||
|
||||
Eagle0pedia lives close to the game data and can be reviewed with code changes before being deployed to `pedia.eagle0.net`.
|
||||
|
||||
## Link Targets
|
||||
|
||||
Unity info buttons should link to stable concept URLs. For the command panel, start with anchors on the command reference page:
|
||||
|
||||
- `https://pedia.eagle0.net/commands/#train`
|
||||
- `https://pedia.eagle0.net/commands/#march`
|
||||
- `https://pedia.eagle0.net/commands/#diplomacy`
|
||||
- `https://pedia.eagle0.net/shardok-commands/#melee`
|
||||
- `https://pedia.eagle0.net/heroes/#professions`
|
||||
- `https://pedia.eagle0.net/provinces/#province-stats`
|
||||
|
||||
When individual command pages are split out, keep redirects or aliases for these anchors so older clients still land somewhere useful.
|
||||
@@ -0,0 +1,229 @@
|
||||
---
|
||||
title: Provinces
|
||||
description: Reference for Eagle provinces, resources, infrastructure, orders, and tactical maps.
|
||||
---
|
||||
|
||||
Provinces are the strategic map locations in Eagle. They hold resources, heroes, battalions, province orders, incoming armies, local events, and the Shardok map used when battles occur there.
|
||||
|
||||
The player-facing province model is `ProvinceView`. Public information includes id, name, ruling faction, known events, known incoming armies, and an `as_of` date. When you have full information, `FullProvinceInfo` adds the detailed local state: gold, food, caps, support, food consumption, battalions, heroes, orders, incoming shipments, and local events.
|
||||
|
||||
<!--
|
||||
Source map:
|
||||
- Province view fields: src/main/protobuf/net/eagle0/eagle/views/province_view.proto and src/main/scala/net/eagle0/eagle/library/util/view_filters/ProvinceViewFilter.scala.
|
||||
- Province utilities: src/main/scala/net/eagle0/eagle/library/util/province/ProvinceUtils.scala.
|
||||
- New year production and yearly degradation: src/main/scala/net/eagle0/eagle/library/actions/impl/action/NewYearAction.scala.
|
||||
- New round caps, price-index drift, empty-province devastation repair, and hero-cap loyalty pressure: src/main/scala/net/eagle0/eagle/library/actions/impl/action/NewRoundAction.scala.
|
||||
- Food consumption and starvation: src/main/scala/net/eagle0/eagle/library/actions/impl/action/PerformFoodConsumptionPhaseAction.scala.
|
||||
- Shipment arrival: src/main/scala/net/eagle0/eagle/library/actions/impl/action/ShipmentArrivedAction.scala and src/main/scala/net/eagle0/eagle/library/actions/impl/action/PerformProvinceMoveResolutionAction.scala.
|
||||
- Price index: src/main/scala/net/eagle0/eagle/library/util/PriceIndexUtils.scala.
|
||||
- Settings: src/main/resources/net/eagle0/eagle/settings.tsv.
|
||||
-->
|
||||
|
||||
## Strategic Role
|
||||
|
||||
A province is both a resource base and a staging point. It can:
|
||||
|
||||
- Produce gold and food at the new year.
|
||||
- Store gold and food between commands.
|
||||
- Feed stationed battalions each round.
|
||||
- Hold heroes, battalions, prisoners, unaffiliated heroes, and events.
|
||||
- Launch March, Send Supplies, Train, Improve, Arm Troops, Trade, and other province commands.
|
||||
- Become a Shardok battlefield when hostile armies meet there.
|
||||
|
||||
The important strategic question is usually not just "how high are the stats?" It is "can this province keep support above 40, feed its troops, store enough supplies, and stage the actions I need before another faction interferes?"
|
||||
|
||||
## Development Stats
|
||||
|
||||
The three main development stats are **economy**, **agriculture**, and **infrastructure**.
|
||||
|
||||
- **Economy** drives annual gold production. A supported province produces 35 gold per effective economy at the new year.
|
||||
- **Agriculture** drives annual food production. A supported province produces 50 food per effective agriculture at the new year.
|
||||
- **Infrastructure** increases gold and food storage caps, affects improvement quality, and caps how far battalions can be armed.
|
||||
|
||||
Each stat has a matching devastation track. The effective value is the stat minus its devastation, never below 0. For example, 80 agriculture with 25 agriculture devastation behaves like 55 effective agriculture for production and other effective-stat checks.
|
||||
|
||||
Improve can raise economy, agriculture, or infrastructure. It can also repair devastation across all three devastation tracks. Engineers get a bonus when improving.
|
||||
|
||||
## Support
|
||||
|
||||
Support is local backing for the ruling faction. It ranges from 0 to 100 and is one of the most important province numbers.
|
||||
|
||||
A province needs at least **40 support** to provide annual gold and food production. If support is below 40, the province does not produce taxes at the new year. That also matters for prestige: supported provinces are worth prestige to the ruling faction.
|
||||
|
||||
Support changes through several commands and events:
|
||||
|
||||
- **Alms** spends food to raise support.
|
||||
- **Improve** raises support as a side effect.
|
||||
- **Riot** damage reduces support by 25 if the riot is not stopped.
|
||||
- **Suppress Beasts** can raise support on success.
|
||||
- Province events can raise or lower support.
|
||||
|
||||
Support also affects risk. Low support makes the province less useful economically and affects riot timing.
|
||||
|
||||
## Gold
|
||||
|
||||
Gold pays for many strategic actions. Feast, Organize Troops, Arm Troops, Divine, Hero Gift, diplomacy, Trade buys, and some other commands spend gold.
|
||||
|
||||
At the new year, supported provinces gain annual gold equal to:
|
||||
|
||||
`effective economy * 35`
|
||||
|
||||
Gold is stored in the province until spent, traded, shipped, marched away, captured through conquest, or lost because the province is over its storage cap.
|
||||
|
||||
Feast costs gold, not food: 20 gold per ruling-faction hero in the province, multiplied by the province price index.
|
||||
|
||||
## Food
|
||||
|
||||
Food supports armies and can also be spent strategically.
|
||||
|
||||
At the new year, supported provinces gain annual food equal to:
|
||||
|
||||
`effective agriculture * 50`
|
||||
|
||||
Food is consumed during the Food Consumption phase by battalions stationed in the province and by moving armies. The province view exposes monthly food consumption so you can judge how long the province can feed its current troops.
|
||||
|
||||
Food is also used by:
|
||||
|
||||
- **Alms**, which spends food to raise support.
|
||||
- **Trade**, which buys or sells food for gold.
|
||||
- **Send Supplies**, which can ship food to another province.
|
||||
- **March**, which can carry food with moving armies.
|
||||
- Riot gifts, if you choose to give food.
|
||||
|
||||
## Food Consumption and Starvation
|
||||
|
||||
Food consumption happens during the Food Consumption phase, after Province Move Resolution, player commands, hostile army setup, and battle requests, but before Battle Resolution.
|
||||
|
||||
This timing matters:
|
||||
|
||||
- A Send Supplies shipment that arrives during Province Move Resolution is available before the destination province consumes food later that same round.
|
||||
- A friendly marching army that arrives during Province Move Resolution can also bring food before that round's food consumption.
|
||||
- Moving armies consume food from their own carried supplies while they are still incoming.
|
||||
|
||||
If a province cannot feed its battalions, it spends all remaining province food and the battalions are reduced. The maximum battalion reduction from a food shortage is 20% in a single food-consumption event.
|
||||
|
||||
The same starvation rule applies to moving armies: if the army's carried food is not enough, the moving battalions are reduced and the army's food drops to 0.
|
||||
|
||||
Low-food warnings look ahead to incoming food, upcoming taxes, support, and expected production. If the province has enough food arriving before the next consumption, the warning can account for that.
|
||||
|
||||
## Storage Caps
|
||||
|
||||
Provinces have separate gold and food caps. These caps are based on effective development and infrastructure:
|
||||
|
||||
- Gold cap uses effective economy plus effective infrastructure.
|
||||
- Food cap uses effective agriculture plus effective infrastructure.
|
||||
- Both start from a base storage limit of 5000.
|
||||
- Each point of relevant development or infrastructure adds 50 storage.
|
||||
- A faction's focus province gets 1.5x storage.
|
||||
|
||||
Being over cap is not an immediate hard cutoff. During New Round processing, the province loses 20% of the amount above each cap, rounded up. Excess supplies therefore decay over time unless you spend them, ship them, trade them, or move them.
|
||||
|
||||
## Price Index
|
||||
|
||||
Price index is local price pressure. It changes costs and trade prices in the province.
|
||||
|
||||
The normal range is 0.75 to 1.5. A price index above 1 makes local purchases more expensive; below 1 makes them cheaper.
|
||||
|
||||
Gold spending can push the price index upward. Selling food counts as negative gold spending and can push it downward. Each gold spent changes the index by 0.0001, clamped to the normal range.
|
||||
|
||||
The price index also drifts each new round toward a local steady state based on development and devastation. It moves 10% of the distance toward that steady state per round.
|
||||
|
||||
Commands affected by price index include:
|
||||
|
||||
- **Feast** gold cost.
|
||||
- **Organize Troops** troop costs.
|
||||
- **Arm Troops** armament costs.
|
||||
- **Trade** buy and sell prices.
|
||||
- **Divine** cost.
|
||||
- **Hero Gift** loyalty gained per gold.
|
||||
|
||||
## Devastation
|
||||
|
||||
Devastation is damage to province systems. Economy, agriculture, and infrastructure each have their own devastation value.
|
||||
|
||||
Devastation reduces the corresponding effective stat. That means:
|
||||
|
||||
- Economy devastation reduces gold production and gold storage.
|
||||
- Agriculture devastation reduces food production and food storage.
|
||||
- Infrastructure devastation reduces storage, armament ceiling, and infrastructure-dependent checks.
|
||||
|
||||
Battles and province events can add devastation. Riots add economy and infrastructure devastation. Blizzards, droughts, floods, epidemics, and battle results can damage different province systems.
|
||||
|
||||
Improve with the Devastation option repairs all three devastation tracks. Empty provinces also recover devastation slowly during new round processing.
|
||||
|
||||
## Infrastructure and Troops
|
||||
|
||||
Infrastructure matters militarily because it caps armament. Arm Troops cannot raise a battalion's ARM above the province's effective infrastructure.
|
||||
|
||||
Economy and agriculture also affect which battalion types can be raised in the province. Battalion type availability checks the province's effective economy and effective agriculture against the battalion type's minimums.
|
||||
|
||||
Training is handled by [**Train**](/commands/#train). Armament is handled by [**Arm Troops**](/commands/#arm-troops). Organizing troop counts, creating battalions, resizing battalions, and dismissing battalions are handled by [**Organize Troops**](/commands/#organize-troops).
|
||||
|
||||
## Heroes and Hero Cap
|
||||
|
||||
A province has a hero cap. The default map data sets hero cap from castle count: each castle gives 5 hero capacity.
|
||||
|
||||
Going over the cap is allowed, but it creates loyalty pressure. During new round processing, if the province has too many established ruling-faction heroes, those heroes lose loyalty. Newly joined heroes are exempt for their first few rounds.
|
||||
|
||||
This is why moving heroes around is not just about command access. Keeping too many heroes stacked in one province can create long-term loyalty damage.
|
||||
|
||||
## Ruling Faction and Ruling Hero
|
||||
|
||||
A province can have a ruling faction and a ruling hero. The ruling hero is the local leader for the province.
|
||||
|
||||
If a faction leader rules the province, the player can command that leader directly. If a [vassal](/heroes/#vassals) rules it, the province acts through vassal behavior during the [Vassal Commands phase](/concepts/eagle-round-flow/#vassal-commands) unless another special phase interrupts it.
|
||||
|
||||
Province leadership also matters for riots. The province leader's Charisma affects riot size and gift success, even if another hero is selected to crack down.
|
||||
|
||||
## Province Orders
|
||||
|
||||
Province orders are standing instructions for vassal-led provinces. The [**Issue Orders**](/commands/#issue-orders) command changes them and can also set or clear the faction focus province.
|
||||
|
||||
The main orders are:
|
||||
|
||||
- **Entrust:** let the vassal judge the situation.
|
||||
- **Develop:** build up and improve the province.
|
||||
- **Mobilize:** prepare military strength and supplies.
|
||||
- **Expand:** look for growth, movement, and attack opportunities.
|
||||
|
||||
The focus province also affects logistics. Vassals may ship excess gold and food toward the focus province if one is set, or toward the nearest faction leader if not.
|
||||
|
||||
## Incoming Armies
|
||||
|
||||
Incoming armies represent forces that are moving toward the province but have not arrived or resolved yet.
|
||||
|
||||
Friendly incoming armies arrive during [Province Move Resolution](/concepts/eagle-round-flow/#province-move-resolution) if the destination is already ruled by their faction. Hostile arrivals do not simply enter the province; they can become hostile army groups and later trigger conquest, attack decisions, defense decisions, battle requests, and [Shardok battles](/concepts/eagle-to-shardok/).
|
||||
|
||||
Incoming armies can carry gold and food. If supplies arrive with a friendly movement, transit loss can reduce the amount received.
|
||||
|
||||
## Incoming Shipments
|
||||
|
||||
Incoming shipments are supplies sent by [**Send Supplies**](/commands/#send-supplies).
|
||||
|
||||
The origin province loses the selected gold and food immediately. The destination receives an incoming shipment scheduled for the next round. During the next round's Province Move Resolution phase, the shipment arrives before food consumption. 10% is lost in transit, rounded down after loss.
|
||||
|
||||
Because shipments arrive before food consumption, shipping food can prevent starvation in the destination province during the arrival round.
|
||||
|
||||
## Province Events
|
||||
|
||||
Province events are temporary or local conditions that affect the province.
|
||||
|
||||
Important event types include:
|
||||
|
||||
- **Riot:** requires a decision if it reaches Handle Riot. If not stopped, it causes support loss and devastation.
|
||||
- **Beasts:** can damage support over time and can be suppressed for rewards and prestige.
|
||||
- **Blizzard:** damages province systems and affects supplies.
|
||||
- **Drought:** damages agriculture.
|
||||
- **Flood:** damages infrastructure and agriculture.
|
||||
- **Epidemic:** damages economy, battalions, and hero vigor, and can spread or end over time.
|
||||
- **Festival:** improves support and prestige while active.
|
||||
|
||||
Some events can be created or changed by commands. Mages can use [**Control Weather**](/commands/#control-weather) to start or end blizzards and droughts. Necromancers can use [**Start Epidemic**](/commands/#start-epidemic).
|
||||
|
||||
## Tactical Map and Castles
|
||||
|
||||
Each province has a `hex_map_name`. When a battle occurs there, Eagle uses that name to choose the Shardok tactical map.
|
||||
|
||||
`castle_count` records the province's fortification count. Castles matter for hero capacity, defensive setup, tactical objectives, and some battle behavior.
|
||||
|
||||
The source map data in `province_map.tsv` defines province ids, names, neighbor ids, neighbor positions, tactical map names, neighbor names, and castle counts.
|
||||
@@ -0,0 +1,438 @@
|
||||
---
|
||||
title: Shardok Commands
|
||||
description: Tactical command reference for Shardok battles.
|
||||
---
|
||||
|
||||
<span class="command-reference-marker" aria-hidden="true"></span>
|
||||
<span class="command-reference-five-row-marker" aria-hidden="true"></span>
|
||||
|
||||
<!--
|
||||
Source map for Shardok command requirements/costs:
|
||||
- Shared morale/vigor filters: src/main/resources/net/eagle0/shardok/settings.tsv fields minimumMoraleToAct=10 and minimumVigorToAct=10; applied in src/main/cpp/net/eagle0/shardok/library/AvailableCommandsFactory.cpp.
|
||||
- Fixed AP setting values: src/main/resources/net/eagle0/shardok/settings.tsv. Most command factories call SettingsGetter::ActionCostFor(...) in src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.cpp, which returns ActionCost::usesAll; see src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp and src/main/cpp/net/eagle0/shardok/library/unit/Unit.cpp.
|
||||
- Melee: meleeActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/melee_command_factory/MeleeCommandFactory.cpp.
|
||||
- Archery: archeryActionPointCost=5 and longbowWindBonusRangeMinSpeed=20; hero archery threshold is agility >= 75 in src/main/cpp/net/eagle0/shardok/ai_battle_simulator/AiBattleSimulator.cpp; normal targets come from TwoAwayTilesUnblockedByMountains in src/main/cpp/net/eagle0/shardok/library/util/HexMapUtils.cpp; longbow castle-adjacent and wind-assisted range-3 exceptions are in src/main/cpp/net/eagle0/shardok/library/command_factories/archery_command_factory/ArcheryCommandFactory.cpp; volley spend is in src/main/cpp/net/eagle0/shardok/library/commands/ArcheryCommand.cpp.
|
||||
- Charge: terrain-entry cost from BattalionType::GetCostToEnterTerrain(...); allowsMoveAfterCharge is true for Light Cavalry and Heavy Cavalry in src/main/resources/net/eagle0/shardok/battalionTypes.tsv; stun settings are baseStunChanceOnCharge and trainingDifferenceMultiplierForStunChanceOnCharge in the same file; src/main/cpp/net/eagle0/shardok/library/command_factories/ChargeCommandFactory.cpp.
|
||||
- Move: per-hex terrain-entry costs, plus extraCostForZocMovement=1; src/main/cpp/net/eagle0/shardok/library/command_factories/MoveCommandFactory.cpp and src/main/cpp/net/eagle0/shardok/library/commands/MoveCommand.cpp.
|
||||
- Lightning Bolt: lightningActionPointCost=5 and lightningRange=3; src/main/cpp/net/eagle0/shardok/library/command_factories/LightningBoltCommandFactory.cpp and src/main/cpp/net/eagle0/shardok/library/commands/LightningBoltCommand.cpp.
|
||||
- Meteor: meteorStartActionPointCost=5, meteorTargetActionPointCost=0, meteorCancelActionPointCost=0, meteorCastActionPointCost=1, meteorCastVigorCost=20, and meteorRange=3; src/main/cpp/net/eagle0/shardok/library/command_factories/MeteorStartCommandFactory.cpp, MeteorTargetCommandFactory.cpp, src/main/cpp/net/eagle0/shardok/library/util/MeteorRangeCoords.cpp, src/main/cpp/net/eagle0/shardok/library/commands/MeteorStartCommand.cpp, MeteorTargetCommand.cpp, MeteorCancelCommand.cpp, and src/main/cpp/net/eagle0/shardok/library/actions/MeteorCastAction.cpp.
|
||||
- Start Fire: startFireActionPointCost=5; hero start-fire thresholds are Mage or agility >= 70 and wisdom >= 70 in src/main/cpp/net/eagle0/shardok/ai_battle_simulator/AiBattleSimulator.cpp; src/main/cpp/net/eagle0/shardok/library/command_factories/StartFireCommandFactory.cpp and src/main/cpp/net/eagle0/shardok/library/commands/StartFireCommand.cpp.
|
||||
- Extinguish Fire: extinguishActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/ExtinguishFireCommandFactory.cpp and src/main/cpp/net/eagle0/shardok/library/commands/ExtinguishFireCommand.cpp.
|
||||
- Freeze Water: freezeWaterActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/FreezeWaterCommandFactory.cpp.
|
||||
- Build Bridge: buildBridgeActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/BuildBridgeCommandFactory.cpp.
|
||||
- Blow Bridge: blowBridgeActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/BlowBridgeCommandFactory.cpp.
|
||||
- Placement: no AP cost in setup commands; src/main/cpp/net/eagle0/shardok/library/actions/PlaceUnitCommand.cpp and PlaceHiddenUnitCommand.cpp.
|
||||
- Scout: scoutActionPointCost=5 and scoutRange=4; src/main/cpp/net/eagle0/shardok/library/command_factories/ScoutCommandFactory.cpp.
|
||||
- Raise Dead: raiseDeadActionPointCost=5 and raiseDeadRange=2; src/main/cpp/net/eagle0/shardok/library/command_factories/RaiseDeadCommandFactory.cpp.
|
||||
- Dismiss Unit: requires remainingActionPoints > 0 in src/main/cpp/net/eagle0/shardok/library/command_factories/ControlCommandFactory.cpp; execution zeroes both units in src/main/cpp/net/eagle0/shardok/library/commands/DismissUnitCommand.cpp.
|
||||
- Holy Wave: holyWaveActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/HolyWaveCommandFactory.cpp.
|
||||
- Stop and Rest: stop posts no AP cost; rest zeroes AP in src/main/cpp/net/eagle0/shardok/library/commands/UnitRestCommand.cpp; stop implementation in UnitStopCommand.cpp.
|
||||
- Challenge Duel: challengeDuelActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/ChallengeDuelCommandFactory.cpp and src/main/cpp/net/eagle0/shardok/library/commands/challenge_duel_command/ChallengeDuelCommand.cpp.
|
||||
- Fear: fearActionPointCost=5 and fearRange=3; src/main/cpp/net/eagle0/shardok/library/command_factories/FearCommandFactory.cpp.
|
||||
- Repair: repairActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/RepairCommandFactory.cpp.
|
||||
- Reduce: reduceActionPointCost=5 and reduceRange=3; src/main/cpp/net/eagle0/shardok/library/command_factories/ReduceCommandFactory.cpp.
|
||||
- Flee and Retreat: fleeActionPointCost=5 and retreatActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/FleeCommandFactory.cpp and RetreatCommandFactory.cpp.
|
||||
- Control: requires remainingActionPoints > 0 in ControlCommandFactory.cpp; execution zeroes acting unit in src/main/cpp/net/eagle0/shardok/library/commands/ControlCommand.cpp.
|
||||
- Reinforce: reinforceActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/ReinforceCommandFactory.cpp.
|
||||
- Brave Water: braveWaterActionPointCost=8; src/main/cpp/net/eagle0/shardok/library/command_factories/BraveWaterCommandFactory.cpp and src/main/cpp/net/eagle0/shardok/library/commands/BraveWaterCommand.cpp.
|
||||
- Release Unit: requires remainingActionPoints > 0 in ControlCommandFactory.cpp; execution zeroes both units in src/main/cpp/net/eagle0/shardok/library/commands/ReleaseUnitCommand.cpp.
|
||||
- End Turn and Setup: no command AP cost; end turn zeroes player unit AP in src/main/cpp/net/eagle0/shardok/library/commands/EndTurnCommand.cpp; setup end in src/main/cpp/net/eagle0/shardok/library/actions/EndPlayerSetupCommand.cpp.
|
||||
- Hide: hideActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/HideCommandFactory.cpp.
|
||||
- Fortify: fortifyActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/FortifyCommandFactory.cpp.
|
||||
- Become Outlaw: uses fleeActionPointCost=5 through src/main/cpp/net/eagle0/shardok/library/command_factories/FleeCommandFactory.cpp and src/main/cpp/net/eagle0/shardok/library/commands/BecomeOutlawCommand.cpp.
|
||||
- Evacuate Prisoners: evacuatePrisonersActionPointCost=5; src/main/cpp/net/eagle0/shardok/library/command_factories/EvacuatePrisonersCommandFactory.cpp.
|
||||
-->
|
||||
|
||||
## Shared Requirements
|
||||
|
||||
Unless noted otherwise: **10 morale**, **10 hero vigor**, and the listed **Action Point cost**.
|
||||
|
||||
## Activations and follow-ups
|
||||
|
||||
A unit can keep acting while it has Action Points (AP) and at least one available command. Read each command's AP line as follows:
|
||||
|
||||
- **Consumes all remaining AP** or **sets the unit to 0 AP** means **ends activation**. The unit cannot act again this turn.
|
||||
- A command with only an exact AP cost spends that amount. If the unit still has AP afterward, its activation can continue with whatever commands are then available.
|
||||
- A command may also end the unit's useful activation because no legal commands remain, even if the display still shows AP.
|
||||
|
||||
Movement is the most important case. Each destination shows its movement cost and may show **follow-up available** icons. Those follow-ups are actions predicted to be legal *after reaching that destination*, such as Charge, Scout, Start Fire, Repair, Reduce, or Reinforce.
|
||||
|
||||
The follow-up list is a planning aid, not a complete list of everything the unit might do next. It does not include another Move, and battlefield information can change when the move resolves. A destination with no follow-up icons does not itself mean “ends activation”: compare the movement cost with the unit's remaining AP and check the commands offered after arrival.
|
||||
|
||||
## Tactical Commands
|
||||
|
||||
### Melee
|
||||
|
||||
<b>Unit requirements:</b> any unit.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> an enemy target is adjacent and the acting unit can still act.
|
||||
|
||||
<b>Effect:</b> Attack the target in close combat. The UI may show combat odds before you choose the attack.
|
||||
|
||||
<b>Selection:</b> choose the attacking unit and adjacent target.
|
||||
|
||||
### Archery
|
||||
|
||||
<b>Unit requirements:</b> Longbowmen, or a unit with an attached hero who has at least 75 AGI. The unit must have at least one volley remaining.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> a known enemy is exactly 2 hexes away, and the line between the attacker and target is not blocked by mountains.
|
||||
|
||||
<b>Effect:</b> Make a ranged attack without requiring adjacency, spending one volley. Longbowmen can also fire at adjacent hexes while standing in a castle, and can fire 3 hexes when the wind is at least 20 mph and blowing toward the target.
|
||||
|
||||
<b>Selection:</b> choose the firing unit and target unit or hex.
|
||||
|
||||
### Charge
|
||||
|
||||
<b>Unit requirements:</b> any unit.
|
||||
|
||||
<b>Action Point cost:</b> the cost to enter the target's terrain. Knights and Dragoons spend only that terrain cost and may be able to move again afterward; other units spend all remaining AP.
|
||||
|
||||
<b>Activation:</b> ends activation for units that spend all remaining AP. Knights and Dragoons can continue when they retain AP and another command is available.
|
||||
|
||||
<b>Available when:</b> a valid path reaches a target that can be attacked at the end of the move.
|
||||
|
||||
<b>Effect:</b> Move into an attack as one action. Charge attacks have a chance to stun the target unit.
|
||||
|
||||
<b>Selection:</b> choose the charging unit, path, and target.
|
||||
|
||||
### Move
|
||||
|
||||
<b>Unit requirements:</b> any unit.
|
||||
|
||||
<b>Action Point cost:</b> the terrain cost for each hex in the path, plus 1 extra AP for steps that start in enemy zone of control.
|
||||
|
||||
<b>Activation:</b> does not inherently end activation. The unit can continue if it has AP and a legal command after arriving. Follow-up icons on a destination preview eligible non-move actions there.
|
||||
|
||||
<b>Available when:</b> one or more reachable destination hexes are valid for the acting unit.
|
||||
|
||||
<b>Effect:</b> Move the unit along the chosen path to a reachable hex, paying terrain costs as it goes. Hidden units may reveal themselves if they move into exposed terrain or near an enemy Ranger.
|
||||
|
||||
<b>Selection:</b> choose the unit and destination path.
|
||||
|
||||
### Lightning Bolt
|
||||
|
||||
<b>Unit requirements:</b> [Mage](/heroes/#mage) attached to Light Infantry, Light Cavalry, or Longbowmen. Heavy units and Undead cannot cast.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> a known enemy is within 3 hexes of the caster.
|
||||
|
||||
<b>Effect:</b> Cast a lightning attack at the target. The descriptor may include odds or roll information when the client can display expected results.
|
||||
|
||||
<b>Selection:</b> choose the casting unit and target.
|
||||
|
||||
### Meteor
|
||||
|
||||
<b>Unit requirements:</b> [Mage](/heroes/#mage) attached to Light Infantry, Light Cavalry, or Longbowmen, with enough vigor to start the spell. Heavy units and Undead cannot cast.
|
||||
|
||||
<b>Action Point cost:</b> start costs 5 AP and consumes all remaining AP; target and cancel cost 0 AP; the automatic cast step is configured as 1 AP but resolves by setting the caster to 0 AP.
|
||||
|
||||
<b>Available when:</b> the caster can begin the spell, choose or change a target within 3 hexes, cast the pending meteor, or cancel the pending meteor.
|
||||
|
||||
<b>Effect:</b> Begin a delayed meteor spell, choose where it will land, then resolve the strike when the cast step becomes available. You can cancel while the meteor is still pending.
|
||||
|
||||
<b>Selection:</b> choose the caster, spell target, or cancel option depending on the current meteor step.
|
||||
|
||||
### Start Fire
|
||||
|
||||
<b>Unit requirements:</b> a unit with an attached [Mage](/heroes/#mage), or an attached hero with at least 70 AGI and 70 WIS. Mages improve the odds.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> a target hex can be set on fire.
|
||||
|
||||
<b>Effect:</b> Attempt to start a fire on the target hex.
|
||||
|
||||
<b>Selection:</b> choose the acting unit and target hex.
|
||||
|
||||
### Extinguish Fire
|
||||
|
||||
<b>Unit requirements:</b> any unit with an attached hero.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> a target hex contains fire that can be reduced or removed.
|
||||
|
||||
<b>Effect:</b> Remove or reduce fire on the target hex.
|
||||
|
||||
<b>Selection:</b> choose the acting unit and burning target hex.
|
||||
|
||||
### Freeze Water
|
||||
|
||||
<b>Unit requirements:</b> [Mage](/heroes/#mage) attached to Light Infantry, Light Cavalry, or Longbowmen. Heavy units and Undead cannot cast.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> a valid water hex can be frozen.
|
||||
|
||||
<b>Effect:</b> Turn water into traversable frozen terrain where the command is valid.
|
||||
|
||||
<b>Selection:</b> choose the caster and water hex.
|
||||
|
||||
### Build Bridge
|
||||
|
||||
<b>Unit requirements:</b> [Engineer](/heroes/#engineer).
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> the engineer has a valid water or gap target where a bridge can be built.
|
||||
|
||||
<b>Effect:</b> Create a bridge across the target.
|
||||
|
||||
<b>Selection:</b> choose the engineer unit and bridge target.
|
||||
|
||||
### Blow Bridge
|
||||
|
||||
<b>Unit requirements:</b> [Engineer](/heroes/#engineer) standing on a bridge.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> the bridge can be destroyed.
|
||||
|
||||
<b>Effect:</b> Destroy the existing bridge target.
|
||||
|
||||
<b>Selection:</b> choose the engineer unit and bridge.
|
||||
|
||||
### Placement
|
||||
|
||||
<b>Unit requirements:</b> a unit available for setup placement. Hidden placement requires a defending [Ranger](/heroes/#ranger) attached to a stealth-capable unit.
|
||||
|
||||
<b>Action Point cost:</b> no AP cost during setup.
|
||||
|
||||
<b>Available when:</b> the battle is in setup and a valid placement hex is available.
|
||||
|
||||
<b>Effect:</b> Put a reserve unit onto the battlefield. Rangers on stealth-capable units can be placed hidden during defensive setup.
|
||||
|
||||
<b>Selection:</b> choose the unit and setup hex.
|
||||
|
||||
### Scout
|
||||
|
||||
<b>Unit requirements:</b> [Ranger](/heroes/#ranger) attached to a stealth-capable unit.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> the ranger can scout a hex within 4 hexes.
|
||||
|
||||
<b>Effect:</b> Reveal information about the target hex and nearby terrain, including possible hidden-unit information.
|
||||
|
||||
<b>Selection:</b> choose the scouting unit and target.
|
||||
|
||||
### Raise Dead
|
||||
|
||||
<b>Unit requirements:</b> [Necromancer](/heroes/#necromancer) attached to Light Infantry, Light Cavalry, or Longbowmen, and the hero must not already control a unit. Heavy units and Undead cannot cast.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> there is an empty, undead-traversable target hex within 2 hexes.
|
||||
|
||||
<b>Effect:</b> Create or restore undead forces through necromantic action.
|
||||
|
||||
<b>Selection:</b> choose the necromancer unit and target.
|
||||
|
||||
### Dismiss Unit
|
||||
|
||||
<b>Unit requirements:</b> a unit that is allowed to be dismissed.
|
||||
|
||||
<b>Action Point cost:</b> requires the controlling unit to have more than 0 AP; execution sets both the controlling unit and dismissed unit to 0 AP.
|
||||
|
||||
<b>Available when:</b> dismissal is valid for the current tactical state.
|
||||
|
||||
<b>Effect:</b> Remove the unit from the tactical battle.
|
||||
|
||||
<b>Selection:</b> choose the unit to dismiss.
|
||||
|
||||
### Holy Wave
|
||||
|
||||
<b>Unit requirements:</b> [Paladin](/heroes/#paladin).
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> the paladin has a valid holy-wave action.
|
||||
|
||||
<b>Effect:</b> Use a holy-area effect from the capable unit.
|
||||
|
||||
<b>Selection:</b> choose the paladin unit and command target, if one is required.
|
||||
|
||||
### Stop and Rest
|
||||
|
||||
<b>Unit requirements:</b> a unit that can stop or rest.
|
||||
|
||||
<b>Action Point cost:</b> Stop costs 0 AP; Rest consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> the unit can end movement or spend its action resting.
|
||||
|
||||
<b>Effect:</b> `UNIT_STOP_COMMAND` stops a unit. `UNIT_REST_COMMAND` has a unit spend its action resting instead of acting aggressively.
|
||||
|
||||
<b>Selection:</b> choose stop or rest for the acting unit.
|
||||
|
||||
### Challenge Duel
|
||||
|
||||
<b>Unit requirements:</b> [Champion](/heroes/#champion).
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> an opposing unit can be challenged.
|
||||
|
||||
<b>Effect:</b> Challenge an opposing unit to a duel. The tactical action emits accepted or declined outcomes directly.
|
||||
|
||||
<b>Selection:</b> choose the champion unit and duel target.
|
||||
|
||||
### Fear
|
||||
|
||||
<b>Unit requirements:</b> [Necromancer](/heroes/#necromancer) attached to Light Infantry, Light Cavalry, or Longbowmen. Heavy units and Undead cannot cast.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> a known enemy that uses morale is within 3 hexes.
|
||||
|
||||
<b>Effect:</b> Use a fear effect against the target.
|
||||
|
||||
<b>Selection:</b> choose the necromancer unit and target.
|
||||
|
||||
### Repair
|
||||
|
||||
<b>Unit requirements:</b> [Engineer](/heroes/#engineer).
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> a damaged unit or battlefield object can be repaired.
|
||||
|
||||
<b>Effect:</b> Repair the damaged target.
|
||||
|
||||
<b>Selection:</b> choose the engineer unit and repair target.
|
||||
|
||||
### Reduce
|
||||
|
||||
<b>Unit requirements:</b> [Engineer](/heroes/#engineer) in a castle or fortified position.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> an enemy or damaged castle is within 3 hexes and the line is not blocked by mountains.
|
||||
|
||||
<b>Effect:</b> Reduce the target's defensive or structural value.
|
||||
|
||||
<b>Selection:</b> choose the engineer unit and target.
|
||||
|
||||
### Flee and Retreat
|
||||
|
||||
<b>Unit requirements:</b> a unit that is allowed to leave or withdraw.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> flight or retreat is valid for the current battlefield state.
|
||||
|
||||
<b>Effect:</b> `FLEE_COMMAND` handles immediate flight from a tactical situation. `RETREAT_COMMAND` handles a more formal withdrawal command.
|
||||
|
||||
<b>Selection:</b> choose the fleeing or retreating unit.
|
||||
|
||||
### Control
|
||||
|
||||
<b>Unit requirements:</b> a unit with access to a control effect.
|
||||
|
||||
<b>Action Point cost:</b> requires more than 0 AP; execution sets the acting unit to 0 AP.
|
||||
|
||||
<b>Available when:</b> a valid target can be controlled.
|
||||
|
||||
<b>Effect:</b> Take control of the target when the command is available.
|
||||
|
||||
<b>Selection:</b> choose the acting unit and control target.
|
||||
|
||||
### Reinforce
|
||||
|
||||
<b>Unit requirements:</b> reinforcements available to enter the battle.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> the battle state allows reinforcement and there is a valid entry option.
|
||||
|
||||
<b>Effect:</b> Bring reinforcements into the battle.
|
||||
|
||||
<b>Selection:</b> choose the reinforcement option and entry placement.
|
||||
|
||||
### Brave Water
|
||||
|
||||
<b>Unit requirements:</b> a unit that can attempt brave-water movement. [Ranger](/heroes/#ranger) is not required, but Rangers get an odds bonus.
|
||||
|
||||
<b>Action Point cost:</b> 8 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> the unit has a valid water path or water target.
|
||||
|
||||
<b>Effect:</b> Move through water despite the usual danger or restriction.
|
||||
|
||||
<b>Selection:</b> choose the unit and water movement target.
|
||||
|
||||
### Release Unit
|
||||
|
||||
<b>Unit requirements:</b> a unit that can release a constrained target.
|
||||
|
||||
<b>Action Point cost:</b> requires more than 0 AP; execution sets both the controlling unit and released unit to 0 AP.
|
||||
|
||||
<b>Available when:</b> a controlled, held, or otherwise constrained unit can be released.
|
||||
|
||||
<b>Effect:</b> Release the constrained unit.
|
||||
|
||||
<b>Selection:</b> choose the acting unit and unit to release.
|
||||
|
||||
### End Turn and Setup
|
||||
|
||||
<b>Unit requirements:</b> None.
|
||||
|
||||
<b>Action Point cost:</b> no AP cost to post the command; End Turn then sets that player's remaining unit AP to 0.
|
||||
|
||||
<b>Available when:</b> the active player can end the tactical turn or finish setup.
|
||||
|
||||
<b>Effect:</b> `END_TURN_COMMAND` ends the active tactical turn. `END_PLAYER_SETUP_COMMAND` ends that player's setup phase.
|
||||
|
||||
<b>Selection:</b> choose the end-turn or end-setup command.
|
||||
|
||||
### Hide
|
||||
|
||||
<b>Unit requirements:</b> [Ranger](/heroes/#ranger) attached to a stealth-capable unit.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> the unit can enter or remain in hidden status.
|
||||
|
||||
<b>Effect:</b> Hide the unit.
|
||||
|
||||
<b>Selection:</b> choose the ranger unit.
|
||||
|
||||
### Fortify
|
||||
|
||||
<b>Unit requirements:</b> [Engineer](/heroes/#engineer).
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> the engineer can fortify its current position.
|
||||
|
||||
<b>Effect:</b> Have the unit fortify its current position.
|
||||
|
||||
<b>Selection:</b> choose the engineer unit.
|
||||
|
||||
### Become Outlaw
|
||||
|
||||
<b>Unit requirements:</b> a unit or hero eligible for the outlaw consequence.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP through the flee/outlaw action.
|
||||
|
||||
<b>Available when:</b> the battle result or tactical state allows the outlaw transition.
|
||||
|
||||
<b>Effect:</b> Mark the unit or hero as becoming an outlaw as a battle consequence.
|
||||
|
||||
<b>Selection:</b> choose the outlaw command when offered.
|
||||
|
||||
### Evacuate Prisoners
|
||||
|
||||
<b>Unit requirements:</b> [Warden](/heroes/#warden) on a unit that can flee.
|
||||
|
||||
<b>Action Point cost:</b> 5 AP; consumes all remaining AP.
|
||||
|
||||
<b>Available when:</b> prisoners can be moved out of danger.
|
||||
|
||||
<b>Effect:</b> Move prisoners out of danger when the battlefield state allows prisoner evacuation.
|
||||
|
||||
<b>Selection:</b> choose the warden unit and evacuation command.
|
||||
@@ -0,0 +1,258 @@
|
||||
.sl-markdown-content:has(.command-reference-marker) {
|
||||
--command-border: color-mix(in srgb, var(--sl-color-gray-5), transparent 18%);
|
||||
--command-surface: color-mix(in srgb, var(--sl-color-bg), var(--sl-color-gray-6) 22%);
|
||||
--command-surface-strong: color-mix(in srgb, var(--sl-color-bg), var(--sl-color-accent-low) 28%);
|
||||
--command-muted: var(--sl-color-gray-2);
|
||||
--command-label: var(--sl-color-accent-high);
|
||||
}
|
||||
|
||||
.command-reference-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.command-reference-five-row-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) > p:has(.command-reference-marker) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-five-row-marker) > p:has(.command-reference-five-row-marker) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) > p {
|
||||
max-width: 68rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h2 {
|
||||
margin-top: 3rem;
|
||||
padding: 1rem 1.125rem;
|
||||
border: 1px solid var(--command-border);
|
||||
border-radius: 0.5rem;
|
||||
background:
|
||||
linear-gradient(90deg, var(--sl-color-accent-low), transparent 72%),
|
||||
var(--command-surface);
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h2 h2 {
|
||||
font-size: clamp(1.35rem, 2.4vw, 1.7rem);
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h2 + p {
|
||||
margin-top: 0.75rem;
|
||||
color: var(--command-muted);
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 {
|
||||
margin-top: 1.5rem;
|
||||
margin-bottom: 0;
|
||||
padding: 1rem 1.125rem 0.875rem;
|
||||
border: 1px solid var(--command-border);
|
||||
border-bottom: 0;
|
||||
border-radius: 0.5rem 0.5rem 0 0;
|
||||
background: var(--command-surface-strong);
|
||||
font-size: 1.18rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 h3 {
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p + p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p + p + p {
|
||||
margin: 0;
|
||||
padding: 0.75rem 1.125rem;
|
||||
border-right: 1px solid var(--command-border);
|
||||
border-left: 1px solid var(--command-border);
|
||||
background: var(--sl-color-bg);
|
||||
position: relative;
|
||||
padding-left: 13.625rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-five-row-marker)
|
||||
.sl-heading-wrapper.level-h3
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p {
|
||||
margin: 0;
|
||||
padding: 0.75rem 1.125rem;
|
||||
border-right: 1px solid var(--command-border);
|
||||
border-left: 1px solid var(--command-border);
|
||||
background: var(--sl-color-bg);
|
||||
position: relative;
|
||||
padding-left: 13.625rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p + p + p {
|
||||
padding-bottom: 1rem;
|
||||
border-bottom: 1px solid var(--command-border);
|
||||
border-radius: 0 0 0.5rem 0.5rem;
|
||||
box-shadow: 0 0.7rem 1.6rem color-mix(in srgb, black, transparent 92%);
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-five-row-marker)
|
||||
.sl-heading-wrapper.level-h3
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p {
|
||||
padding-bottom: 0.75rem;
|
||||
border-bottom: 0;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-five-row-marker)
|
||||
.sl-heading-wrapper.level-h3
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p {
|
||||
padding-bottom: 1rem;
|
||||
border-bottom: 1px solid var(--command-border);
|
||||
border-radius: 0 0 0.5rem 0.5rem;
|
||||
box-shadow: 0 0.7rem 1.6rem color-mix(in srgb, black, transparent 92%);
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) p > b:first-child {
|
||||
color: var(--command-label);
|
||||
font-size: 0.82rem;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p > b:first-child,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p > b:first-child,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p + p > b:first-child,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p + p + p > b:first-child,
|
||||
.sl-markdown-content:has(.command-reference-five-row-marker)
|
||||
.sl-heading-wrapper.level-h3
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
> b:first-child {
|
||||
position: absolute;
|
||||
left: 1.125rem;
|
||||
width: 11.5rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h4 {
|
||||
margin-top: 1rem;
|
||||
padding: 0.65rem 1rem;
|
||||
border: 1px solid var(--command-border);
|
||||
border-radius: 0.45rem;
|
||||
background: color-mix(in srgb, var(--sl-color-gray-6), transparent 55%);
|
||||
color: var(--sl-color-white);
|
||||
font-size: 0.92rem;
|
||||
letter-spacing: 0.02em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h5 {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 0;
|
||||
padding: 0.75rem 1rem 0.25rem;
|
||||
border-top: 1px solid var(--command-border);
|
||||
color: var(--sl-color-accent-high);
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h5 + p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h5 + p + p {
|
||||
margin: 0;
|
||||
padding: 0.4rem 1rem;
|
||||
border-right: 1px solid var(--command-border);
|
||||
border-left: 1px solid var(--command-border);
|
||||
position: relative;
|
||||
padding-left: 7.5rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h5 + p > b:first-child,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h5 + p + p > b:first-child {
|
||||
position: absolute;
|
||||
left: 1rem;
|
||||
width: 5.5rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h5 + p + p {
|
||||
padding-bottom: 0.8rem;
|
||||
border-bottom: 1px solid var(--command-border);
|
||||
border-radius: 0 0 0.45rem 0.45rem;
|
||||
}
|
||||
|
||||
@media (max-width: 50rem) {
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h2,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 {
|
||||
padding-right: 0.875rem;
|
||||
padding-left: 0.875rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p + p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p + p + p,
|
||||
.sl-markdown-content:has(.command-reference-five-row-marker)
|
||||
.sl-heading-wrapper.level-h3
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p {
|
||||
padding-right: 0.875rem;
|
||||
padding-left: 0.875rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) p > b:first-child {
|
||||
display: block;
|
||||
margin-bottom: 0.2rem;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p + p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p + p + p,
|
||||
.sl-markdown-content:has(.command-reference-five-row-marker)
|
||||
.sl-heading-wrapper.level-h3
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h5 + p,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h5 + p + p {
|
||||
padding-left: 0.875rem;
|
||||
}
|
||||
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p > b:first-child,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p > b:first-child,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p + p > b:first-child,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h3 + p + p + p + p > b:first-child,
|
||||
.sl-markdown-content:has(.command-reference-five-row-marker)
|
||||
.sl-heading-wrapper.level-h3
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
+ p
|
||||
> b:first-child,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h5 + p > b:first-child,
|
||||
.sl-markdown-content:has(.command-reference-marker) .sl-heading-wrapper.level-h5 + p + p > b:first-child {
|
||||
position: static;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
import "../node_modules/astro/astro.js";
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "astro/tsconfigs/strict"
|
||||
}
|
||||
Binary file not shown.
@@ -29,6 +29,7 @@
|
||||
"com.thesamet.scalapb:scalapb-json4s_3": -772830803,
|
||||
"com.thesamet.scalapb:scalapb-runtime-grpc_3": -2026114331,
|
||||
"com.thesamet.scalapb:scalapb-runtime_3": -1281968352,
|
||||
"com.zaxxer:HikariCP": 1858991878,
|
||||
"io.netty:netty-buffer": 732437843,
|
||||
"io.netty:netty-codec": -1199307927,
|
||||
"io.netty:netty-codec-http": -1456497900,
|
||||
@@ -117,6 +118,7 @@
|
||||
"com.thesamet.scalapb:scalapb-runtime-grpc_3": 97373115,
|
||||
"com.thesamet.scalapb:scalapb-runtime_3": 818778125,
|
||||
"com.typesafe:config": -1791448454,
|
||||
"com.zaxxer:HikariCP": -704610647,
|
||||
"commons-codec:commons-codec": 1377992676,
|
||||
"commons-io:commons-io": 669567296,
|
||||
"dev.dirs:directories": 1716880629,
|
||||
@@ -550,6 +552,12 @@
|
||||
},
|
||||
"version": "1.4.6"
|
||||
},
|
||||
"com.zaxxer:HikariCP": {
|
||||
"shasums": {
|
||||
"jar": "709f378c05756280939ce50fc1b1f1a53bb8e1899dc1b249f21f12703640b48b"
|
||||
},
|
||||
"version": "6.3.3"
|
||||
},
|
||||
"commons-codec:commons-codec": {
|
||||
"shasums": {
|
||||
"jar": "f700de80ac270d0344fdea7468201d8b9c805e5c648331c3619f2ee067ccfc59"
|
||||
@@ -1581,6 +1589,9 @@
|
||||
"org.scala-lang.modules:scala-collection-compat_3",
|
||||
"org.scala-lang:scala3-library_3"
|
||||
],
|
||||
"com.zaxxer:HikariCP": [
|
||||
"org.slf4j:slf4j-api"
|
||||
],
|
||||
"io.get-coursier:coursier-cache_2.13": [
|
||||
"io.get-coursier.jniutils:windows-jni-utils",
|
||||
"io.get-coursier:cache-util",
|
||||
@@ -2557,6 +2568,16 @@
|
||||
"com.typesafe.config.impl",
|
||||
"com.typesafe.config.parser"
|
||||
],
|
||||
"com.zaxxer:HikariCP": [
|
||||
"com.zaxxer.hikari",
|
||||
"com.zaxxer.hikari.hibernate",
|
||||
"com.zaxxer.hikari.metrics",
|
||||
"com.zaxxer.hikari.metrics.dropwizard",
|
||||
"com.zaxxer.hikari.metrics.micrometer",
|
||||
"com.zaxxer.hikari.metrics.prometheus",
|
||||
"com.zaxxer.hikari.pool",
|
||||
"com.zaxxer.hikari.util"
|
||||
],
|
||||
"commons-codec:commons-codec": [
|
||||
"org.apache.commons.codec",
|
||||
"org.apache.commons.codec.binary",
|
||||
@@ -4100,6 +4121,7 @@
|
||||
"com.thesamet.scalapb:scalapb-runtime-grpc_3",
|
||||
"com.thesamet.scalapb:scalapb-runtime_3",
|
||||
"com.typesafe:config",
|
||||
"com.zaxxer:HikariCP",
|
||||
"commons-codec:commons-codec",
|
||||
"commons-io:commons-io",
|
||||
"dev.dirs:directories",
|
||||
|
||||
@@ -10,4 +10,8 @@ if [ -n "${BAZEL_OUTPUT_BASE:-}" ]; then
|
||||
bazel_cmd+=("--output_base=${BAZEL_OUTPUT_BASE}")
|
||||
fi
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
./scripts/sync_bazel_xcode.sh
|
||||
fi
|
||||
|
||||
"${bazel_cmd[@]}" build "$@" //src/main/scala/net/eagle0/eagle:eagle_server
|
||||
|
||||
@@ -10,4 +10,8 @@ if [ -n "${BAZEL_OUTPUT_BASE:-}" ]; then
|
||||
bazel_cmd+=("--output_base=${BAZEL_OUTPUT_BASE}")
|
||||
fi
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
./scripts/sync_bazel_xcode.sh
|
||||
fi
|
||||
|
||||
"${bazel_cmd[@]}" build -c opt "$@" //src/main/cpp/net/eagle0/shardok:shardok-server
|
||||
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
bazel_cmd=(bazel)
|
||||
if [ -n "${BAZEL_OUTPUT_USER_ROOT:-}" ]; then
|
||||
bazel_cmd+=("--output_user_root=${BAZEL_OUTPUT_USER_ROOT}")
|
||||
fi
|
||||
if [ -n "${BAZEL_OUTPUT_BASE:-}" ]; then
|
||||
bazel_cmd+=("--output_base=${BAZEL_OUTPUT_BASE}")
|
||||
fi
|
||||
|
||||
"${bazel_cmd[@]}" build \
|
||||
--platforms=//:linux_arm64 \
|
||||
--extra_toolchains=@llvm_toolchain_linux_arm64//:cc-toolchain-aarch64-linux \
|
||||
"$@" \
|
||||
//src/main/cpp/net/eagle0/shardok:shardok-server
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# Runs the curated Shardok clang-tidy gate used by CI.
|
||||
#
|
||||
# This intentionally checks representative files instead of the whole C++ tree.
|
||||
# Keep this list low-noise; expand it as cleanup PRs make more areas tidy-clean.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
source "$repo_root/scripts/shardok_cpp_config.sh"
|
||||
|
||||
files=(
|
||||
"src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp"
|
||||
"src/main/cpp/net/eagle0/shardok/library/CombatDamage.hpp"
|
||||
)
|
||||
|
||||
compiler_args=(
|
||||
"-I$repo_root"
|
||||
"$SHARDOK_CXX_STANDARD_ARG"
|
||||
)
|
||||
|
||||
if command -v xcrun >/dev/null 2>&1; then
|
||||
sdk_path="$(xcrun --show-sdk-path)"
|
||||
compiler_args+=("-isysroot" "$sdk_path")
|
||||
fi
|
||||
|
||||
"$repo_root/scripts/run-clang-tidy.sh" --verify-config
|
||||
|
||||
"$repo_root/scripts/run-clang-tidy.sh" --quiet --warnings-as-errors="*" "${files[@]}" -- "${compiler_args[@]}"
|
||||
@@ -241,6 +241,8 @@ main() {
|
||||
if [ -x "${WARMUP_SCRIPT}" ]; then
|
||||
if ! "${WARMUP_SCRIPT}" "localhost:${staging_port}"; then
|
||||
log_error "Warmup/smoke test failed, aborting deployment"
|
||||
log_error "Recent eagle-${staging} logs:"
|
||||
docker logs "eagle-${staging}" --tail 200 2>&1 || true
|
||||
docker compose -f "${COMPOSE_FILE}" stop "eagle-${staging}"
|
||||
cleanup_markers_on_failure "eagle-${active}"
|
||||
exit 1
|
||||
|
||||
@@ -32,23 +32,33 @@ echo "=== Creating ZIP for notarization: $ZIP_PATH ===" >&2
|
||||
ditto -c -k --keepParent "$APP_PATH" "$ZIP_PATH"
|
||||
|
||||
echo "=== Submitting to Apple for notarization ===" >&2
|
||||
set +e
|
||||
SUBMIT_OUTPUT=$(xcrun notarytool submit "$ZIP_PATH" \
|
||||
--apple-id "$APPLE_ID" \
|
||||
--password "$APP_SPECIFIC_PASSWORD" \
|
||||
--team-id "$TEAM_ID" 2>&1)
|
||||
SUBMIT_STATUS=$?
|
||||
set -e
|
||||
|
||||
echo "$SUBMIT_OUTPUT" >&2
|
||||
|
||||
if [ "$SUBMIT_STATUS" -ne 0 ]; then
|
||||
rm -f "$ZIP_PATH"
|
||||
echo "ERROR: notarytool submit failed with exit code $SUBMIT_STATUS" >&2
|
||||
exit "$SUBMIT_STATUS"
|
||||
fi
|
||||
|
||||
# Extract submission ID
|
||||
SUBMISSION_ID=$(echo "$SUBMIT_OUTPUT" | grep "id:" | head -1 | awk '{print $2}')
|
||||
SUBMISSION_ID=$(echo "$SUBMIT_OUTPUT" | awk '/^[[:space:]]*id:/ {print $2; exit}')
|
||||
|
||||
if [ -z "$SUBMISSION_ID" ]; then
|
||||
rm -f "$ZIP_PATH"
|
||||
echo "ERROR: Failed to get submission ID" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean up the zip
|
||||
rm "$ZIP_PATH"
|
||||
rm -f "$ZIP_PATH"
|
||||
|
||||
echo "Submission ID: $SUBMISSION_ID" >&2
|
||||
|
||||
|
||||
@@ -10,13 +10,14 @@ set -e
|
||||
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
source "$repo_root/scripts/shardok_cpp_config.sh"
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "Usage: scripts/run-clang-tidy.sh [clang-tidy args] <files> [-- <compiler args>]"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " scripts/run-clang-tidy.sh --verify-config"
|
||||
echo " scripts/run-clang-tidy.sh src/main/cpp/net/eagle0/shardok/library/CombatDamage.hpp -- -I$repo_root -std=c++23"
|
||||
echo " scripts/run-clang-tidy.sh src/main/cpp/net/eagle0/shardok/library/CombatDamage.hpp -- -I$repo_root $SHARDOK_CXX_STANDARD_ARG"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Shared C++ settings for shell scripts that invoke Shardok tooling outside Bazel.
|
||||
|
||||
SHARDOK_CXX_STANDARD="c++23"
|
||||
SHARDOK_CXX_STANDARD_ARG="-std=${SHARDOK_CXX_STANDARD}"
|
||||
@@ -28,7 +28,7 @@ static inline auto HashBuffer(const uint8_t* data, size_t size) -> uint64_t {
|
||||
|
||||
// Process 8 bytes at a time
|
||||
while (data + 8 <= end) {
|
||||
uint64_t word;
|
||||
uint64_t word = 0;
|
||||
// Use memcpy to avoid alignment issues and let compiler optimize
|
||||
__builtin_memcpy(&word, data, sizeof(word));
|
||||
hash ^= word;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <cstdio>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
|
||||
#include "tools/cpp/runfiles/runfiles.h"
|
||||
@@ -37,7 +38,7 @@ auto rloc(const string& execPath) -> string {
|
||||
const std::unique_ptr<Runfiles> runfiles(Runfiles::Create(execPath, &error));
|
||||
|
||||
if (runfiles == nullptr) {
|
||||
fprintf(stderr, "Error! %s\n", error.c_str());
|
||||
std::cerr << "Error! " << error << '\n';
|
||||
abort();
|
||||
// error handling
|
||||
}
|
||||
@@ -78,9 +79,9 @@ auto FilesystemUtils::MapFilesDirectory() -> string {
|
||||
|
||||
void FilesystemUtils::MakeDirectoryIfNecessary(const string& directoryPath) {
|
||||
if (fs::create_directories(directoryPath))
|
||||
fprintf(stderr, "Directory %s created\n", directoryPath.c_str());
|
||||
std::cerr << "Directory " << directoryPath << " created\n";
|
||||
else
|
||||
fprintf(stderr, "No new directory created for %s\n", directoryPath.c_str());
|
||||
std::cerr << "No new directory created for " << directoryPath << '\n';
|
||||
}
|
||||
|
||||
auto FilesystemUtils::SaveFilesDirectory() -> string {
|
||||
@@ -140,11 +141,11 @@ auto FilesystemUtils::AtomicallySaveToPath(const string& path, const byte_vector
|
||||
if (ostr.good()) {
|
||||
const int err = rename(tempPath.c_str(), path.c_str());
|
||||
if (err == -1) {
|
||||
fprintf(stderr, "Failed to move file to %s! Errno %d\n", path.c_str(), errno);
|
||||
std::cerr << "Failed to move file to " << path << "! Errno " << errno << '\n';
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Failed writing to %s!\n", tempPath.c_str());
|
||||
std::cerr << "Failed writing to " << tempPath << "!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <bit>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <iterator>
|
||||
|
||||
#define ITERABLE_BITSET_INDEX_CHECKS false
|
||||
|
||||
@@ -104,9 +105,11 @@ public:
|
||||
|
||||
class Iter {
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using value_type = size_t;
|
||||
using pointer = size_t*;
|
||||
using reference = size_t&;
|
||||
using pointer = void;
|
||||
using reference = size_t;
|
||||
|
||||
private:
|
||||
size_t storeIndex;
|
||||
@@ -142,13 +145,20 @@ public:
|
||||
auto operator!=(const Iter& rhs) const -> bool {
|
||||
return storeIndex != rhs.storeIndex || bitIndex != rhs.bitIndex;
|
||||
}
|
||||
void operator++() {
|
||||
auto operator++() -> Iter& {
|
||||
bitIndex++;
|
||||
if (bitIndex >= STORE_BITS) {
|
||||
storeIndex++;
|
||||
bitIndex = 0;
|
||||
}
|
||||
ToNext();
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto operator++(int) -> Iter {
|
||||
Iter previous = *this;
|
||||
++(*this);
|
||||
return previous;
|
||||
}
|
||||
|
||||
auto operator*() const -> size_t { return (storeIndex << BIT_SHIFT) + bitIndex; }
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
|
||||
#include "RandomGenerator.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
#include <stdexcept>
|
||||
|
||||
constexpr double kOpenEndedHighThreshold = 95.0;
|
||||
constexpr double kOpenEndedLowThreshold = 5.0;
|
||||
@@ -67,7 +69,8 @@ auto RandomGenerator::ReverseOpenEndedPercentile() -> double {
|
||||
}
|
||||
|
||||
auto RandomGenerator::IntBetween(const int min, const int max) -> int {
|
||||
return int(DoubleZeroToOne() * (max - min)) + min;
|
||||
if (min >= max) { throw std::invalid_argument("random integer range must be non-empty"); }
|
||||
return std::min(int(DoubleZeroToOne() * (max - min)) + min, max - 1);
|
||||
}
|
||||
|
||||
auto RandomGenerator::IntBelow(const int max) -> int { return IntBetween(0, max); }
|
||||
@@ -94,6 +97,7 @@ StdLibraryGenerator::StdLibraryGenerator(const std::mt19937_64::result_type seed
|
||||
}
|
||||
|
||||
auto StdLibraryGenerator::IntBetween(const int min, const int max) -> int {
|
||||
if (min >= max) { throw std::invalid_argument("random integer range must be non-empty"); }
|
||||
std::uniform_int_distribution<int> unifInt(min, max - 1);
|
||||
return unifInt(engine);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <random>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
class RandomGenerator;
|
||||
@@ -41,6 +42,7 @@ public:
|
||||
|
||||
template<class T>
|
||||
auto RandomElement(const std::vector<T>& vec) -> T {
|
||||
if (vec.empty()) { throw std::invalid_argument("cannot choose from an empty vector"); }
|
||||
return vec.at(static_cast<std::size_t>(IntBelow(static_cast<int>(vec.size()))));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
#ifndef EAGLE0_COMMON_SEQUENCE_RANDOM_GENERATOR_HPP
|
||||
#define EAGLE0_COMMON_SEQUENCE_RANDOM_GENERATOR_HPP
|
||||
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -29,14 +31,24 @@ private:
|
||||
size_t position = 0;
|
||||
|
||||
auto DoubleZeroToOne() -> double override {
|
||||
if (position >= sequence.size()) { position = 0; }
|
||||
const double nextVal = sequence.at(position);
|
||||
position++;
|
||||
if (position >= sequence.size()) { position = 0; }
|
||||
return nextVal;
|
||||
}
|
||||
|
||||
public:
|
||||
explicit SequenceRandomGenerator(std::vector<double> s) : sequence(std::move(s)) {}
|
||||
explicit SequenceRandomGenerator(std::vector<double> s) : sequence(std::move(s)) {
|
||||
if (sequence.empty()) {
|
||||
throw std::invalid_argument("sequence random generator requires at least one value");
|
||||
}
|
||||
for (const double value : sequence) {
|
||||
if (!std::isfinite(value) || value < 0.0 || value > 1.0) {
|
||||
throw std::invalid_argument(
|
||||
"sequence random generator values must be between 0 and 1");
|
||||
}
|
||||
}
|
||||
}
|
||||
static auto WithSequence(const std::vector<double>& s)
|
||||
-> std::shared_ptr<SequenceRandomGenerator> {
|
||||
return std::make_shared<SequenceRandomGenerator>(s);
|
||||
|
||||
@@ -80,7 +80,7 @@ void EmitShardokLatencyTrace(
|
||||
out << "}";
|
||||
|
||||
std::scoped_lock lock(LogMutex());
|
||||
std::cerr << out.str() << std::endl;
|
||||
std::cerr << out.str() << '\n';
|
||||
}
|
||||
|
||||
ScopedShardokLatencyTrace::ScopedShardokLatencyTrace(
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <condition_variable>
|
||||
#include <functional>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
@@ -171,7 +172,7 @@ public:
|
||||
// Get detailed queue information for debugging
|
||||
void debug_queue_state() const {
|
||||
std::unique_lock<std::mutex> lock(const_cast<std::mutex&>(queue_mutex));
|
||||
printf("ThreadPool: Queue size: %zu\n", tasks.size());
|
||||
std::cout << "ThreadPool: Queue size: " << tasks.size() << '\n';
|
||||
if (!tasks.empty()) {
|
||||
// Create a copy to inspect priorities without modifying queue
|
||||
auto queue_copy = tasks;
|
||||
@@ -180,9 +181,9 @@ public:
|
||||
priorities.push_back(queue_copy.top().priority);
|
||||
queue_copy.pop();
|
||||
}
|
||||
printf("ThreadPool: Priorities in queue: ");
|
||||
for (int p : priorities) { printf("%d ", p); }
|
||||
printf("\n");
|
||||
std::cout << "ThreadPool: Priorities in queue: ";
|
||||
for (int p : priorities) { std::cout << p << ' '; }
|
||||
std::cout << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,4 +198,4 @@ public:
|
||||
|
||||
} // namespace eagle0::common
|
||||
|
||||
#endif // EAGLE0_THREADPOOL_HPP
|
||||
#endif // EAGLE0_THREADPOOL_HPP
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace shardok {
|
||||
using Coords = net::eagle0::shardok::storage::fb::Coords;
|
||||
|
||||
constexpr double kDefaultMorale = 50.0;
|
||||
constexpr float kExplicitMoraleSentinel = -1.0f;
|
||||
|
||||
auto ConvertBattalion(const net::eagle0::common::CommonBattalion &battalion) -> Battalion {
|
||||
Battalion shardokBattalion{};
|
||||
@@ -18,6 +19,10 @@ auto ConvertBattalion(const net::eagle0::common::CommonBattalion &battalion) ->
|
||||
shardokBattalion.mutate_type(
|
||||
static_cast<net::eagle0::shardok::storage::fb::BattalionTypeId>(battalion.type()));
|
||||
shardokBattalion.mutate_morale(kDefaultMorale);
|
||||
if (battalion.has_morale()) {
|
||||
shardokBattalion.mutate_morale(static_cast<float>(battalion.morale()));
|
||||
shardokBattalion.mutate_base_morale(kExplicitMoraleSentinel);
|
||||
}
|
||||
shardokBattalion.mutate_armament(static_cast<float>(battalion.armament()));
|
||||
shardokBattalion.mutate_training(static_cast<float>(battalion.training()));
|
||||
|
||||
@@ -125,4 +130,4 @@ auto ConvertUnit(
|
||||
return shardokUnit;
|
||||
}
|
||||
|
||||
} // namespace shardok
|
||||
} // namespace shardok
|
||||
|
||||
@@ -9,18 +9,24 @@
|
||||
#ifndef EAGLE0_COMMON_BYTE_VECTOR_HPP
|
||||
#define EAGLE0_COMMON_BYTE_VECTOR_HPP
|
||||
|
||||
#include <charconv>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <initializer_list>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
class byte_vector : public vector<uint8_t> {
|
||||
class byte_vector {
|
||||
private:
|
||||
std::vector<uint8_t> bytes_;
|
||||
|
||||
public:
|
||||
class HexException : public std::exception {
|
||||
const std::string description;
|
||||
@@ -35,60 +41,78 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
static auto HexNibbleToValue(const char nibble) -> uint8_t {
|
||||
if (nibble >= '0' && nibble <= '9') {
|
||||
return uint8_t(nibble - '0');
|
||||
} else if (nibble >= 'A' && nibble <= 'F') {
|
||||
return uint8_t(nibble - 'A' + 10);
|
||||
} else if (nibble >= 'a' && nibble <= 'f') {
|
||||
return uint8_t(nibble - 'a' + 10);
|
||||
static auto HexCharsToByte(const std::string_view digits) -> uint8_t {
|
||||
unsigned int parsedByte = 0;
|
||||
const auto [ptr, ec] =
|
||||
std::from_chars(digits.data(), digits.data() + digits.size(), parsedByte, 16);
|
||||
if (ec != std::errc() || ptr != digits.data() + digits.size()) {
|
||||
throw HexException(ptr == digits.data() + digits.size() ? digits.back() : *ptr);
|
||||
}
|
||||
throw HexException(nibble);
|
||||
}
|
||||
|
||||
static auto HexCharsToByte(std::istringstream& str) -> uint8_t {
|
||||
uint8_t b = 0;
|
||||
char c = 0;
|
||||
str >> c;
|
||||
b |= (HexNibbleToValue(c) << 4u);
|
||||
str >> c;
|
||||
b |= HexNibbleToValue(c);
|
||||
return b;
|
||||
return static_cast<uint8_t>(parsedByte);
|
||||
}
|
||||
|
||||
public:
|
||||
byte_vector() = default;
|
||||
byte_vector(const std::initializer_list<uint8_t> list) : vector<uint8_t>(list) {}
|
||||
byte_vector(const std::initializer_list<uint8_t> list) : bytes_(list) {}
|
||||
template<class InputIt>
|
||||
byte_vector(InputIt begin, InputIt end) : vector<uint8_t>(begin, end) {}
|
||||
byte_vector(InputIt begin, InputIt end) : bytes_(begin, end) {}
|
||||
byte_vector(const byte_vector& rhs) = default;
|
||||
explicit byte_vector(const std::string& s) : byte_vector(s.begin(), s.end()) {}
|
||||
explicit byte_vector(const size_t size) : vector<uint8_t>(size) {}
|
||||
explicit byte_vector(void* data, const size_t size) : vector<uint8_t>(size) {
|
||||
this->assign((uint8_t*)data, (uint8_t*)data + size);
|
||||
byte_vector(byte_vector&& rhs) noexcept = default;
|
||||
explicit byte_vector(const std::string& s) : bytes_(s.begin(), s.end()) {}
|
||||
explicit byte_vector(std::vector<uint8_t> bytes) : bytes_(std::move(bytes)) {}
|
||||
explicit byte_vector(const size_t size) : bytes_(size) {}
|
||||
explicit byte_vector(const void* data, const size_t size) {
|
||||
auto* bytes = static_cast<const uint8_t*>(data);
|
||||
bytes_.assign(bytes, bytes + size);
|
||||
}
|
||||
|
||||
auto operator==(const vector<uint8_t>& vec) -> bool {
|
||||
if (this->size() != vec.size()) return false;
|
||||
for (size_t i = 0; i < size(); i++) {
|
||||
if ((*this)[i] != vec[i]) return false;
|
||||
}
|
||||
return true;
|
||||
auto operator=(const byte_vector& rhs) -> byte_vector& = default;
|
||||
auto operator=(byte_vector&& rhs) noexcept -> byte_vector& = default;
|
||||
|
||||
[[nodiscard]] auto operator==(const std::vector<uint8_t>& vec) const -> bool {
|
||||
return bytes_ == vec;
|
||||
}
|
||||
[[nodiscard]] auto operator==(const byte_vector& vec) const -> bool {
|
||||
return bytes_ == vec.bytes_;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto data() -> uint8_t* { return bytes_.data(); }
|
||||
[[nodiscard]] auto data() const -> const uint8_t* { return bytes_.data(); }
|
||||
[[nodiscard]] auto size() const -> size_t { return bytes_.size(); }
|
||||
[[nodiscard]] auto empty() const -> bool { return bytes_.empty(); }
|
||||
void reserve(const size_t count) { bytes_.reserve(count); }
|
||||
void resize(const size_t count) { bytes_.resize(count); }
|
||||
void swap(byte_vector& other) noexcept { bytes_.swap(other.bytes_); }
|
||||
|
||||
[[nodiscard]] auto begin() -> std::vector<uint8_t>::iterator { return bytes_.begin(); }
|
||||
[[nodiscard]] auto begin() const -> std::vector<uint8_t>::const_iterator {
|
||||
return bytes_.begin();
|
||||
}
|
||||
[[nodiscard]] auto end() -> std::vector<uint8_t>::iterator { return bytes_.end(); }
|
||||
[[nodiscard]] auto end() const -> std::vector<uint8_t>::const_iterator { return bytes_.end(); }
|
||||
[[nodiscard]] auto cbegin() const -> std::vector<uint8_t>::const_iterator {
|
||||
return bytes_.cbegin();
|
||||
}
|
||||
[[nodiscard]] auto cend() const -> std::vector<uint8_t>::const_iterator {
|
||||
return bytes_.cend();
|
||||
}
|
||||
|
||||
[[nodiscard]] auto operator[](const size_t index) -> uint8_t& { return bytes_[index]; }
|
||||
[[nodiscard]] auto operator[](const size_t index) const -> uint8_t { return bytes_[index]; }
|
||||
|
||||
auto append(const char* bytes, const size_t length) {
|
||||
const auto previousSize = this->size();
|
||||
this->resize(previousSize + length);
|
||||
std::memcpy(this->data() + previousSize, bytes, length);
|
||||
const auto previousSize = size();
|
||||
resize(previousSize + length);
|
||||
std::memcpy(data() + previousSize, bytes, length);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
auto append(const T* elts, const size_t count) {
|
||||
append((char*)elts, count * sizeof(T));
|
||||
append(reinterpret_cast<const char*>(elts), count * sizeof(T));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
auto append(const vector<T> elts) {
|
||||
auto append(const vector<T>& elts) {
|
||||
append(elts.data(), elts.size());
|
||||
}
|
||||
|
||||
@@ -98,7 +122,7 @@ public:
|
||||
}
|
||||
|
||||
auto operator+=(const uint8_t c) -> byte_vector& {
|
||||
this->insert(end(), c);
|
||||
bytes_.push_back(c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -111,7 +135,7 @@ public:
|
||||
|
||||
template<class Iterable>
|
||||
auto operator+=(const Iterable& rhs) -> byte_vector& {
|
||||
this->insert(end(), rhs.cbegin(), rhs.cend());
|
||||
bytes_.insert(end(), rhs.cbegin(), rhs.cend());
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -119,7 +143,7 @@ public:
|
||||
if (size() < 8) {
|
||||
uint64_t total = 0;
|
||||
for (size_t i = 0; i < size(); i++) {
|
||||
total <<= 8u;
|
||||
total <<= 8U;
|
||||
total += (*this)[i];
|
||||
}
|
||||
return total;
|
||||
@@ -128,9 +152,9 @@ public:
|
||||
uint64_t firstBytes = 0;
|
||||
uint64_t lastBytes = 0;
|
||||
for (unsigned i = 0; i < 8; i++) {
|
||||
firstBytes <<= 8u;
|
||||
firstBytes <<= 8U;
|
||||
firstBytes += (*this)[i];
|
||||
lastBytes <<= 8u;
|
||||
lastBytes <<= 8U;
|
||||
lastBytes += (*this)[i];
|
||||
}
|
||||
|
||||
@@ -141,8 +165,8 @@ public:
|
||||
std::ifstream inputFileStream(path, std::ios::binary | std::ios::ate);
|
||||
const std::streamsize size = inputFileStream.tellg();
|
||||
inputFileStream.seekg(0, std::ios::beg);
|
||||
this->resize((size_t(size)));
|
||||
inputFileStream.read((char*)this->data(), size);
|
||||
this->resize(static_cast<size_t>(size));
|
||||
inputFileStream.read(reinterpret_cast<char*>(this->data()), size);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -153,34 +177,41 @@ public:
|
||||
}
|
||||
const std::streamsize size = inputFileStream.tellg();
|
||||
inputFileStream.seekg(0, std::ios::beg);
|
||||
byte_vector serializedGame((size_t(size)));
|
||||
inputFileStream.read((char*)serializedGame.data(), size);
|
||||
byte_vector serializedGame(static_cast<size_t>(size));
|
||||
inputFileStream.read(reinterpret_cast<char*>(serializedGame.data()), size);
|
||||
return serializedGame;
|
||||
}
|
||||
|
||||
static auto FromHex(const char* hexString) -> byte_vector { return FromHex(string(hexString)); }
|
||||
|
||||
static auto FromHex(string hexString) -> byte_vector {
|
||||
if (hexString[0] == '0' && (hexString[1] == 'x' || hexString[1] == 'X')) {
|
||||
hexString = string(hexString.begin() + 1, hexString.end());
|
||||
static auto FromHex(const string& hexString) -> byte_vector {
|
||||
std::string_view digits(hexString);
|
||||
if (digits.starts_with("0x") || digits.starts_with("0X")) {
|
||||
digits.remove_prefix(2);
|
||||
} else if (digits.starts_with("x") || digits.starts_with("X")) {
|
||||
digits.remove_prefix(1);
|
||||
}
|
||||
if (hexString[0] == 'x' || hexString[0] == 'X') {
|
||||
hexString = string(hexString.begin() + 1, hexString.end());
|
||||
}
|
||||
byte_vector vec;
|
||||
const size_t len = hexString.size();
|
||||
vec.reserve(len / 2);
|
||||
std::istringstream hexStream(hexString);
|
||||
|
||||
while (size_t(hexStream.tellg()) < len) { vec += HexCharsToByte(hexStream); }
|
||||
if (digits.size() % 2 != 0) { throw HexException(digits.empty() ? '\0' : digits.back()); }
|
||||
|
||||
byte_vector vec;
|
||||
vec.reserve(digits.size() / 2);
|
||||
|
||||
for (size_t index = 0; index < digits.size(); index += 2) {
|
||||
vec += HexCharsToByte(digits.substr(index, 2));
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
||||
explicit operator std::string() const { return std::string(begin(), end()); }
|
||||
};
|
||||
|
||||
inline auto operator<<(std::ostream& ostr, byte_vector vec) -> std::ostream& {
|
||||
ostr.write((char*)vec.data(), (std::streamsize)vec.size());
|
||||
inline auto operator==(const std::vector<uint8_t>& lhs, const byte_vector& rhs) -> bool {
|
||||
return rhs == lhs;
|
||||
}
|
||||
|
||||
inline auto operator<<(std::ostream& ostr, const byte_vector& vec) -> std::ostream& {
|
||||
ostr.write(reinterpret_cast<const char*>(vec.data()), static_cast<std::streamsize>(vec.size()));
|
||||
return ostr;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
#include <fstream>
|
||||
#include <future>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <mutex>
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
|
||||
@@ -207,8 +209,8 @@ auto AbstractMCTSAI::BuildMCTSTree(
|
||||
}));
|
||||
}
|
||||
|
||||
// Wait for all threads to complete
|
||||
for (auto& future : futures) { future.wait(); }
|
||||
// Wait for all threads to complete and propagate worker exceptions.
|
||||
for (auto& future : futures) { future.get(); }
|
||||
} else {
|
||||
// Single-threaded MCTS
|
||||
while (std::chrono::steady_clock::now() < deadline) {
|
||||
@@ -862,12 +864,12 @@ auto AbstractMCTSAI::LogSearchResults(
|
||||
// Log selected command
|
||||
const std::string selectedDesc =
|
||||
bestChild->action ? bestChild->action->getDescription() : "Unknown";
|
||||
printf("MCTS: Selected %s (visit:%d, reward:%.2f, lookahead:%.2f) from %zu options\n",
|
||||
selectedDesc.c_str(),
|
||||
bestChild->visitCount,
|
||||
bestChild->averageReward,
|
||||
bestChild->lookaheadScore,
|
||||
rootNode->children.size());
|
||||
std::ostringstream selectedLine;
|
||||
selectedLine << std::fixed << std::setprecision(2) << "MCTS: Selected " << selectedDesc
|
||||
<< " (visit:" << bestChild->visitCount << ", reward:" << bestChild->averageReward
|
||||
<< ", lookahead:" << bestChild->lookaheadScore << ") from "
|
||||
<< rootNode->children.size() << " options";
|
||||
std::cout << selectedLine.str() << '\n';
|
||||
|
||||
// Log top 3 actions by visits
|
||||
std::vector<const MCTSNode*> sortedChildren;
|
||||
@@ -879,20 +881,17 @@ auto AbstractMCTSAI::LogSearchResults(
|
||||
|
||||
// Show all actions if there are <= 10, otherwise top 5
|
||||
const size_t numToShow = sortedChildren.size() <= 10 ? sortedChildren.size() : 5;
|
||||
printf("MCTS: Top %zu actions by visits (out of %zu total):\n",
|
||||
numToShow,
|
||||
sortedChildren.size());
|
||||
std::cout << "MCTS: Top " << numToShow << " actions by visits (out of " << sortedChildren.size()
|
||||
<< " total):\n";
|
||||
for (size_t i = 0; i < numToShow; ++i) {
|
||||
const auto* child = sortedChildren[i];
|
||||
printf(" [%zu] visits:%d avgReward:%.2f immediate:%.2f lookahead:%.2f",
|
||||
i,
|
||||
child->visitCount,
|
||||
child->averageReward,
|
||||
child->immediateScore,
|
||||
child->lookaheadScore);
|
||||
std::ostringstream line;
|
||||
line << std::fixed << std::setprecision(2) << " [" << i << "] visits:" << child->visitCount
|
||||
<< " avgReward:" << child->averageReward << " immediate:" << child->immediateScore
|
||||
<< " lookahead:" << child->lookaheadScore;
|
||||
|
||||
// Show the action's own description
|
||||
if (child->action) { printf(" %s", child->action->getDescription().c_str()); }
|
||||
if (child->action) { line << ' ' << child->action->getDescription(); }
|
||||
|
||||
// Show sequence preview
|
||||
if (!child->children.empty()) {
|
||||
@@ -905,16 +904,15 @@ auto AbstractMCTSAI::LogSearchResults(
|
||||
}
|
||||
}
|
||||
if (bestNext && bestNext->action) {
|
||||
printf(" -> %s", bestNext->action->getDescription().c_str());
|
||||
line << " -> " << bestNext->action->getDescription();
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
std::cout << line.str() << '\n';
|
||||
}
|
||||
|
||||
printf("MCTS: Tree stats - max depth:%d, total nodes:%d, root visits:%d\n",
|
||||
result.searchDepth,
|
||||
result.nodesEvaluated,
|
||||
rootNode->visitCount);
|
||||
std::cout << "MCTS: Tree stats - max depth:" << result.searchDepth
|
||||
<< ", total nodes:" << result.nodesEvaluated
|
||||
<< ", root visits:" << rootNode->visitCount << '\n';
|
||||
|
||||
// Log best sequence from chosen action (following most-visited path)
|
||||
std::vector<const MCTSNode*> bestSequence;
|
||||
@@ -940,7 +938,10 @@ auto AbstractMCTSAI::LogSearchResults(
|
||||
}
|
||||
|
||||
if (!bestSequence.empty()) {
|
||||
printf("MCTS: Best sequence from chosen action (final: %.2f):\n", sequenceScore);
|
||||
std::ostringstream sequenceLine;
|
||||
sequenceLine << std::fixed << std::setprecision(2)
|
||||
<< "MCTS: Best sequence from chosen action (final: " << sequenceScore << "):";
|
||||
std::cout << sequenceLine.str() << '\n';
|
||||
int displayedStep = 0;
|
||||
for (size_t i = 0; i < bestSequence.size(); ++i) {
|
||||
const auto* node = bestSequence[i];
|
||||
@@ -949,29 +950,31 @@ auto AbstractMCTSAI::LogSearchResults(
|
||||
if (i > 0 && node->parent && node->parent->IsChanceNode()) { continue; }
|
||||
|
||||
displayedStep++;
|
||||
printf(" %d.", displayedStep);
|
||||
if (node->action) { printf(" %s", node->action->getDescription().c_str()); }
|
||||
std::ostringstream line;
|
||||
line << " " << displayedStep << ".";
|
||||
if (node->action) { line << ' ' << node->action->getDescription(); }
|
||||
|
||||
// If this is a chance node, display outcome probabilities and scores
|
||||
if (node->IsChanceNode() && !node->outcomeProbabilities.empty()) {
|
||||
printf(" [");
|
||||
line << " [";
|
||||
for (size_t j = 0; j < node->outcomeProbabilities.size(); ++j) {
|
||||
if (j > 0) printf(", ");
|
||||
if (j > 0) { line << ", "; }
|
||||
const double prob = node->outcomeProbabilities[j] * 100;
|
||||
// Show lookahead score for each outcome if child exists
|
||||
if (j < node->children.size() && node->children[j]->visitCount > 0) {
|
||||
printf("%.0f%%->%.1f", prob, node->children[j]->lookaheadScore);
|
||||
line << std::fixed << std::setprecision(0) << prob << "%->"
|
||||
<< std::setprecision(1) << node->children[j]->lookaheadScore;
|
||||
} else {
|
||||
printf("%.0f%%->?", prob);
|
||||
line << std::fixed << std::setprecision(0) << prob << "%->?";
|
||||
}
|
||||
}
|
||||
printf("]");
|
||||
line << "]";
|
||||
}
|
||||
|
||||
printf(" (visits:%d, immediate:%.2f, lookahead:%.2f)\n",
|
||||
node->visitCount,
|
||||
node->immediateScore,
|
||||
node->lookaheadScore);
|
||||
line << std::fixed << std::setprecision(2) << " (visits:" << node->visitCount
|
||||
<< ", immediate:" << node->immediateScore << ", lookahead:" << node->lookaheadScore
|
||||
<< ")";
|
||||
std::cout << line.str() << '\n';
|
||||
|
||||
// For non-root nodes in the sequence, show what the top alternatives were
|
||||
// Skip showing alternatives for chance nodes (they have outcome children, not action
|
||||
@@ -991,17 +994,17 @@ auto AbstractMCTSAI::LogSearchResults(
|
||||
});
|
||||
|
||||
// Show top 3 alternatives at this decision point
|
||||
printf(" Alternatives at this node (%zu total):\n", siblings.size());
|
||||
std::cout << " Alternatives at this node (" << siblings.size() << " total):\n";
|
||||
const size_t topN = std::min(siblings.size(), size_t(3));
|
||||
for (size_t j = 0; j < topN; ++j) {
|
||||
const auto* alt = siblings[j];
|
||||
printf(" [%zu] visits:%d immediate:%.2f lookahead:%.2f",
|
||||
j,
|
||||
alt->visitCount,
|
||||
alt->immediateScore,
|
||||
alt->lookaheadScore);
|
||||
if (alt->action) { printf(" %s", alt->action->getDescription().c_str()); }
|
||||
printf("\n");
|
||||
std::ostringstream altLine;
|
||||
altLine << std::fixed << std::setprecision(2) << " [" << j
|
||||
<< "] visits:" << alt->visitCount
|
||||
<< " immediate:" << alt->immediateScore
|
||||
<< " lookahead:" << alt->lookaheadScore;
|
||||
if (alt->action) { altLine << ' ' << alt->action->getDescription(); }
|
||||
std::cout << altLine.str() << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1013,7 +1016,7 @@ auto AbstractMCTSAI::DumpTreeToFile(const MCTSNode* root, const std::string& fil
|
||||
|
||||
std::ofstream out(filepath);
|
||||
if (!out) {
|
||||
fprintf(stderr, "Failed to open dump file: %s\n", filepath.c_str());
|
||||
std::cerr << "Failed to open dump file: " << filepath << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1042,7 +1045,7 @@ auto AbstractMCTSAI::DumpTreeToFile(const MCTSNode* root, const std::string& fil
|
||||
out << "\n=== End of Tree Dump ===\n";
|
||||
out.close();
|
||||
|
||||
printf("MCTS: Tree dumped to %s\n", filepath.c_str());
|
||||
std::cout << "MCTS: Tree dumped to " << filepath << '\n';
|
||||
}
|
||||
|
||||
auto AbstractMCTSAI::DumpNodeRecursive(
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
#define EAGLE0_ABSTRACT_MCTSNODE_HPP
|
||||
|
||||
#include <cmath>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include "MCTSAction.hpp"
|
||||
@@ -205,13 +208,13 @@ struct MCTSNode {
|
||||
isMaximizingPlayer ? child->lookaheadScore : -child->lookaheadScore;
|
||||
const double explorationValue =
|
||||
explorationConstant * std::sqrt(std::log(visitCount) / child->visitCount);
|
||||
printf(" UCB: %s lookahead=%.2f expl=%.2f (+%.2f) = %.2f [%s]\n",
|
||||
isMaximizingPlayer ? "MAX" : "MIN",
|
||||
child->lookaheadScore,
|
||||
exploitationValue,
|
||||
explorationValue,
|
||||
value,
|
||||
child->action ? child->action->getDescription().c_str() : "root");
|
||||
std::ostringstream line;
|
||||
line << std::fixed << std::setprecision(2)
|
||||
<< " UCB: " << (isMaximizingPlayer ? "MAX" : "MIN")
|
||||
<< " lookahead=" << child->lookaheadScore << " expl=" << exploitationValue
|
||||
<< " (+" << explorationValue << ") = " << value << " ["
|
||||
<< (child->action ? child->action->getDescription() : "root") << "]";
|
||||
std::cout << line.str() << '\n';
|
||||
}
|
||||
|
||||
if (value > bestValue) {
|
||||
|
||||
@@ -28,36 +28,6 @@ cc_binary(
|
||||
deps = [":shardok-server-lib"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "shardok-inspector",
|
||||
srcs = ["shardok_inspector.cpp"],
|
||||
copts = COPTS,
|
||||
data = [
|
||||
"//src/main/resources/net/eagle0/shardok:battalion_types",
|
||||
"//src/main/resources/net/eagle0/shardok:settings",
|
||||
"//src/main/resources/net/eagle0/shardok/maps",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//src/main/cpp/net/eagle0/common:byte_vector",
|
||||
"//src/main/cpp/net/eagle0/common:filesystem_utils",
|
||||
"//src/main/cpp/net/eagle0/common:tsv_parser",
|
||||
"//src/main/cpp/net/eagle0/shardok/library:engine",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "corrupt-game-checker",
|
||||
srcs = ["CorruptGameChecker.cpp"],
|
||||
copts = COPTS,
|
||||
deps = [
|
||||
"//src/main/cpp/net/eagle0/common:byte_vector",
|
||||
"//src/main/cpp/net/eagle0/common:filesystem_utils",
|
||||
"//src/main/cpp/net/eagle0/shardok/library:game_state_w",
|
||||
"//src/main/protobuf/net/eagle0/common:shardok_internal_interface_cc_grpc",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "hex-map-migrator",
|
||||
srcs = ["HexMapMigrator.cpp"],
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
//
|
||||
// Created by Dan Crosby on 1/9/22.
|
||||
//
|
||||
|
||||
#include "src/main/cpp/net/eagle0/common/byte_vector.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/GameStateW.hpp"
|
||||
#include "src/main/protobuf/net/eagle0/common/shardok_internal_interface.pb.h"
|
||||
#include "src/main/protobuf/net/eagle0/shardok/storage/game.pb.h"
|
||||
|
||||
auto main(int argc, char** argv) -> int {
|
||||
char* path = argv[1];
|
||||
|
||||
printf("Checking file %s\n", path);
|
||||
|
||||
auto bytes = byte_vector::FromPath(path);
|
||||
|
||||
net::eagle0::shardok::storage::Game game;
|
||||
game.ParseFromArray(bytes.data(), bytes.size());
|
||||
|
||||
printf("The game ID is %s\n", game.game_id().c_str());
|
||||
printf("The size is %lu\n", bytes.size());
|
||||
|
||||
const int arCount = game.action_result_size();
|
||||
printf("There are %d results\n", arCount);
|
||||
|
||||
for (int arIndex = 0; arIndex < arCount; arIndex++) {
|
||||
shardok::GameStateW gameState =
|
||||
shardok::GameStateW::FromByteString(game.action_result(arIndex).state_after_fb());
|
||||
const auto* hexMap = gameState->hex_map();
|
||||
|
||||
for (int terrainIndex = 0; terrainIndex < hexMap->terrain()->size(); terrainIndex++) {
|
||||
const auto* terrain = hexMap->terrain()->Get(terrainIndex);
|
||||
if (terrain->type() == net::eagle0::shardok::storage::fb::Terrain_::Type_STILL_WATER)
|
||||
continue;
|
||||
if (terrain->type() == net::eagle0::shardok::storage::fb::Terrain_::Type_RIVER)
|
||||
continue;
|
||||
|
||||
if (terrain->modifier().bridge().present()) {
|
||||
printf("Caught one! arIndex %d, terrainIndex %d\n", arIndex, terrainIndex);
|
||||
printf("Action result was %s\n",
|
||||
game.action_result(arIndex).action_result().DebugString().c_str());
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
// Created by Dan Crosby on 3/19/20.
|
||||
//
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
||||
#include "src/main/cpp/net/eagle0/common/FilesystemUtils.hpp"
|
||||
#include "src/main/cpp/net/eagle0/common/byte_vector.hpp"
|
||||
@@ -14,7 +14,7 @@ void ModifyMap(HexMapProto& map);
|
||||
|
||||
int main(const int argc, char** argv) {
|
||||
if (argc < 3) {
|
||||
printf("Usage: %s input_path output_path\n", argv[0]);
|
||||
std::cerr << "Usage: " << argv[0] << " input_path output_path\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -22,21 +22,25 @@ int main(const int argc, char** argv) {
|
||||
const std::string outputPath = argv[2];
|
||||
const byte_vector mapProtoBytes = byte_vector::FromPath(inputPath);
|
||||
net::eagle0::shardok::common::HexMap mapProto;
|
||||
mapProto.ParseFromArray(mapProtoBytes.data(), (int)mapProtoBytes.size());
|
||||
if (!mapProto.ParseFromArray(mapProtoBytes.data(), static_cast<int>(mapProtoBytes.size()))) {
|
||||
std::cerr << "Failed to parse hex map from " << inputPath << '\n';
|
||||
return -1;
|
||||
}
|
||||
|
||||
ModifyMap(mapProto);
|
||||
const std::string outputString = mapProto.SerializeAsString();
|
||||
if (FilesystemUtils::AtomicallySaveToPath(outputPath, byte_vector(outputString))) return 0;
|
||||
|
||||
printf("Failed to save.\n");
|
||||
std::cerr << "Failed to save.\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ModifyMap(HexMapProto& map) {
|
||||
for (int i = 0; i < map.terrain_size(); i++) {
|
||||
const int terrainCount = map.terrain_size();
|
||||
for (int i = 0; i < terrainCount; ++i) {
|
||||
const auto existingTerrainType = map.terrain(i).type();
|
||||
const auto newTerrain =
|
||||
(net::eagle0::shardok::common::Terrain_Type)(existingTerrainType + 2);
|
||||
static_cast<net::eagle0::shardok::common::Terrain_Type>(existingTerrainType + 2);
|
||||
map.mutable_terrain(i)->set_type(newTerrain);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,50 +4,52 @@
|
||||
|
||||
#include "MapInfoCalculator.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/ai/AIWaterCrossingCalculator.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/fb_helpers/HexMapHelpers.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/util/HexMapUtils.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/util/MapLoader.hpp"
|
||||
|
||||
using namespace shardok;
|
||||
using std::endl;
|
||||
|
||||
auto LoadMapFb(const string& mapName) -> Wrapper<HexMap> {
|
||||
auto LoadMapFb(const std::string& mapName) -> shardok::Wrapper<shardok::HexMap> {
|
||||
const HexMapProto mapProto = LoadMap(mapName);
|
||||
|
||||
flatbuffers::FlatBufferBuilder fbb{};
|
||||
const auto hexMapOffset = fb::ConvertHexMapProto(fbb, mapProto);
|
||||
const auto hexMapOffset = shardok::fb::ConvertHexMapProto(fbb, mapProto);
|
||||
fbb.Finish(hexMapOffset);
|
||||
return Wrapper<HexMap>(fbb);
|
||||
return shardok::Wrapper<shardok::HexMap>(fbb);
|
||||
}
|
||||
|
||||
auto CalculateMap(
|
||||
const string& mapName,
|
||||
const std::shared_ptr<ActionPointDistancesCache>& apdCache,
|
||||
const BattalionTypeSPtr& battalionType) -> OneMapInfo {
|
||||
const std::string& mapName,
|
||||
const std::shared_ptr<shardok::ActionPointDistancesCache>& apdCache,
|
||||
const shardok::BattalionTypeSPtr& battalionType) -> OneMapInfo {
|
||||
auto hexMap = LoadMapFb(mapName);
|
||||
|
||||
const auto mapId = ActionPointDistancesCache::GetMapId(hexMap);
|
||||
const auto mapId = shardok::ActionPointDistancesCache::GetMapId(hexMap);
|
||||
|
||||
const CoordsSet criticalTileLocations = GetCriticalTileLocations(hexMap);
|
||||
const shardok::CoordsSet criticalTileLocations = shardok::GetCriticalTileLocations(hexMap);
|
||||
|
||||
OneMapInfo info{
|
||||
.castleCount = criticalTileLocations.size(),
|
||||
.name = mapName,
|
||||
.positionsRequiringCrossing = {}};
|
||||
|
||||
for (unsigned int i = 0; i < hexMap->attacker_starting_positions()->size(); i++) {
|
||||
for (std::size_t i = 0; i < hexMap->attacker_starting_positions()->size(); ++i) {
|
||||
const auto* positionList = hexMap->attacker_starting_positions()->Get(i);
|
||||
if (positionList->positions()->size() < 1) continue;
|
||||
if (positionList->positions()->size() != 10) {
|
||||
printf("Should have 10 starting positions!");
|
||||
abort();
|
||||
const auto* positions = positionList->positions();
|
||||
if (positions->empty()) continue;
|
||||
if (positions->size() != 10) {
|
||||
std::cerr << "Should have 10 starting positions!" << '\n';
|
||||
std::abort();
|
||||
}
|
||||
|
||||
int positionsRequiringCrossing = 0;
|
||||
for (const auto* startingPosition : *positionList->positions()) {
|
||||
for (const Coords& castlePosition : criticalTileLocations) {
|
||||
if (!CanReach(
|
||||
for (const auto* startingPosition : *positions) {
|
||||
for (const shardok::Coords& castlePosition : criticalTileLocations) {
|
||||
if (!shardok::CanReach(
|
||||
*startingPosition,
|
||||
castlePosition,
|
||||
hexMap,
|
||||
@@ -56,11 +58,11 @@ auto CalculateMap(
|
||||
battalionType)) {
|
||||
++positionsRequiringCrossing;
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
info.positionsRequiringCrossing[i] = positionsRequiringCrossing;
|
||||
info.positionsRequiringCrossing[static_cast<int>(i)] = positionsRequiringCrossing;
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,19 +12,15 @@
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/action_point_distances/ActionPointDistancesCache.hpp"
|
||||
|
||||
using namespace shardok;
|
||||
using std::map;
|
||||
using std::string;
|
||||
|
||||
struct OneMapInfo {
|
||||
struct alignas(64) OneMapInfo {
|
||||
uint32_t castleCount;
|
||||
string name;
|
||||
map<int, int> positionsRequiringCrossing;
|
||||
} __attribute__((aligned(64)));
|
||||
std::string name;
|
||||
std::map<int, int> positionsRequiringCrossing;
|
||||
};
|
||||
|
||||
auto CalculateMap(
|
||||
const string& mapName,
|
||||
const std::shared_ptr<ActionPointDistancesCache>& apdCache,
|
||||
const BattalionTypeSPtr& battalionType) -> OneMapInfo;
|
||||
[[nodiscard]] auto CalculateMap(
|
||||
const std::string& mapName,
|
||||
const std::shared_ptr<shardok::ActionPointDistancesCache>& apdCache,
|
||||
const shardok::BattalionTypeSPtr& battalionType) -> OneMapInfo;
|
||||
|
||||
#endif // EAGLE0_MAPINFOCALCULATOR_HPP
|
||||
|
||||
@@ -2,37 +2,42 @@
|
||||
// Created by Dan Crosby on 4/18/22.
|
||||
//
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "MapInfoCalculator.hpp"
|
||||
#include "src/main/cpp/net/eagle0/common/FilesystemUtils.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/util/BattalionTypeRegistrar.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/util/MapLoader.hpp"
|
||||
|
||||
using namespace shardok;
|
||||
using std::endl;
|
||||
|
||||
auto main(const int argc, char** argv) -> int {
|
||||
FilesystemUtils::SetExecPath(argv[0]);
|
||||
|
||||
std::ostream* outputStreamPtr = &std::cout;
|
||||
std::ofstream outputFile{};
|
||||
if (argc > 1) {
|
||||
const string outputPath = argv[1];
|
||||
outputStreamPtr = new std::ofstream(outputPath);
|
||||
const std::string outputPath = argv[1];
|
||||
outputFile.open(outputPath);
|
||||
outputStreamPtr = &outputFile;
|
||||
}
|
||||
std::ostream& outputStream = *outputStreamPtr;
|
||||
|
||||
const auto gameSettings = std::make_shared<GameSettings>();
|
||||
const auto gameSettings = std::make_shared<shardok::GameSettings>();
|
||||
auto setter = gameSettings->GetSetter();
|
||||
BattalionTypeRegistrar::RegisterBattalionTypes(setter);
|
||||
const BattalionTypeSPtr& battalionType = gameSettings->GetGetter().GetBattalionType(
|
||||
shardok::BattalionTypeRegistrar::RegisterBattalionTypes(setter);
|
||||
const shardok::BattalionTypeSPtr& battalionType = gameSettings->GetGetter().GetBattalionType(
|
||||
net::eagle0::shardok::storage::fb::BattalionTypeId_LIGHT_INFANTRY);
|
||||
|
||||
vector<OneMapInfo> mapInfos{};
|
||||
for (const string& mapName : GetMapNames()) {
|
||||
std::shared_ptr<ActionPointDistancesCache> apdCache =
|
||||
std::make_shared<ActionPointDistancesCache>();
|
||||
const std::vector<std::string> mapNames = GetMapNames();
|
||||
std::vector<OneMapInfo> mapInfos{};
|
||||
mapInfos.reserve(mapNames.size());
|
||||
for (const std::string& mapName : mapNames) {
|
||||
std::shared_ptr<shardok::ActionPointDistancesCache> apdCache =
|
||||
std::make_shared<shardok::ActionPointDistancesCache>();
|
||||
|
||||
mapInfos.push_back(CalculateMap(mapName, apdCache, battalionType));
|
||||
}
|
||||
@@ -41,29 +46,29 @@ auto main(const int argc, char** argv) -> int {
|
||||
bool firstMap = true;
|
||||
for (const OneMapInfo& mapInfo : mapInfos) {
|
||||
if (firstMap) {
|
||||
outputStream << endl;
|
||||
outputStream << '\n';
|
||||
firstMap = false;
|
||||
} else {
|
||||
outputStream << "," << endl;
|
||||
outputStream << "," << '\n';
|
||||
}
|
||||
outputStream << " {" << endl;
|
||||
outputStream << R"( "name": ")" << mapInfo.name << "\"," << endl;
|
||||
outputStream << " {" << '\n';
|
||||
outputStream << R"( "name": ")" << mapInfo.name << "\"," << '\n';
|
||||
|
||||
outputStream << " \"castleCount\": " << mapInfo.castleCount << "," << endl;
|
||||
outputStream << " \"castleCount\": " << mapInfo.castleCount << "," << '\n';
|
||||
outputStream << " \"positions\": {";
|
||||
|
||||
bool firstPosition = true;
|
||||
for (const auto& [position, count] : mapInfo.positionsRequiringCrossing) {
|
||||
if (firstPosition) {
|
||||
outputStream << endl;
|
||||
outputStream << '\n';
|
||||
firstPosition = false;
|
||||
} else {
|
||||
outputStream << "," << endl;
|
||||
outputStream << "," << '\n';
|
||||
}
|
||||
|
||||
outputStream << " \"" << position << "\": " << count;
|
||||
}
|
||||
outputStream << endl << " }" << endl << " }";
|
||||
outputStream << '\n' << " }" << '\n' << " }";
|
||||
}
|
||||
outputStream << endl << "]" << endl;
|
||||
outputStream << '\n' << "]" << '\n';
|
||||
}
|
||||
|
||||
@@ -2,10 +2,17 @@
|
||||
// Created by Dan Crosby on 3/29/21.
|
||||
//
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <climits>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <mutex>
|
||||
#include <random>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "src/main/cpp/net/eagle0/common/FilesystemUtils.hpp"
|
||||
#include "src/main/cpp/net/eagle0/common/UnitConversions.hpp"
|
||||
@@ -14,8 +21,6 @@
|
||||
#include "src/main/protobuf/net/eagle0/common/random_units.pb.h"
|
||||
|
||||
using net::eagle0::common::RandomUnits;
|
||||
using std::shared_ptr;
|
||||
using std::vector;
|
||||
|
||||
constexpr int THREAD_COUNT = 16;
|
||||
|
||||
@@ -28,98 +33,132 @@ std::random_device rd;
|
||||
std::mt19937 g(rd());
|
||||
#endif
|
||||
|
||||
vector<string> fileNames{};
|
||||
std::mutex randomMutex;
|
||||
std::vector<std::string> fileNames{};
|
||||
|
||||
using namespace shardok;
|
||||
|
||||
ShardokGamesManager* manager;
|
||||
std::unique_ptr<shardok::ShardokGamesManager> manager;
|
||||
|
||||
auto randInt(const int lowInc, const int hiInc) {
|
||||
std::lock_guard<std::mutex> lock(randomMutex);
|
||||
return std::uniform_int_distribution(lowInc, hiInc)(g);
|
||||
}
|
||||
|
||||
void runBattle(const vector<shared_ptr<const UnitProto>>& units) {
|
||||
auto mapName = fileNames[randInt(0, (int)fileNames.size() - 1)];
|
||||
auto month = randInt(1, 12);
|
||||
void runBattle(const std::vector<shardok::Unit>& units) {
|
||||
if (fileNames.empty()) { throw std::runtime_error("No map files found"); }
|
||||
if (units.size() < 2) { throw std::runtime_error("Need at least two units to run a battle"); }
|
||||
|
||||
auto p1UnitCount = randInt(1, 20);
|
||||
vector<UnitProto> p1Units{};
|
||||
for (int i = 0; i < p1UnitCount; i++) {
|
||||
auto unit = *units[i];
|
||||
unit.set_player_id(0);
|
||||
p1Units.push_back(unit);
|
||||
const auto mapName = fileNames[randInt(0, static_cast<int>(fileNames.size()) - 1)];
|
||||
const auto month = randInt(1, 12);
|
||||
|
||||
const auto maxP1UnitCount = std::min<size_t>(20, units.size() - 1);
|
||||
const auto p1UnitCount = randInt(1, static_cast<int>(maxP1UnitCount));
|
||||
std::vector<shardok::Unit> p1Units{};
|
||||
p1Units.reserve(p1UnitCount);
|
||||
for (int i = 0; i < p1UnitCount; ++i) {
|
||||
auto unit = units[i];
|
||||
unit.mutate_player_id(0);
|
||||
p1Units.push_back(std::move(unit));
|
||||
}
|
||||
|
||||
auto p2UnitCount = randInt(1, 20);
|
||||
vector<UnitProto> p2Units{};
|
||||
for (int i = p1UnitCount; i < p1UnitCount + p2UnitCount; i++) {
|
||||
auto unit = *units[i];
|
||||
unit.set_player_id(1);
|
||||
p2Units.push_back(unit);
|
||||
const auto maxP2UnitCount = std::min<size_t>(20, units.size() - p1UnitCount);
|
||||
const auto p2UnitCount = randInt(1, static_cast<int>(maxP2UnitCount));
|
||||
std::vector<shardok::Unit> p2Units{};
|
||||
p2Units.reserve(p2UnitCount);
|
||||
for (int i = p1UnitCount; i < p1UnitCount + p2UnitCount; ++i) {
|
||||
auto unit = units[i];
|
||||
unit.mutate_player_id(1);
|
||||
p2Units.push_back(std::move(unit));
|
||||
}
|
||||
|
||||
printf("map name is %s, %d attacking %d\n", mapName.c_str(), p1UnitCount, p2UnitCount);
|
||||
std::cout << "map name is " << mapName << ", " << p1UnitCount << " attacking " << p2UnitCount
|
||||
<< '\n';
|
||||
|
||||
vector<VictoryConditionProto> attVictoryConditions{
|
||||
std::vector<VictoryConditionProto> attVictoryConditions{
|
||||
VictoryConditionProto::VICTORY_CONDITION_HOLDS_CRITICAL_TILES,
|
||||
VictoryConditionProto::VICTORY_CONDITION_LAST_PLAYER_STANDING};
|
||||
vector<VictoryConditionProto> defVictoryConditions{
|
||||
std::vector<VictoryConditionProto> defVictoryConditions{
|
||||
VictoryConditionProto::VICTORY_CONDITION_LAST_PLAYER_STANDING,
|
||||
VictoryConditionProto::VICTORY_CONDITION_WIN_AFTER_MAX_ROUNDS};
|
||||
|
||||
auto p1 = PlayerInfoWithUnits(0, true, 5, false, 10000, attVictoryConditions, {}, p1Units);
|
||||
auto p2 = PlayerInfoWithUnits(1, false, 7, false, 10000, defVictoryConditions, {}, p2Units);
|
||||
std::vector<shardok::PlayerInfoWithUnits> playerInfos;
|
||||
playerInfos.reserve(2);
|
||||
playerInfos.emplace_back(
|
||||
0,
|
||||
true,
|
||||
5,
|
||||
false,
|
||||
10000,
|
||||
attVictoryConditions,
|
||||
std::vector<shardok::PlayerId>{},
|
||||
p1Units,
|
||||
false);
|
||||
playerInfos.emplace_back(
|
||||
1,
|
||||
true,
|
||||
7,
|
||||
true,
|
||||
10000,
|
||||
defVictoryConditions,
|
||||
std::vector<shardok::PlayerId>{},
|
||||
p2Units,
|
||||
false);
|
||||
|
||||
string gameId = std::to_string(randInt(INT_MIN, INT_MAX));
|
||||
const std::string gameId = std::to_string(randInt(INT_MIN, INT_MAX));
|
||||
|
||||
manager->LockedCreateSpecifiedGame(gameId, {p1, p2}, mapName, "", month, "");
|
||||
manager->UnlockedCreateSpecifiedGame(
|
||||
gameId,
|
||||
playerInfos,
|
||||
mapName,
|
||||
"",
|
||||
month,
|
||||
TutorialBattleConfigProto{},
|
||||
"");
|
||||
}
|
||||
|
||||
auto LoadUnits() -> vector<shared_ptr<const UnitProto>> {
|
||||
auto LoadUnits() -> std::vector<shardok::Unit> {
|
||||
const auto bytes = byte_vector::FromPath("/tmp/random_heroes.bin");
|
||||
|
||||
RandomUnits commonUnits;
|
||||
commonUnits.ParseFromArray(bytes.data(), (int)bytes.size());
|
||||
printf("Loaded %d units\n", commonUnits.units_size());
|
||||
if (!commonUnits.ParseFromArray(bytes.data(), static_cast<int>(bytes.size()))) {
|
||||
throw std::runtime_error("Failed to parse /tmp/random_heroes.bin");
|
||||
}
|
||||
std::cout << "Loaded " << commonUnits.units_size() << " units\n";
|
||||
|
||||
vector<shared_ptr<const UnitProto>> units{};
|
||||
std::vector<shardok::Unit> units{};
|
||||
units.reserve(commonUnits.units_size());
|
||||
|
||||
for (const auto& commonUnit : commonUnits.units()) {
|
||||
// FIXME: assumes 2 players
|
||||
units.push_back(std::make_shared<const UnitProto>(ConvertUnit(commonUnit, 0, {0, 1})));
|
||||
units.push_back(shardok::ConvertUnit(commonUnit, 0, {0, 1}));
|
||||
}
|
||||
std::shuffle(units.begin(), units.end(), g);
|
||||
|
||||
return units;
|
||||
}
|
||||
|
||||
[[noreturn]] void runBattlesThread(const vector<shared_ptr<const UnitProto>>& units) {
|
||||
[[noreturn]] void runBattlesThread(const std::vector<shardok::Unit>& units) {
|
||||
while (true) { runBattle(units); }
|
||||
}
|
||||
|
||||
auto main(int argc, char** argv) -> int {
|
||||
auto main(int /*argc*/, char** argv) -> int {
|
||||
#if FIXED_SEED
|
||||
std::srand(4564564);
|
||||
g.seed(378473);
|
||||
#else
|
||||
std::srand(std::time(nullptr));
|
||||
#endif
|
||||
|
||||
FilesystemUtils::SetExecPath(argv[0]);
|
||||
|
||||
auto randomUnits = LoadUnits();
|
||||
|
||||
printf("Map file directory is %s\n", FilesystemUtils::MapFilesDirectory().c_str());
|
||||
std::cout << "Map file directory is " << FilesystemUtils::MapFilesDirectory() << '\n';
|
||||
fileNames = FilesystemUtils::FilesInDirectory(FilesystemUtils::MapFilesDirectory(), ".e0m");
|
||||
|
||||
for (auto& fileName : fileNames) { fileName.resize(fileName.size() - 4); }
|
||||
|
||||
manager = new ShardokGamesManager(nullptr, std::vector<std::string>());
|
||||
manager = std::make_unique<shardok::ShardokGamesManager>(std::vector<std::string>());
|
||||
|
||||
std::thread threads[THREAD_COUNT];
|
||||
std::array<std::thread, THREAD_COUNT> threads;
|
||||
|
||||
for (int i = 0; i < THREAD_COUNT; i++) {
|
||||
for (int i = 0; i < THREAD_COUNT; ++i) {
|
||||
threads[i] = std::thread(runBattlesThread, randomUnits);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@ namespace shardok {
|
||||
constexpr double kOverpowerRatio = 2.0;
|
||||
constexpr double kBraveWaterCostMultiplier = 1.2;
|
||||
|
||||
using std::pair;
|
||||
using std::shared_ptr;
|
||||
|
||||
DIST_T NormalizedCostWhenBraving(const DIST_T cost) {
|
||||
if (cost >= static_cast<double>(ActionPointDistances::IMPOSSIBLE) / kBraveWaterCostMultiplier)
|
||||
return ActionPointDistances::IMPOSSIBLE;
|
||||
@@ -28,25 +25,44 @@ DIST_T NormalizedCostWhenBraving(const DIST_T cost) {
|
||||
|
||||
struct TargetAndDistance {
|
||||
Coords target;
|
||||
size_t targetIndex;
|
||||
CoordsSet attackLocations;
|
||||
double targetPower;
|
||||
DIST_T distance;
|
||||
|
||||
TargetAndDistance(const Coords& t, const CoordsSet& al, const double tp, const DIST_T d)
|
||||
TargetAndDistance(
|
||||
const Coords& t,
|
||||
const size_t ti,
|
||||
const CoordsSet& al,
|
||||
const double tp,
|
||||
const DIST_T d)
|
||||
: target(t),
|
||||
targetIndex(ti),
|
||||
attackLocations(al),
|
||||
targetPower(tp),
|
||||
distance(d) {}
|
||||
};
|
||||
|
||||
auto CoordsIndex(const Coords& coords, const int columnCount) {
|
||||
return coords.row() * columnCount + coords.column();
|
||||
}
|
||||
|
||||
auto CoordsFromIndex(const size_t index, const int columnCount) -> Coords {
|
||||
return Coords(
|
||||
static_cast<int8_t>(index / static_cast<size_t>(columnCount)),
|
||||
static_cast<int8_t>(index % static_cast<size_t>(columnCount)));
|
||||
}
|
||||
|
||||
auto MinDistance(
|
||||
const Coords& start,
|
||||
const CoordsSet& destinations,
|
||||
const ActionPointDistances* apd) -> DIST_T {
|
||||
DIST_T minDistance = ActionPointDistances::IMPOSSIBLE;
|
||||
const int startIndex = CoordsIndex(start, destinations.ColumnCount());
|
||||
|
||||
for (const Coords& dest : destinations) {
|
||||
if (const DIST_T distance = apd->Distance(start, dest); distance < minDistance) {
|
||||
for (const auto destIndex : destinations.indexIterator()) {
|
||||
if (const DIST_T distance = apd->Distance(startIndex, static_cast<int>(destIndex));
|
||||
distance < minDistance) {
|
||||
minDistance = distance;
|
||||
}
|
||||
}
|
||||
@@ -116,10 +132,6 @@ auto EffectiveDistance(
|
||||
|
||||
auto Power(const Unit* unit) -> double { return unit->battalion().size(); }
|
||||
|
||||
auto CoordsIndex(const Coords& coords, const int columnCount) {
|
||||
return coords.row() * columnCount + coords.column();
|
||||
}
|
||||
|
||||
// Chooses a list of targets in priority order for each unit.
|
||||
auto GenerateTargetPriorities(
|
||||
const vector<const Unit*>& occupants,
|
||||
@@ -156,6 +168,7 @@ auto GenerateTargetPriorities(
|
||||
vector<TargetAndAttackLocations>{});
|
||||
|
||||
vector<TargetAndDistance> targetsWithDistance;
|
||||
targetsWithDistance.reserve(targets.size());
|
||||
|
||||
// Get APDs directly from cache (now with built-in thread-local optimization)
|
||||
const auto& battType = battalionTypeGetter(unit->battalion().type());
|
||||
@@ -165,10 +178,10 @@ auto GenerateTargetPriorities(
|
||||
bravingApd = apdCache->GetRaw(map, mapId, battType, true, braveWaterCost);
|
||||
}
|
||||
|
||||
for (const Coords& targetLocation : targets) {
|
||||
const auto coordsIndex = CoordsIndex(targetLocation, cc);
|
||||
const auto& occupant = occupants[coordsIndex];
|
||||
for (const auto targetIndex : targets.indexIterator()) {
|
||||
const auto& occupant = occupants[targetIndex];
|
||||
|
||||
const Coords targetLocation = CoordsFromIndex(targetIndex, cc);
|
||||
const auto& attackLocations = alCache->CachedLocations(targetLocation, isLateGame);
|
||||
|
||||
if (occupant && occupant->player_id() != attackerId) {
|
||||
@@ -181,12 +194,14 @@ auto GenerateTargetPriorities(
|
||||
|
||||
targetsWithDistance.emplace_back(
|
||||
targetLocation,
|
||||
targetIndex,
|
||||
attackLocsForUnit,
|
||||
occupantPower,
|
||||
distance);
|
||||
} else {
|
||||
targetsWithDistance.emplace_back(
|
||||
targetLocation,
|
||||
targetIndex,
|
||||
attackLocations.LocationsWithEnemyInRange(unit),
|
||||
occupantPower,
|
||||
ActionPointDistances::IMPOSSIBLE);
|
||||
@@ -197,13 +212,11 @@ auto GenerateTargetPriorities(
|
||||
// Sort by distance
|
||||
std::ranges::sort(
|
||||
targetsWithDistance,
|
||||
[&powerAttackingEachTarget,
|
||||
cc](const TargetAndDistance& left, const TargetAndDistance& right) {
|
||||
const auto leftIndex = CoordsIndex(left.target, cc);
|
||||
const auto rightIndex = CoordsIndex(right.target, cc);
|
||||
|
||||
const double powerAttackingLeft = powerAttackingEachTarget[leftIndex];
|
||||
const double powerAttackingRight = powerAttackingEachTarget[rightIndex];
|
||||
[&powerAttackingEachTarget](
|
||||
const TargetAndDistance& left,
|
||||
const TargetAndDistance& right) {
|
||||
const double powerAttackingLeft = powerAttackingEachTarget[left.targetIndex];
|
||||
const double powerAttackingRight = powerAttackingEachTarget[right.targetIndex];
|
||||
|
||||
const bool leftAlreadyOverwhelmed =
|
||||
powerAttackingLeft >= kOverpowerRatio * left.targetPower;
|
||||
@@ -217,8 +230,7 @@ auto GenerateTargetPriorities(
|
||||
});
|
||||
|
||||
if (!targetsWithDistance.empty()) {
|
||||
powerAttackingEachTarget[CoordsIndex(targetsWithDistance.front().target, cc)] +=
|
||||
Power(unit);
|
||||
powerAttackingEachTarget[targetsWithDistance.front().targetIndex] += Power(unit);
|
||||
}
|
||||
|
||||
tpl.priorityOrder.reserve(targetsWithDistance.size());
|
||||
@@ -235,4 +247,4 @@ auto GenerateTargetPriorities(
|
||||
return allTargetsUnitsAndDistances;
|
||||
}
|
||||
|
||||
} // namespace shardok
|
||||
} // namespace shardok
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Created by Dan Crosby on 6/19/23.
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AIATTACKGROUPS_HPP
|
||||
#define EAGLE0_AIATTACKGROUPS_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_ATTACK_GROUPS_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_ATTACK_GROUPS_HPP
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
@@ -20,7 +20,6 @@ namespace shardok {
|
||||
using GameState = net::eagle0::shardok::storage::fb::GameState;
|
||||
using Unit = net::eagle0::shardok::storage::fb::Unit;
|
||||
using net::eagle0::shardok::storage::fb::PlayerInfo;
|
||||
using std::vector;
|
||||
|
||||
using BattalionTypeGetter = std::function<BattalionTypeSPtr(BattalionTypeId)>;
|
||||
|
||||
@@ -28,19 +27,19 @@ struct TargetAndAttackLocations {
|
||||
Coords target;
|
||||
CoordsSet attackLocations;
|
||||
|
||||
auto operator==(const TargetAndAttackLocations& rhs) const -> bool = default;
|
||||
[[nodiscard]] auto operator==(const TargetAndAttackLocations& rhs) const -> bool = default;
|
||||
};
|
||||
|
||||
struct TargetPriorityList {
|
||||
UnitId attackingUnitId;
|
||||
vector<TargetAndAttackLocations> priorityOrder;
|
||||
std::vector<TargetAndAttackLocations> priorityOrder;
|
||||
|
||||
TargetPriorityList(const UnitId uid, const vector<TargetAndAttackLocations>& po)
|
||||
TargetPriorityList(const UnitId uid, const std::vector<TargetAndAttackLocations>& po)
|
||||
: attackingUnitId(uid),
|
||||
priorityOrder(po) {}
|
||||
};
|
||||
|
||||
auto EffectiveDistance(
|
||||
[[nodiscard]] auto EffectiveDistance(
|
||||
const Unit* unit,
|
||||
const HexMap* map,
|
||||
const AttackLocations& attackLocations,
|
||||
@@ -48,7 +47,7 @@ auto EffectiveDistance(
|
||||
const BattalionTypeGetter& battalionTypeGetter,
|
||||
ActionPoints braveWaterCost) -> DIST_T;
|
||||
|
||||
auto EffectiveDistance(
|
||||
[[nodiscard]] auto EffectiveDistance(
|
||||
const Unit* unit,
|
||||
const HexMap* map,
|
||||
const CoordsSet& locations,
|
||||
@@ -56,25 +55,25 @@ auto EffectiveDistance(
|
||||
const BattalionTypeGetter& battalionTypeGetter,
|
||||
ActionPoints braveWaterCost) -> DIST_T;
|
||||
|
||||
auto EffectiveDistance(
|
||||
[[nodiscard]] auto EffectiveDistance(
|
||||
const Unit* unit,
|
||||
const ActionPointDistances* notBravingApd,
|
||||
const ActionPointDistances* bravingApd,
|
||||
const CoordsSet& locations) -> DIST_T;
|
||||
|
||||
// Chooses a list of targets in priority order for each unit.
|
||||
auto GenerateTargetPriorities(
|
||||
const vector<const Unit*>& occupants,
|
||||
[[nodiscard]] auto GenerateTargetPriorities(
|
||||
const std::vector<const Unit*>& occupants,
|
||||
const HexMap* map,
|
||||
const CoordsSet& targets,
|
||||
PlayerId attackerId,
|
||||
const vector<const Unit*>& remainingUnits,
|
||||
const std::vector<const Unit*>& remainingUnits,
|
||||
const APDCache& apdCache,
|
||||
const ALCache& alCache,
|
||||
const BattalionTypeGetter& battalionTypeGetter,
|
||||
ActionPoints braveWaterCost,
|
||||
bool isLateGame = false) -> vector<TargetPriorityList>;
|
||||
bool isLateGame = false) -> std::vector<TargetPriorityList>;
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AIATTACKGROUPS_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_ATTACK_GROUPS_HPP
|
||||
|
||||
@@ -53,8 +53,8 @@ AttackLocationsCache::AttackLocationsCache(const HexMap *hexMap, const SettingsG
|
||||
|
||||
auto emptySet = CoordsSet(columnCount, rowCount);
|
||||
|
||||
for (MapIndex r = 0; r < hexMap->row_count(); r++) {
|
||||
for (MapIndex c = 0; c < hexMap->column_count(); c++) {
|
||||
for (MapIndex r = 0; r < hexMap->row_count(); ++r) {
|
||||
for (MapIndex c = 0; c < hexMap->column_count(); ++c) {
|
||||
auto location = Coords(r, c);
|
||||
const auto terrain = GetTerrain(hexMap, location);
|
||||
|
||||
@@ -114,8 +114,7 @@ auto AttackLocationsCache::CachedLocations(const CoordsSet &targets, const bool
|
||||
-> AttackLocations {
|
||||
AttackLocations al(rowCount, columnCount);
|
||||
|
||||
for (const auto &target : targets) {
|
||||
const int index = target.row() * columnCount + target.column();
|
||||
for (const auto index : targets.indexIterator()) {
|
||||
if (lateGame) {
|
||||
al += lateGameLocations[index];
|
||||
} else {
|
||||
@@ -137,4 +136,4 @@ auto AttackLocationsCache::CachedLocations(const vector<const Unit *> &enemies,
|
||||
return CachedLocations(targets, lateGame);
|
||||
}
|
||||
|
||||
} // namespace shardok
|
||||
} // namespace shardok
|
||||
|
||||
@@ -17,10 +17,8 @@
|
||||
namespace shardok {
|
||||
|
||||
using Unit = net::eagle0::shardok::storage::fb::Unit;
|
||||
using std::shared_ptr;
|
||||
using std::vector;
|
||||
|
||||
class AttackLocations {
|
||||
class alignas(128) AttackLocations {
|
||||
private:
|
||||
const MapIndex rowCount;
|
||||
const MapIndex columnCount;
|
||||
@@ -147,9 +145,9 @@ public:
|
||||
adjacentLocations += cs;
|
||||
allLocations += cs;
|
||||
}
|
||||
} __attribute__((aligned(128)));
|
||||
};
|
||||
|
||||
struct AttackLocationsCache {
|
||||
struct alignas(128) AttackLocationsCache {
|
||||
private:
|
||||
const MapIndex rowCount;
|
||||
const MapIndex columnCount;
|
||||
@@ -165,8 +163,8 @@ public:
|
||||
|
||||
auto CachedLocations(const Coords& singleTarget, bool lateGame) -> const AttackLocations&;
|
||||
auto CachedLocations(const CoordsSet& targets, bool lateGame) -> AttackLocations;
|
||||
auto CachedLocations(const vector<const Unit*>& enemies, bool lateGame) -> AttackLocations;
|
||||
} __attribute__((aligned(128)));
|
||||
auto CachedLocations(const std::vector<const Unit*>& enemies, bool lateGame) -> AttackLocations;
|
||||
};
|
||||
|
||||
using ALCache = std::unique_ptr<AttackLocationsCache>;
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ auto AIAttackerStrategySelector::BestAttackerStrategy(
|
||||
bool canFlee = false;
|
||||
|
||||
vector<const Unit*> attackerUnits{};
|
||||
attackerUnits.reserve(gameState->units()->size());
|
||||
CoordsSet defenderPositions(gameState->hex_map());
|
||||
for (const Unit* unit : *gameState->units()) {
|
||||
if (unit->status() != net::eagle0::shardok::storage::fb::UnitStatus_NORMAL_UNIT &&
|
||||
@@ -131,4 +132,4 @@ auto AIAttackerStrategySelector::BestAttackerStrategy(
|
||||
return chosenStrategy;
|
||||
}
|
||||
|
||||
} // namespace shardok
|
||||
} // namespace shardok
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Created by Dan Crosby on 1/9/22.
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AIATTACKERSTRATEGYSELECTOR_HPP
|
||||
#define EAGLE0_AIATTACKERSTRATEGYSELECTOR_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_ATTACKER_STRATEGY_SELECTOR_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_ATTACKER_STRATEGY_SELECTOR_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/ai/AIAttackLocations.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/ai/AICommonTypes.hpp"
|
||||
@@ -32,4 +32,4 @@ public:
|
||||
};
|
||||
|
||||
} // namespace shardok
|
||||
#endif // EAGLE0_AIATTACKERSTRATEGYSELECTOR_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_ATTACKER_STRATEGY_SELECTOR_HPP
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <future>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "AICommandFilter.hpp"
|
||||
#include "TranspositionTable.hpp"
|
||||
@@ -19,16 +23,49 @@
|
||||
|
||||
namespace shardok {
|
||||
|
||||
// No need to forward declare internal functions - use the public interface instead
|
||||
constexpr bool kMultithread = true;
|
||||
constexpr bool kLogging = false;
|
||||
|
||||
// Helper constants and static variables
|
||||
static const std::vector<double> _averageSequence = {0.5};
|
||||
static const auto _averageGenerator = std::make_shared<SequenceRandomGenerator>(_averageSequence);
|
||||
[[nodiscard]] static auto AverageGenerator() -> std::shared_ptr<SequenceRandomGenerator> {
|
||||
return std::make_shared<SequenceRandomGenerator>(std::vector{0.5});
|
||||
}
|
||||
|
||||
#define MULTITHREAD true
|
||||
#define LOGGING_ 0
|
||||
[[nodiscard]] static auto DescribeCommandForLog(const CommandSPtr& command) -> std::string {
|
||||
if (!command) { return "<null command>"; }
|
||||
|
||||
std::ostringstream out;
|
||||
out << "type=" << command->GetCommandType()
|
||||
<< " player=" << static_cast<int>(command->GetPlayerId())
|
||||
<< " actor=" << command->GetActorUnitId() << " target=("
|
||||
<< static_cast<int>(command->GetTargetRow()) << ','
|
||||
<< static_cast<int>(command->GetTargetColumn()) << ')';
|
||||
|
||||
if (command->HasOdds()) { out << " odds_percentile=" << command->GetOddsPercentile(); }
|
||||
|
||||
return out.str();
|
||||
}
|
||||
|
||||
[[nodiscard]] static auto DescribeCommandAt(
|
||||
const CommandListSPtr& commands,
|
||||
const size_t commandIndex) -> std::string {
|
||||
if (!commands) { return "command=<null command list>"; }
|
||||
if (commandIndex >= commands->size()) {
|
||||
std::ostringstream out;
|
||||
out << "command=<index " << commandIndex << " out of " << commands->size() << ">";
|
||||
return out.str();
|
||||
}
|
||||
|
||||
std::ostringstream out;
|
||||
out << "command={" << DescribeCommandForLog(commands->at(commandIndex)) << '}';
|
||||
return out.str();
|
||||
}
|
||||
|
||||
[[nodiscard]] static auto WithExceptionContext(
|
||||
const std::string& context,
|
||||
const std::exception& exception) -> std::runtime_error {
|
||||
return std::runtime_error(context + ": " + exception.what());
|
||||
}
|
||||
|
||||
// Helper function to determine if a command type is deterministic
|
||||
static auto IsDeterministic(const CommandType type) -> bool {
|
||||
switch (type) {
|
||||
case net::eagle0::shardok::common::MOVE_COMMAND:
|
||||
@@ -41,13 +78,11 @@ static auto IsDeterministic(const CommandType type) -> bool {
|
||||
case net::eagle0::shardok::common::PLACE_HIDDEN_UNIT_COMMAND:
|
||||
case net::eagle0::shardok::common::UNIT_STOP_COMMAND:
|
||||
case net::eagle0::shardok::common::UNIT_REST_COMMAND:
|
||||
case net::eagle0::shardok::common::FLEE_COMMAND:
|
||||
case net::eagle0::shardok::common::REINFORCE_COMMAND:
|
||||
case net::eagle0::shardok::common::RETREAT_COMMAND:
|
||||
case net::eagle0::shardok::common::END_PLAYER_SETUP_COMMAND:
|
||||
case net::eagle0::shardok::common::HIDE_COMMAND:
|
||||
case net::eagle0::shardok::common::FORTIFY_COMMAND:
|
||||
case net::eagle0::shardok::common::BECOME_OUTLAW_COMMAND:
|
||||
case net::eagle0::shardok::common::HOLY_WAVE_COMMAND:
|
||||
case net::eagle0::shardok::common::EVACUATE_PRISONERS_COMMAND:
|
||||
case net::eagle0::shardok::common::REPAIR_COMMAND: return true;
|
||||
@@ -61,7 +96,14 @@ static auto RandomnessSampleForRepeat(const int repeatIteration, const int maxRe
|
||||
return static_cast<double>(repeatIteration) / static_cast<double>(maxRepeatCount - 1);
|
||||
}
|
||||
|
||||
// Helper function to sort commands by score
|
||||
static auto SuccessSampleForOdds(const double successChance) -> double {
|
||||
return successChance / 2.0;
|
||||
}
|
||||
|
||||
static auto FailureSampleForOdds(const double successChance) -> double {
|
||||
return successChance + ((1.0 - successChance) / 2.0);
|
||||
}
|
||||
|
||||
static auto CommandSorter(
|
||||
const AICommandEvaluator::IndexAndScore& l,
|
||||
const AICommandEvaluator::IndexAndScore& r) -> bool {
|
||||
@@ -81,7 +123,7 @@ AICommandEvaluator::AICommandEvaluator(
|
||||
BattalionTypeGetter battalionTypeGetter)
|
||||
: scorer_(scorer),
|
||||
apdCache_(apdCache),
|
||||
battalionTypeGetter_(std::move(battalionTypeGetter)) {} // Move the function object
|
||||
battalionTypeGetter_(std::move(battalionTypeGetter)) {}
|
||||
|
||||
auto AICommandEvaluator::PerformLookahead(
|
||||
const PlayerId pid,
|
||||
@@ -136,17 +178,34 @@ auto AICommandEvaluator::PerformLookahead(
|
||||
std::launch::deferred,
|
||||
[bestCommandFuture = std::move(bestCommandFuture),
|
||||
innerEngine,
|
||||
nextCommands,
|
||||
pid,
|
||||
nextUtility,
|
||||
remainingLookahead]() mutable -> EvaluationResult {
|
||||
const auto bestCommand = bestCommandFuture.get();
|
||||
IndexAndScore bestCommand;
|
||||
try {
|
||||
bestCommand = bestCommandFuture.get();
|
||||
} catch (const std::exception& e) {
|
||||
std::ostringstream context;
|
||||
context << "AI PerformLookahead failed while resolving best command"
|
||||
<< " player=" << static_cast<int>(pid)
|
||||
<< " remaining_lookahead=" << remainingLookahead
|
||||
<< " next_command_count=" << nextCommands->size();
|
||||
throw WithExceptionContext(context.str(), e);
|
||||
}
|
||||
if (!bestCommand.completed) {
|
||||
return EvaluationResult{.score = nextUtility, .completed = false};
|
||||
}
|
||||
if (bestCommand.index >= nextCommands->size()) {
|
||||
std::cerr << "AI lookahead produced command index " << bestCommand.index
|
||||
<< " with only " << nextCommands->size()
|
||||
<< " available commands for player " << static_cast<int>(pid)
|
||||
<< " at remaining lookahead " << remainingLookahead << "\n";
|
||||
return EvaluationResult{.score = nextUtility, .completed = false};
|
||||
}
|
||||
|
||||
ScoreValue resultScore;
|
||||
if (auto& nextCommand = innerEngine->GetAvailableCommandsForAIPlayer(pid)->at(
|
||||
bestCommand.index);
|
||||
if (const auto& nextCommand = nextCommands->at(bestCommand.index);
|
||||
nextCommand->GetCommandType() !=
|
||||
net::eagle0::shardok::common::END_TURN_COMMAND) {
|
||||
resultScore = bestCommand.immediateScore;
|
||||
@@ -197,14 +256,36 @@ auto AICommandEvaluator::EvaluateWithRandomness(
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
const auto guessedCommands = guessedEngine.GetAvailableCommandsForAIPlayer(pid);
|
||||
auto innerEngine = std::make_shared<ShardokEngine>(guessedEngine, false);
|
||||
innerEngine->PostCommand(pid, commandIndex, randomGenerator);
|
||||
try {
|
||||
innerEngine->PostCommand(pid, commandIndex, randomGenerator);
|
||||
} catch (const std::exception& e) {
|
||||
std::ostringstream context;
|
||||
context << "AI EvaluateWithRandomness failed while posting simulated command"
|
||||
<< " player=" << static_cast<int>(pid) << " command_index=" << commandIndex
|
||||
<< " guessed_command_count=" << guessedCommands->size()
|
||||
<< " remaining_lookahead=" << remainingLookahead << ' '
|
||||
<< DescribeCommandAt(guessedCommands, commandIndex);
|
||||
throw WithExceptionContext(context.str(), e);
|
||||
}
|
||||
|
||||
auto innerUtility = scorer_.GuessedStateScore(
|
||||
isDefender,
|
||||
innerEngine->GetCurrentGameState(),
|
||||
attackerStrategy,
|
||||
allCastleCoords);
|
||||
ScoreValue innerUtility;
|
||||
try {
|
||||
innerUtility = scorer_.GuessedStateScore(
|
||||
isDefender,
|
||||
innerEngine->GetCurrentGameState(),
|
||||
attackerStrategy,
|
||||
allCastleCoords);
|
||||
} catch (const std::exception& e) {
|
||||
std::ostringstream context;
|
||||
context << "AI EvaluateWithRandomness failed while scoring simulated state"
|
||||
<< " player=" << static_cast<int>(pid) << " command_index=" << commandIndex
|
||||
<< " guessed_command_count=" << guessedCommands->size()
|
||||
<< " remaining_lookahead=" << remainingLookahead << ' '
|
||||
<< DescribeCommandAt(guessedCommands, commandIndex);
|
||||
throw WithExceptionContext(context.str(), e);
|
||||
}
|
||||
|
||||
returnValue.immediateScore = innerUtility;
|
||||
returnValue.completed = true;
|
||||
@@ -219,33 +300,45 @@ auto AICommandEvaluator::EvaluateWithRandomness(
|
||||
isDefender,
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
commandIndex,
|
||||
innerEngine,
|
||||
attackerStrategy,
|
||||
innerUtility,
|
||||
&allCastleCoords,
|
||||
guessedCommands,
|
||||
allCastleCoords,
|
||||
deadline]() -> EvaluationResult {
|
||||
auto lookaheadFuture = PerformLookahead(
|
||||
pid,
|
||||
isDefender,
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
innerEngine,
|
||||
innerUtility,
|
||||
attackerStrategy,
|
||||
allCastleCoords,
|
||||
deadline);
|
||||
return lookaheadFuture.get();
|
||||
try {
|
||||
auto lookaheadFuture = PerformLookahead(
|
||||
pid,
|
||||
isDefender,
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
innerEngine,
|
||||
innerUtility,
|
||||
attackerStrategy,
|
||||
allCastleCoords,
|
||||
deadline);
|
||||
return lookaheadFuture.get();
|
||||
} catch (const std::exception& e) {
|
||||
std::ostringstream context;
|
||||
context << "AI EvaluateWithRandomness failed during recursive lookahead"
|
||||
<< " player=" << static_cast<int>(pid) << " command_index=" << commandIndex
|
||||
<< " remaining_lookahead=" << remainingLookahead << ' '
|
||||
<< DescribeCommandAt(guessedCommands, commandIndex);
|
||||
throw WithExceptionContext(context.str(), e);
|
||||
}
|
||||
};
|
||||
|
||||
#if MULTITHREAD
|
||||
auto launchPolicy = remainingLookahead == 1 ? std::launch::async : std::launch::deferred;
|
||||
returnValue.lookaheadScore = std::async(launchPolicy, lookaheadLambda);
|
||||
#else
|
||||
std::promise<EvaluationResult> p;
|
||||
returnValue.lookaheadScore = p.get_future();
|
||||
auto lambdaResult = lookaheadLambda();
|
||||
p.set_value(lambdaResult);
|
||||
#endif
|
||||
if constexpr (kMultithread) {
|
||||
auto launchPolicy =
|
||||
remainingLookahead == 1 ? std::launch::async : std::launch::deferred;
|
||||
returnValue.lookaheadScore = std::async(launchPolicy, lookaheadLambda);
|
||||
} else {
|
||||
std::promise<EvaluationResult> p;
|
||||
returnValue.lookaheadScore = p.get_future();
|
||||
auto lambdaResult = lookaheadLambda();
|
||||
p.set_value(lambdaResult);
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
@@ -302,39 +395,52 @@ auto AICommandEvaluator::FindBestCommand(
|
||||
minDistToEnemies = 0.0; // No enemies found
|
||||
}
|
||||
|
||||
#if LOGGING_
|
||||
// Log command count and distance metrics for performance analysis
|
||||
const auto allCommandCount = guessedDescriptors->size();
|
||||
const auto filteredCommandCount = filteredIndices.size();
|
||||
const int currentRound = gameState->current_round();
|
||||
if constexpr (kLogging) {
|
||||
// Log command count and distance metrics for performance analysis
|
||||
const auto allCommandCount = guessedDescriptors->size();
|
||||
const auto filteredCommandCount = filteredIndices.size();
|
||||
const int currentRound = gameState->current_round();
|
||||
|
||||
printf("AI_COMMAND_COUNT: Round %d, Player %d, Defender %d, MinDist %.1f, Commands %zu -> %zu "
|
||||
"(%.1f%% filtered)\n",
|
||||
currentRound,
|
||||
static_cast<int>(pid),
|
||||
isDefender ? 1 : 0,
|
||||
minDistToEnemies,
|
||||
allCommandCount,
|
||||
filteredCommandCount,
|
||||
100.0 * (allCommandCount - filteredCommandCount) / allCommandCount);
|
||||
#endif
|
||||
const auto flags = std::cout.flags();
|
||||
const auto precision = std::cout.precision();
|
||||
std::cout << "AI_COMMAND_COUNT: Round " << currentRound << ", Player "
|
||||
<< static_cast<int>(pid) << ", Defender " << (isDefender ? 1 : 0) << ", MinDist "
|
||||
<< std::fixed << std::setprecision(1) << minDistToEnemies << ", Commands "
|
||||
<< allCommandCount << " -> " << filteredCommandCount << " ("
|
||||
<< 100.0 * (allCommandCount - filteredCommandCount) / allCommandCount
|
||||
<< "% filtered)\n";
|
||||
std::cout.flags(flags);
|
||||
std::cout.precision(precision);
|
||||
}
|
||||
|
||||
const auto commandCount = filteredIndices.size();
|
||||
|
||||
// Structure to hold all command evaluation data
|
||||
struct CommandEvaluation {
|
||||
size_t index;
|
||||
CommandType type;
|
||||
ScoreValue immediateScore;
|
||||
size_t index{};
|
||||
CommandType type{};
|
||||
ScoreValue immediateScore{};
|
||||
bool immediateCompleted = true;
|
||||
std::vector<std::future<EvaluationResult>> lookaheadFutures;
|
||||
};
|
||||
|
||||
std::vector<CommandEvaluation> commandEvaluations(commandCount);
|
||||
|
||||
for (uint32_t index = 0; index < commandCount; index++) {
|
||||
for (uint32_t index = 0; index < commandCount; ++index) {
|
||||
const auto originalIndex = filteredIndices[index];
|
||||
const auto& guessedDescriptor = guessedDescriptors->at(originalIndex);
|
||||
const CommandSPtr guessedDescriptor = [&] {
|
||||
try {
|
||||
return guessedDescriptors->at(originalIndex);
|
||||
} catch (const std::exception& e) {
|
||||
std::ostringstream context;
|
||||
context << "AI FindBestCommand failed while reading filtered command"
|
||||
<< " player=" << static_cast<int>(pid) << " filtered_index=" << index
|
||||
<< " original_index=" << originalIndex
|
||||
<< " guessed_command_count=" << guessedDescriptors->size()
|
||||
<< " filtered_command_count=" << filteredIndices.size();
|
||||
throw WithExceptionContext(context.str(), e);
|
||||
}
|
||||
}();
|
||||
const auto guessedCommandType = guessedDescriptor->GetCommandType();
|
||||
|
||||
commandEvaluations[index].index = originalIndex;
|
||||
@@ -352,7 +458,7 @@ auto AICommandEvaluator::FindBestCommand(
|
||||
originalIndex,
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
_averageGenerator,
|
||||
AverageGenerator(),
|
||||
guessedEngine,
|
||||
attackerStrategy,
|
||||
allCastleCoords,
|
||||
@@ -366,7 +472,7 @@ auto AICommandEvaluator::FindBestCommand(
|
||||
const auto successChancePercentile = guessedDescriptor->GetOddsPercentile();
|
||||
const double successChance = static_cast<double>(successChancePercentile) / 100.0;
|
||||
|
||||
// Success attempt uses 1.0 - (successChance / 2) as the roll
|
||||
// Success attempt uses the midpoint of the successful percentile range.
|
||||
auto successEvaluation = EvaluateWithRandomness(
|
||||
pid,
|
||||
isDefender,
|
||||
@@ -374,13 +480,13 @@ auto AICommandEvaluator::FindBestCommand(
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
std::make_shared<SequenceRandomGenerator>(
|
||||
std::vector{1.0 - successChance / 2.0}),
|
||||
std::vector{SuccessSampleForOdds(successChance)}),
|
||||
guessedEngine,
|
||||
attackerStrategy,
|
||||
allCastleCoords,
|
||||
deadline);
|
||||
|
||||
// Failure attempt uses the average of (1 - successChance) and 0 as the roll
|
||||
// Failure attempt uses the midpoint of the failing percentile range.
|
||||
auto failureEvaluation = EvaluateWithRandomness(
|
||||
pid,
|
||||
isDefender,
|
||||
@@ -388,7 +494,7 @@ auto AICommandEvaluator::FindBestCommand(
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
std::make_shared<SequenceRandomGenerator>(
|
||||
std::vector{(1.0 - successChance) / 2.0}),
|
||||
std::vector{FailureSampleForOdds(successChance)}),
|
||||
guessedEngine,
|
||||
attackerStrategy,
|
||||
allCastleCoords,
|
||||
@@ -418,7 +524,8 @@ auto AICommandEvaluator::FindBestCommand(
|
||||
} else {
|
||||
ScoreValue sum = 0.0;
|
||||
const int sampleCount = std::max(1, maxRepeatCount);
|
||||
for (int repeatIteration = 0; repeatIteration < sampleCount; repeatIteration++) {
|
||||
commandEvaluations[index].lookaheadFutures.reserve(sampleCount);
|
||||
for (int repeatIteration = 0; repeatIteration < sampleCount; ++repeatIteration) {
|
||||
// In each iteration, use a double from [0, 1] as the random roll
|
||||
auto sequence =
|
||||
std::vector{RandomnessSampleForRepeat(repeatIteration, sampleCount)};
|
||||
@@ -428,7 +535,7 @@ auto AICommandEvaluator::FindBestCommand(
|
||||
originalIndex,
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
std::make_shared<SequenceRandomGenerator>(sequence),
|
||||
std::make_shared<SequenceRandomGenerator>(std::move(sequence)),
|
||||
guessedEngine,
|
||||
attackerStrategy,
|
||||
allCastleCoords,
|
||||
@@ -455,7 +562,17 @@ auto AICommandEvaluator::FindBestCommand(
|
||||
ScoreValue totalLookaheadScore = 0.0;
|
||||
bool completed = eval.immediateCompleted;
|
||||
for (auto& future : eval.lookaheadFutures) {
|
||||
const auto lookahead = future.get();
|
||||
EvaluationResult lookahead;
|
||||
try {
|
||||
lookahead = future.get();
|
||||
} catch (const std::exception& e) {
|
||||
std::ostringstream context;
|
||||
context << "AI FindBestCommand failed while resolving lookahead future"
|
||||
<< " command_index=" << eval.index
|
||||
<< " command_type=" << eval.type
|
||||
<< " lookahead_future_count=" << eval.lookaheadFutures.size();
|
||||
throw WithExceptionContext(context.str(), e);
|
||||
}
|
||||
if (!lookahead.completed) { completed = false; }
|
||||
totalLookaheadScore += lookahead.score;
|
||||
}
|
||||
@@ -507,26 +624,30 @@ auto AICommandEvaluator::EvaluateCommand(
|
||||
}
|
||||
|
||||
const auto& guessedDescriptor = guessedDescriptors->at(commandIndex);
|
||||
const auto guessedCommandType = guessedDescriptor->GetCommandType();
|
||||
|
||||
if (const auto guessedCommandType = guessedDescriptor->GetCommandType();
|
||||
guessedCommandType == net::eagle0::shardok::common::END_TURN_COMMAND) {
|
||||
if (guessedCommandType == net::eagle0::shardok::common::END_TURN_COMMAND) {
|
||||
std::promise<EvaluationResult> p;
|
||||
p.set_value(EvaluationResult{.score = currentUtility, .completed = true});
|
||||
return p.get_future();
|
||||
} else if (IsDeterministic(guessedCommandType)) {
|
||||
}
|
||||
|
||||
if (IsDeterministic(guessedCommandType)) {
|
||||
auto evaluation = EvaluateWithRandomness(
|
||||
pid,
|
||||
isDefender,
|
||||
commandIndex,
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
_averageGenerator,
|
||||
AverageGenerator(),
|
||||
guessedEngine,
|
||||
attackerStrategy,
|
||||
allCastleCoords,
|
||||
deadline);
|
||||
return std::move(evaluation.lookaheadScore);
|
||||
} else if (guessedDescriptor->HasOdds()) {
|
||||
}
|
||||
|
||||
if (guessedDescriptor->HasOdds()) {
|
||||
const auto successChancePercentile = guessedDescriptor->GetOddsPercentile();
|
||||
const double successChance = static_cast<double>(successChancePercentile) / 100.0;
|
||||
|
||||
@@ -537,7 +658,8 @@ auto AICommandEvaluator::EvaluateCommand(
|
||||
commandIndex,
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
std::make_shared<SequenceRandomGenerator>(std::vector{1.0 - successChance / 2.0}),
|
||||
std::make_shared<SequenceRandomGenerator>(
|
||||
std::vector{SuccessSampleForOdds(successChance)}),
|
||||
guessedEngine,
|
||||
attackerStrategy,
|
||||
allCastleCoords,
|
||||
@@ -550,7 +672,8 @@ auto AICommandEvaluator::EvaluateCommand(
|
||||
commandIndex,
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
std::make_shared<SequenceRandomGenerator>(std::vector{(1.0 - successChance) / 2.0}),
|
||||
std::make_shared<SequenceRandomGenerator>(
|
||||
std::vector{FailureSampleForOdds(successChance)}),
|
||||
guessedEngine,
|
||||
attackerStrategy,
|
||||
allCastleCoords,
|
||||
@@ -571,47 +694,47 @@ auto AICommandEvaluator::EvaluateCommand(
|
||||
.score = std::lerp(failure.score, success.score, successChance),
|
||||
.completed = true};
|
||||
});
|
||||
} else {
|
||||
// For non-deterministic commands without odds, use multiple attempts
|
||||
std::vector<std::future<EvaluationResult>> lookaheadFutures;
|
||||
const int sampleCount = std::max(1, maxRepeatCount);
|
||||
lookaheadFutures.reserve(sampleCount);
|
||||
|
||||
for (int repeatIteration = 0; repeatIteration < sampleCount; repeatIteration++) {
|
||||
auto sequence = std::vector{RandomnessSampleForRepeat(repeatIteration, sampleCount)};
|
||||
auto evaluation = EvaluateWithRandomness(
|
||||
pid,
|
||||
isDefender,
|
||||
commandIndex,
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
std::make_shared<SequenceRandomGenerator>(sequence),
|
||||
guessedEngine,
|
||||
attackerStrategy,
|
||||
allCastleCoords,
|
||||
deadline);
|
||||
|
||||
lookaheadFutures.push_back(std::move(evaluation.lookaheadScore));
|
||||
}
|
||||
|
||||
// Return a future that computes the average when needed
|
||||
return std::async(
|
||||
std::launch::deferred,
|
||||
[lookaheadFutures = std::move(lookaheadFutures),
|
||||
sampleCount]() mutable -> EvaluationResult {
|
||||
ScoreValue total = 0.0;
|
||||
bool completed = true;
|
||||
for (auto& future : lookaheadFutures) {
|
||||
const auto result = future.get();
|
||||
if (!result.completed) { completed = false; }
|
||||
total += result.score;
|
||||
}
|
||||
if (!completed) { return EvaluationResult{.score = 0.0, .completed = false}; }
|
||||
return EvaluationResult{
|
||||
.score = total / static_cast<ScoreValue>(sampleCount),
|
||||
.completed = true};
|
||||
});
|
||||
}
|
||||
|
||||
// For non-deterministic commands without odds, use multiple attempts
|
||||
std::vector<std::future<EvaluationResult>> lookaheadFutures;
|
||||
const int sampleCount = std::max(1, maxRepeatCount);
|
||||
lookaheadFutures.reserve(sampleCount);
|
||||
|
||||
for (int repeatIteration = 0; repeatIteration < sampleCount; ++repeatIteration) {
|
||||
auto sequence = std::vector{RandomnessSampleForRepeat(repeatIteration, sampleCount)};
|
||||
auto evaluation = EvaluateWithRandomness(
|
||||
pid,
|
||||
isDefender,
|
||||
commandIndex,
|
||||
remainingLookahead,
|
||||
maxRepeatCount,
|
||||
std::make_shared<SequenceRandomGenerator>(std::move(sequence)),
|
||||
guessedEngine,
|
||||
attackerStrategy,
|
||||
allCastleCoords,
|
||||
deadline);
|
||||
|
||||
lookaheadFutures.push_back(std::move(evaluation.lookaheadScore));
|
||||
}
|
||||
|
||||
// Return a future that computes the average when needed
|
||||
return std::async(
|
||||
std::launch::deferred,
|
||||
[lookaheadFutures = std::move(lookaheadFutures),
|
||||
sampleCount]() mutable -> EvaluationResult {
|
||||
ScoreValue total = 0.0;
|
||||
bool completed = true;
|
||||
for (auto& future : lookaheadFutures) {
|
||||
const auto result = future.get();
|
||||
if (!result.completed) { completed = false; }
|
||||
total += result.score;
|
||||
}
|
||||
if (!completed) { return EvaluationResult{.score = 0.0, .completed = false}; }
|
||||
return EvaluationResult{
|
||||
.score = total / static_cast<ScoreValue>(sampleCount),
|
||||
.completed = true};
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// Separated from AIScoreCalculator to isolate pure state scoring from lookahead logic.
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AICOMMANDEVALUATOR_HPP
|
||||
#define EAGLE0_AICOMMANDEVALUATOR_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_COMMAND_EVALUATOR_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_COMMAND_EVALUATOR_HPP
|
||||
|
||||
#include <chrono>
|
||||
#include <future>
|
||||
@@ -57,11 +57,11 @@ public:
|
||||
|
||||
/// Find the best command among all available commands at the given depth.
|
||||
struct IndexAndScore {
|
||||
size_t index;
|
||||
CommandType type;
|
||||
ScoreValue lookaheadScore;
|
||||
ScoreValue immediateScore;
|
||||
bool completed;
|
||||
size_t index{};
|
||||
CommandType type{};
|
||||
ScoreValue lookaheadScore{};
|
||||
ScoreValue immediateScore{};
|
||||
bool completed{};
|
||||
};
|
||||
|
||||
[[nodiscard]] auto FindBestCommand(
|
||||
@@ -78,11 +78,11 @@ public:
|
||||
private:
|
||||
const AIScoreCalculator& scorer_;
|
||||
const APDCache& apdCache_;
|
||||
BattalionTypeGetter battalionTypeGetter_; // Store by value
|
||||
BattalionTypeGetter battalionTypeGetter_;
|
||||
|
||||
struct ImmediateAndLookaheadScore {
|
||||
ScoreValue immediateScore;
|
||||
bool completed;
|
||||
ScoreValue immediateScore{};
|
||||
bool completed{};
|
||||
std::future<EvaluationResult> lookaheadScore;
|
||||
};
|
||||
|
||||
@@ -114,4 +114,4 @@ private:
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AICOMMANDEVALUATOR_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_COMMAND_EVALUATOR_HPP
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Filter obviously bad commands to reduce search space for AI
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AICOMMANDFILTER_HPP
|
||||
#define EAGLE0_AICOMMANDFILTER_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_COMMAND_FILTER_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_COMMAND_FILTER_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -116,4 +116,4 @@ private:
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AICOMMANDFILTER_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_COMMAND_FILTER_HPP
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// Common type definitions used across AI utility functions
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AICOMMONTYPES_HPP
|
||||
#define EAGLE0_AICOMMONTYPES_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_COMMON_TYPES_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_COMMON_TYPES_HPP
|
||||
|
||||
#include <functional>
|
||||
|
||||
@@ -20,4 +20,4 @@ using BattalionTypeGetter = std::function<BattalionTypeSPtr(BattalionTypeId)>;
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AICOMMONTYPES_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_COMMON_TYPES_HPP
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// AI System Types and Configuration
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AI_CONFIG_HPP
|
||||
#define EAGLE0_AI_CONFIG_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_CONFIG_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_CONFIG_HPP
|
||||
|
||||
namespace shardok {
|
||||
|
||||
@@ -22,4 +22,4 @@ enum class ScoringCalculatorType {
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AI_CONFIG_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_CONFIG_HPP
|
||||
|
||||
@@ -32,6 +32,7 @@ auto AIDefenderStrategySelector::BestDefenderStrategy(
|
||||
bool canFlee = false;
|
||||
|
||||
vector<UnitId> attackerUnitIdsRequiringWaterCrossing{};
|
||||
attackerUnitIdsRequiringWaterCrossing.reserve(gameState->units()->size());
|
||||
for (const auto& player : *gameState->player_infos()) {
|
||||
if (!player->is_defender()) {
|
||||
const auto& unitIdsRequiringWaterCrossing = UnitIdsRequiringWaterCrossing(
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Created by Dan Crosby on 8/30/23.
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AIDEFENDERSTRATEGYSELECTOR_HPP
|
||||
#define EAGLE0_AIDEFENDERSTRATEGYSELECTOR_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_DEFENDER_STRATEGY_SELECTOR_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_DEFENDER_STRATEGY_SELECTOR_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/ai/AIAttackLocations.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/ai/AICommonTypes.hpp"
|
||||
@@ -26,4 +26,4 @@ public:
|
||||
};
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AIDEFENDERSTRATEGYSELECTOR_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_DEFENDER_STRATEGY_SELECTOR_HPP
|
||||
|
||||
@@ -55,12 +55,12 @@ auto DefenderDistanceBuf(
|
||||
const bool includeUndead) -> double {
|
||||
const auto &locationsToAttackMe = alCache->CachedLocations(defenderLocation, lateGame);
|
||||
|
||||
struct WithoutAndWith {
|
||||
struct alignas(8) WithoutAndWith {
|
||||
int without;
|
||||
int with;
|
||||
|
||||
WithoutAndWith(const int a, const int b) : without(a), with(b) {}
|
||||
} __attribute__((aligned(8)));
|
||||
};
|
||||
|
||||
vector<WithoutAndWith> pointCosts{};
|
||||
pointCosts.reserve(attackerUnits.size());
|
||||
@@ -104,23 +104,21 @@ auto DefenderDistanceBuf(
|
||||
pointCostToDesiredTargetWithBraving);
|
||||
}
|
||||
|
||||
std::sort(
|
||||
begin(pointCosts),
|
||||
end(pointCosts),
|
||||
[](const WithoutAndWith &left, const WithoutAndWith &right) {
|
||||
return left.without == right.without ? left.with < right.with
|
||||
: left.without < right.without;
|
||||
});
|
||||
std::ranges::sort(pointCosts, [](const WithoutAndWith &left, const WithoutAndWith &right) {
|
||||
return left.without == right.without ? left.with < right.with
|
||||
: left.without < right.without;
|
||||
});
|
||||
|
||||
// experiment: add dummy values to the end with very high cost, so there's never an advantage
|
||||
// to leaving a defender unit alive in a castle.
|
||||
for (size_t i = attackerUnits.size(); i < 20; i++) { pointCosts.emplace_back(999, 999); }
|
||||
for (size_t i = attackerUnits.size(); i < 20; ++i) { pointCosts.emplace_back(999, 999); }
|
||||
|
||||
double sum = 0.0;
|
||||
double decr = kPerUnitDebufDecay;
|
||||
for (const WithoutAndWith &pointCost : pointCosts) {
|
||||
const int effectiveCost =
|
||||
(pointCost.without == 999) ? int(1.2 * pointCost.with) : pointCost.without;
|
||||
const int effectiveCost = (pointCost.without == 999)
|
||||
? static_cast<int>(1.2 * pointCost.with)
|
||||
: pointCost.without;
|
||||
sum += decr / (effectiveCost + 1);
|
||||
decr *= kPerUnitDebufDecay;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Created by Dan Crosby on 5/10/21.
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AIDISTANCEDEBUF_HPP
|
||||
#define EAGLE0_AIDISTANCEDEBUF_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_DISTANCE_DEBUF_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_DISTANCE_DEBUF_HPP
|
||||
|
||||
#include "AIAttackLocations.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/ai/AICommonTypes.hpp"
|
||||
@@ -13,14 +13,11 @@
|
||||
|
||||
namespace shardok {
|
||||
|
||||
using std::shared_ptr;
|
||||
using std::vector;
|
||||
|
||||
auto DefenderDistanceBuf(
|
||||
[[nodiscard]] auto DefenderDistanceBuf(
|
||||
const Coords &defenderLocation,
|
||||
const HexMap *hexMap,
|
||||
const MapId &mapId,
|
||||
const vector<const Unit *> &attackerUnits,
|
||||
const std::vector<const Unit *> &attackerUnits,
|
||||
const APDCache &apdCache,
|
||||
const ALCache &alCache,
|
||||
const BattalionTypeGetter &battalionTypeGetter,
|
||||
@@ -29,4 +26,4 @@ auto DefenderDistanceBuf(
|
||||
bool includeUndead) -> double;
|
||||
|
||||
} // namespace shardok
|
||||
#endif // EAGLE0_AIDISTANCEDEBUF_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_DISTANCE_DEBUF_HPP
|
||||
|
||||
@@ -2,22 +2,36 @@
|
||||
// Temporary AI experiment switches used by benchmark-only EXPERIMENTAL runs.
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AI_EXPERIMENT_CONFIG_HPP
|
||||
#define EAGLE0_AI_EXPERIMENT_CONFIG_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_EXPERIMENT_CONFIG_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_EXPERIMENT_CONFIG_HPP
|
||||
|
||||
#include <charconv>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <system_error>
|
||||
|
||||
namespace shardok {
|
||||
|
||||
inline auto CurrentAIExperimentId() -> int {
|
||||
[[nodiscard]] inline auto CurrentAIExperimentId() -> int {
|
||||
const char* rawValue = std::getenv("SHARDOK_SCORING_EXPERIMENT_ID");
|
||||
if (rawValue == nullptr || std::string(rawValue).empty()) { return 0; }
|
||||
return std::atoi(rawValue);
|
||||
if (rawValue == nullptr) { return 0; }
|
||||
|
||||
const std::string_view value(rawValue);
|
||||
if (value.empty()) { return 0; }
|
||||
|
||||
int experimentId = 0;
|
||||
const auto parseResult =
|
||||
std::from_chars(value.data(), value.data() + value.size(), experimentId);
|
||||
if (parseResult.ec != std::errc{} || parseResult.ptr != value.data() + value.size()) {
|
||||
return 0;
|
||||
}
|
||||
return experimentId;
|
||||
}
|
||||
|
||||
inline auto IsAIExperiment(const int id) -> bool { return CurrentAIExperimentId() == id; }
|
||||
[[nodiscard]] inline auto IsAIExperiment(const int id) -> bool {
|
||||
return CurrentAIExperimentId() == id;
|
||||
}
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AI_EXPERIMENT_CONFIG_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_EXPERIMENT_CONFIG_HPP
|
||||
|
||||
@@ -8,12 +8,31 @@
|
||||
|
||||
#include "AIFleeDecisionCalculator.hpp"
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/ai/AIScoreUtilities.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/ai/AIUnitScoreCalculator.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/util/HexMapUtils.hpp"
|
||||
|
||||
namespace shardok {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr double kCertainCombatWinChance = 0.95;
|
||||
|
||||
void WritePercent(std::ostream& output, const double value) {
|
||||
const auto flags = output.flags();
|
||||
const auto precision = output.precision();
|
||||
|
||||
output << std::fixed << std::setprecision(1) << value;
|
||||
|
||||
output.flags(flags);
|
||||
output.precision(precision);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
auto AIFleeDecisionCalculator::GetFleeCommandIndex(
|
||||
const CommandList::const_iterator& fleeCommand,
|
||||
const CommandListSPtr& availableCommands) -> size_t {
|
||||
@@ -137,77 +156,41 @@ auto AIFleeDecisionCalculator::EvaluateFleeVsFight(
|
||||
const CommandListSPtr& availableCommands,
|
||||
const CommandList::const_iterator& fleeCommand,
|
||||
int maxRounds,
|
||||
int minimumFleeOddsThreshold,
|
||||
int desperateFleeThreshold,
|
||||
int /*minimumFleeOddsThreshold*/,
|
||||
int /*desperateFleeThreshold*/,
|
||||
bool enableDebugLogging) -> FleeDecision {
|
||||
// Get flee success odds
|
||||
const int fleeSuccessChance = (*fleeCommand)->GetOddsPercentile();
|
||||
|
||||
if (enableDebugLogging) {
|
||||
printf("AI FinalRound: Evaluating flee (odds=%d%%)...\n", fleeSuccessChance);
|
||||
std::cout << "AI FinalRound: Evaluating flee (odds=" << fleeSuccessChance << "%)...\n";
|
||||
}
|
||||
|
||||
// Check if flee odds are good enough to attempt
|
||||
if (fleeSuccessChance >= minimumFleeOddsThreshold) {
|
||||
if (enableDebugLogging) {
|
||||
printf("AI FinalRound: Good flee odds (%d%% >= %d%%), choosing flee\n",
|
||||
fleeSuccessChance,
|
||||
minimumFleeOddsThreshold);
|
||||
}
|
||||
return FleeDecision{
|
||||
true,
|
||||
GetFleeCommandIndex(fleeCommand, availableCommands),
|
||||
"Good flee odds"};
|
||||
}
|
||||
|
||||
// Low flee odds - evaluate if fighting might be better
|
||||
const double combatWinChance = EstimateCombatSuccess(playerId, guessedState, maxRounds);
|
||||
|
||||
// If combat situation is hopeless, even bad flee odds are better than certain death
|
||||
if (combatWinChance <= 0.05 && fleeSuccessChance >= desperateFleeThreshold) {
|
||||
if (combatWinChance < kCertainCombatWinChance) {
|
||||
if (enableDebugLogging) {
|
||||
printf("AI FinalRound: Combat hopeless (%.1f%%), desperate flee attempt (%d%%)\n",
|
||||
combatWinChance * 100,
|
||||
fleeSuccessChance);
|
||||
std::cout << "AI FinalRound: Combat not certain (";
|
||||
WritePercent(std::cout, combatWinChance * 100);
|
||||
std::cout << "% < ";
|
||||
WritePercent(std::cout, kCertainCombatWinChance * 100);
|
||||
std::cout << "%), choosing flee\n";
|
||||
}
|
||||
return FleeDecision{
|
||||
true,
|
||||
GetFleeCommandIndex(fleeCommand, availableCommands),
|
||||
"Combat hopeless, desperate flee"};
|
||||
"Last round combat not certain"};
|
||||
}
|
||||
|
||||
// Detailed flee vs fight comparison
|
||||
const double fleeChance = static_cast<double>(fleeSuccessChance) / 100.0;
|
||||
|
||||
// Compare expected outcomes:
|
||||
// - Flee: fleeChance of survival (not victory, but avoiding loss)
|
||||
// - Fight: combatWinChance of victory (better than survival)
|
||||
|
||||
constexpr double FLEE_VS_COMBAT_MARGIN =
|
||||
0.8; // Require 80% of combat chance to prefer fighting
|
||||
const double adjustedCombatThreshold = combatWinChance * FLEE_VS_COMBAT_MARGIN;
|
||||
|
||||
if (enableDebugLogging) {
|
||||
printf("AI FinalRound: Flee=%d%%, Combat=%.1f%%, Threshold=%.1f%% -> ",
|
||||
fleeSuccessChance,
|
||||
combatWinChance * 100,
|
||||
adjustedCombatThreshold * 100);
|
||||
}
|
||||
|
||||
if (fleeChance > adjustedCombatThreshold) {
|
||||
if (enableDebugLogging) { printf("FLEE (better odds)\n"); }
|
||||
return FleeDecision{
|
||||
true,
|
||||
GetFleeCommandIndex(fleeCommand, availableCommands),
|
||||
"Flee has better expected outcome"};
|
||||
} else {
|
||||
if (enableDebugLogging) { printf("FIGHT (better expected outcome)\n"); }
|
||||
// Return 0 to indicate we should use standard command selection
|
||||
return FleeDecision{
|
||||
false,
|
||||
0, // Will be replaced by StandardChooseCommandIndex
|
||||
"Fighting has better expected outcome"};
|
||||
std::cout << "AI FinalRound: Combat effectively certain (";
|
||||
WritePercent(std::cout, combatWinChance * 100);
|
||||
std::cout << "%), fighting\n";
|
||||
}
|
||||
return FleeDecision{
|
||||
false,
|
||||
0, // Will be replaced by StandardChooseCommandIndex
|
||||
"Combat effectively certain"};
|
||||
}
|
||||
|
||||
auto AIFleeDecisionCalculator::ShouldConsiderFleeing(
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// Provides O(1) weights based on command type and context
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AI_HEURISTIC_WEIGHTING_HPP
|
||||
#define EAGLE0_AI_HEURISTIC_WEIGHTING_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_HEURISTIC_WEIGHTING_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_HEURISTIC_WEIGHTING_HPP
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
|
||||
@@ -37,4 +37,4 @@ public:
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AI_HEURISTIC_WEIGHTING_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_HEURISTIC_WEIGHTING_HPP
|
||||
|
||||
@@ -5,15 +5,34 @@
|
||||
#include "AIMinimumDistanceAndTarget.hpp"
|
||||
|
||||
namespace shardok {
|
||||
namespace {
|
||||
|
||||
auto CoordsIndex(const Coords &coords, const int columnCount) -> int {
|
||||
return coords.row() * columnCount + coords.column();
|
||||
}
|
||||
|
||||
auto CoordsFromIndex(const size_t index, const int columnCount) -> Coords {
|
||||
return Coords(
|
||||
static_cast<int8_t>(index / static_cast<size_t>(columnCount)),
|
||||
static_cast<int8_t>(index % static_cast<size_t>(columnCount)));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
auto MinimumDistanceAndTarget(
|
||||
const ActionPointDistances *apd,
|
||||
const Coords &origin,
|
||||
const CoordsSet &destinations) -> CoordsAndDistance {
|
||||
CoordsAndDistance min{Coords(-1, -1), ActionPointDistances::IMPOSSIBLE};
|
||||
for (const auto &dest : destinations) {
|
||||
const DIST_T dist = apd->Distance(origin, dest);
|
||||
const int columnCount = destinations.ColumnCount();
|
||||
const int originIndex = CoordsIndex(origin, columnCount);
|
||||
|
||||
for (const auto destIndex : destinations.indexIterator()) {
|
||||
const DIST_T dist = apd->Distance(originIndex, static_cast<int>(destIndex));
|
||||
if (dist == ActionPointDistances::IMPOSSIBLE) continue;
|
||||
if (dist < min.distance) min = CoordsAndDistance{dest, dist};
|
||||
if (dist < min.distance) {
|
||||
min = CoordsAndDistance{CoordsFromIndex(destIndex, columnCount), dist};
|
||||
}
|
||||
}
|
||||
|
||||
return min;
|
||||
@@ -25,4 +44,4 @@ auto MinimumDistance(
|
||||
const CoordsSet &destinations) -> int {
|
||||
return MinimumDistanceAndTarget(apd, origin, destinations).distance;
|
||||
}
|
||||
} // namespace shardok
|
||||
} // namespace shardok
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
// Created by Dan Crosby on 8/31/23.
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AIMINIMUMDISTANCEANDTARGET_HPP
|
||||
#define EAGLE0_AIMINIMUMDISTANCEANDTARGET_HPP
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_MINIMUM_DISTANCE_AND_TARGET_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_MINIMUM_DISTANCE_AND_TARGET_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/action_point_distances/ActionPointDistances.hpp"
|
||||
#include "src/main/cpp/net/eagle0/shardok/library/map/CoordsSet.hpp"
|
||||
@@ -15,23 +12,22 @@
|
||||
namespace shardok {
|
||||
|
||||
using net::eagle0::shardok::storage::fb::Coords;
|
||||
using std::shared_ptr;
|
||||
|
||||
struct CoordsAndDistance {
|
||||
Coords coords;
|
||||
int distance;
|
||||
};
|
||||
|
||||
auto MinimumDistanceAndTarget(
|
||||
[[nodiscard]] auto MinimumDistanceAndTarget(
|
||||
const ActionPointDistances *apd,
|
||||
const Coords &origin,
|
||||
const CoordsSet &destinations) -> CoordsAndDistance;
|
||||
|
||||
auto MinimumDistance(
|
||||
[[nodiscard]] auto MinimumDistance(
|
||||
const ActionPointDistances *apd,
|
||||
const Coords &origin,
|
||||
const CoordsSet &destinations) -> int;
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AIMINIMUMDISTANCEANDTARGET_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_MINIMUM_DISTANCE_AND_TARGET_HPP
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Created by Dan Crosby on 4/7/21.
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AISCOREUTILITIES_HPP
|
||||
#define EAGLE0_AISCOREUTILITIES_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_SCORE_UTILITIES_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_SCORE_UTILITIES_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -16,19 +16,18 @@ namespace shardok {
|
||||
|
||||
using ScoreValue = double;
|
||||
|
||||
using std::vector;
|
||||
|
||||
using GameState = net::eagle0::shardok::storage::fb::GameState;
|
||||
using PlayerInfo = net::eagle0::shardok::storage::fb::PlayerInfo;
|
||||
using Unit = net::eagle0::shardok::storage::fb::Unit;
|
||||
|
||||
auto HasAttachedHeroWithProfession(
|
||||
[[nodiscard]] auto HasAttachedHeroWithProfession(
|
||||
const Unit *unit,
|
||||
net::eagle0::shardok::storage::fb::Profession profession) -> bool;
|
||||
|
||||
auto CastleClaimCapableAttackerUnitCount(const GameStateW &gameState) -> int;
|
||||
auto PlayerInfoForPid(const GameStateW &, PlayerId pid) -> const PlayerInfo *;
|
||||
[[nodiscard]] auto CastleClaimCapableAttackerUnitCount(const GameStateW &gameState) -> int;
|
||||
[[nodiscard]] auto PlayerInfoForPid(const GameStateW &gameState, PlayerId pid)
|
||||
-> const PlayerInfo *;
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AISCOREUTILITIES_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_SCORE_UTILITIES_HPP
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Created by Dan Crosby on 1/10/22.
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AISTRATEGY_HPP
|
||||
#define EAGLE0_AISTRATEGY_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_STRATEGY_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_STRATEGY_HPP
|
||||
|
||||
#include "src/main/cpp/net/eagle0/shardok/ai/AIAttackGroups.hpp"
|
||||
|
||||
@@ -26,12 +26,14 @@ struct AIStrategy {
|
||||
};
|
||||
|
||||
extern AIStrategy FleeStrategy;
|
||||
auto AttackUnitsStrategy(const vector<TargetPriorityList>& targetPriorities) -> AIStrategy;
|
||||
auto AttackCastlesStrategy(const vector<TargetPriorityList>& targetPriorities) -> AIStrategy;
|
||||
[[nodiscard]] auto AttackUnitsStrategy(const vector<TargetPriorityList>& targetPriorities)
|
||||
-> AIStrategy;
|
||||
[[nodiscard]] auto AttackCastlesStrategy(const vector<TargetPriorityList>& targetPriorities)
|
||||
-> AIStrategy;
|
||||
extern AIStrategy HoldCastlesStrategy;
|
||||
extern AIStrategy ScatterStrategy;
|
||||
auto CrossRiversStrategy(const CoordsSet& targetLocations) -> AIStrategy;
|
||||
[[nodiscard]] auto CrossRiversStrategy(const CoordsSet& targetLocations) -> AIStrategy;
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AISTRATEGY_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_STRATEGY_HPP
|
||||
|
||||
@@ -116,15 +116,6 @@ auto CalculateTimeBudget(
|
||||
const auto clampedBudgetMs = std::clamp(budgetMs, 200.0, maxBudgetMs);
|
||||
const auto remainingBudget = std::chrono::milliseconds(static_cast<int64_t>(clampedBudgetMs));
|
||||
|
||||
// TEMPORARY DEBUG OUTPUT
|
||||
printf("[DEBUG CalculateTimeBudget] numCommands=%zu, msPerCommand=%.2f, budgetMs=%.2f, "
|
||||
"clampedBudgetMs=%.2f, isClose=%d\n",
|
||||
numCommands,
|
||||
msPerCommand,
|
||||
budgetMs,
|
||||
clampedBudgetMs,
|
||||
isClose);
|
||||
|
||||
// Get minimum depth requirement
|
||||
const size_t minDepth = settingsGetter.Backing().min_lookahead_turns();
|
||||
|
||||
@@ -134,4 +125,4 @@ auto CalculateTimeBudget(
|
||||
.isCloseToEnemy = isClose};
|
||||
}
|
||||
|
||||
} // namespace shardok
|
||||
} // namespace shardok
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Created by Dan Crosby on 07/04/25.
|
||||
//
|
||||
|
||||
#ifndef EAGLE0_AITIMEBUDGET_HPP
|
||||
#define EAGLE0_AITIMEBUDGET_HPP
|
||||
#ifndef EAGLE0_SHARDOK_AI_AI_TIME_BUDGET_HPP
|
||||
#define EAGLE0_SHARDOK_AI_AI_TIME_BUDGET_HPP
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
@@ -25,7 +25,12 @@ class AIEvaluationCounter {
|
||||
public:
|
||||
AIEvaluationCounter();
|
||||
~AIEvaluationCounter();
|
||||
static int GetCurrentCount();
|
||||
AIEvaluationCounter(const AIEvaluationCounter&) = delete;
|
||||
auto operator=(const AIEvaluationCounter&) -> AIEvaluationCounter& = delete;
|
||||
AIEvaluationCounter(AIEvaluationCounter&&) = delete;
|
||||
auto operator=(AIEvaluationCounter&&) -> AIEvaluationCounter& = delete;
|
||||
|
||||
[[nodiscard]] static int GetCurrentCount();
|
||||
};
|
||||
|
||||
// Configuration structure for iterative deepening time budget
|
||||
@@ -39,13 +44,13 @@ struct AITimeBudget {
|
||||
// Time budget is calculated dynamically based on number of available commands:
|
||||
// budget = msPerCommand × numCommands (clamped to 200-5000ms)
|
||||
// If isAllAiBattle is true, uses allAiBattleTimeBudgetMaximum instead of the normal maximum.
|
||||
auto CalculateTimeBudget(
|
||||
[[nodiscard]] auto CalculateTimeBudget(
|
||||
PlayerId playerId,
|
||||
const GameSettingsSPtr &settings,
|
||||
const GameStateW &state,
|
||||
const GameSettingsSPtr& settings,
|
||||
const GameStateW& state,
|
||||
size_t numCommands,
|
||||
bool isAllAiBattle) -> AITimeBudget;
|
||||
|
||||
} // namespace shardok
|
||||
|
||||
#endif // EAGLE0_AITIMEBUDGET_HPP
|
||||
#endif // EAGLE0_SHARDOK_AI_AI_TIME_BUDGET_HPP
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
|
||||
namespace shardok {
|
||||
|
||||
using std::begin;
|
||||
using std::end;
|
||||
using std::shared_ptr;
|
||||
|
||||
constexpr double kProfessionValue = 200;
|
||||
constexpr double kVigorScoreMultiplier = 5.0;
|
||||
constexpr double kCastleMultiplierBonus = 1.0;
|
||||
@@ -92,8 +88,8 @@ auto ContextFreeUnitValue(const Unit *unit) -> ScoreValue {
|
||||
break;
|
||||
}
|
||||
|
||||
const double battalionValue = battalionTypeMultiplier * (1.0 + armament / 100.0) *
|
||||
(1.0 + training / 100.0) * (0.5 + morale / 100.0) *
|
||||
const double battalionValue = battalionTypeMultiplier * (1.0 + (armament / 100.0)) *
|
||||
(1.0 + (training / 100.0)) * (0.5 + (morale / 100.0)) *
|
||||
unit->battalion().size();
|
||||
|
||||
const double heroValue =
|
||||
@@ -124,15 +120,16 @@ auto archeryValue(const vector<const Unit *> &enemyUnits, const bool canShootNow
|
||||
|
||||
auto reduceValue(const Unit *unit, const Terrain *unitTerrain) -> double {
|
||||
// TODO: make this depend on value of reducing castle too
|
||||
if (unit->fortified() || unitTerrain->modifier().castle().present())
|
||||
if (unit->fortified() || unitTerrain->modifier().castle().present()) {
|
||||
return kReduceFortifiedPossibleValue;
|
||||
else if (AllowsFortification(unitTerrain))
|
||||
return kReduceUnfortifiedPossibleValue;
|
||||
else
|
||||
return 0.0;
|
||||
}
|
||||
if (AllowsFortification(unitTerrain)) { return kReduceUnfortifiedPossibleValue; }
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
auto fearValue(const vector<const Unit *> &) -> double { return kFearPossibleValue; }
|
||||
auto fearValue([[maybe_unused]] const vector<const Unit *> &enemyUnits) -> double {
|
||||
return kFearPossibleValue;
|
||||
}
|
||||
|
||||
auto lightningValue(const Unit *unit) -> double {
|
||||
// TODO: make this depend on the value of the targets
|
||||
@@ -239,9 +236,8 @@ auto meteorValue(
|
||||
multiplier = kMeteorNoneRoundMultiplier * vigorFactor;
|
||||
}
|
||||
return maxValue * multiplier;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
case net::eagle0::shardok::storage::fb::MultiroundMagicState_TARGET:
|
||||
@@ -251,9 +247,8 @@ auto meteorValue(
|
||||
map,
|
||||
enemyOccupants,
|
||||
friendlyOccupants);
|
||||
} else {
|
||||
return bestTargetValue(unit, map, enemyOccupants, friendlyOccupants, meteorRange);
|
||||
}
|
||||
return bestTargetValue(unit, map, enemyOccupants, friendlyOccupants, meteorRange);
|
||||
case net::eagle0::shardok::storage::fb::MultiroundMagicState_CAST:
|
||||
return kMeteorCastRoundMultiplier *
|
||||
meteorDropRawValue(
|
||||
@@ -280,7 +275,7 @@ auto GetRangedAttackBonus(
|
||||
const int meteorRange,
|
||||
const double minVigorToCast,
|
||||
const ActionPoints archeryActionPointCost) -> double {
|
||||
vector<double> rangedAttackValues{};
|
||||
double bestRangedAttackValue = 0.0;
|
||||
|
||||
const auto &enemyUnits = isAttacker ? defenderUnits : attackerUnits;
|
||||
const auto &friendlyUnits = isAttacker ? attackerUnits : defenderUnits;
|
||||
@@ -296,7 +291,7 @@ auto GetRangedAttackBonus(
|
||||
net::eagle0::shardok::storage::fb::MultiroundMagicState_NONE)) {
|
||||
if (unit->attached_hero().profession_info().meteor_cast_state() ==
|
||||
net::eagle0::shardok::storage::fb::MultiroundMagicState_NONE) {
|
||||
rangedAttackValues.push_back(lightningValue(unit));
|
||||
bestRangedAttackValue = std::max(bestRangedAttackValue, lightningValue(unit));
|
||||
} else {
|
||||
const double mv = meteorValue(
|
||||
unit,
|
||||
@@ -306,14 +301,14 @@ auto GetRangedAttackBonus(
|
||||
friendlyUnits,
|
||||
meteorRange,
|
||||
minVigorToCast);
|
||||
rangedAttackValues.push_back(mv);
|
||||
bestRangedAttackValue = std::max(bestRangedAttackValue, mv);
|
||||
}
|
||||
}
|
||||
|
||||
if (attackLocations.EngineerLocations().Contains(unitLocation) && unit->has_attached_hero() &&
|
||||
unit->attached_hero().profession_info().profession() ==
|
||||
net::eagle0::shardok::storage::fb::Profession_ENGINEER) {
|
||||
rangedAttackValues.push_back(reduceValue(unit, terrain));
|
||||
bestRangedAttackValue = std::max(bestRangedAttackValue, reduceValue(unit, terrain));
|
||||
}
|
||||
|
||||
if (attackLocations.NecromancerLocations().Contains(unitLocation) &&
|
||||
@@ -321,23 +316,24 @@ auto GetRangedAttackBonus(
|
||||
unit->attached_hero().profession_info().profession() ==
|
||||
net::eagle0::shardok::storage::fb::Profession_NECROMANCER &&
|
||||
unit->attached_hero().control_info().controlled_unit_id() != -1) {
|
||||
rangedAttackValues.push_back(fearValue(enemyUnits));
|
||||
bestRangedAttackValue = std::max(bestRangedAttackValue, fearValue(enemyUnits));
|
||||
}
|
||||
|
||||
if (attackLocations.ArcheryLocations().Contains(unitLocation) &&
|
||||
unit->volleys_remaining() > 0) {
|
||||
rangedAttackValues.push_back(archeryValue(enemyUnits, canShootNow));
|
||||
bestRangedAttackValue =
|
||||
std::max(bestRangedAttackValue, archeryValue(enemyUnits, canShootNow));
|
||||
}
|
||||
|
||||
// Longbowmen in castle can archer adjacent
|
||||
if (attackLocations.AdjacentLocations().Contains(unitLocation) &&
|
||||
unit->volleys_remaining() > 0 && terrain->modifier().castle().present() &&
|
||||
unit->battalion().type() == net::eagle0::shardok::storage::fb::BattalionTypeId_LONGBOWMEN) {
|
||||
rangedAttackValues.push_back(archeryValue(enemyUnits, canShootNow));
|
||||
bestRangedAttackValue =
|
||||
std::max(bestRangedAttackValue, archeryValue(enemyUnits, canShootNow));
|
||||
}
|
||||
|
||||
if (rangedAttackValues.empty()) return 0.0;
|
||||
return *std::max_element(begin(rangedAttackValues), end(rangedAttackValues));
|
||||
return bestRangedAttackValue;
|
||||
}
|
||||
|
||||
auto UnitValue(
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user