small-text-mmo-engine 0.41.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. small_text_mmo_engine-0.41.1/LICENSE +201 -0
  2. small_text_mmo_engine-0.41.1/MANIFEST.in +6 -0
  3. small_text_mmo_engine-0.41.1/PKG-INFO +273 -0
  4. small_text_mmo_engine-0.41.1/README.md +260 -0
  5. small_text_mmo_engine-0.41.1/THIRD_PARTY_NOTICES.md +26 -0
  6. small_text_mmo_engine-0.41.1/config_schema.py +443 -0
  7. small_text_mmo_engine-0.41.1/config_write.py +247 -0
  8. small_text_mmo_engine-0.41.1/dashboard.html +3679 -0
  9. small_text_mmo_engine-0.41.1/harness/__init__.py +3 -0
  10. small_text_mmo_engine-0.41.1/harness/__main__.py +98 -0
  11. small_text_mmo_engine-0.41.1/harness/bridge.py +241 -0
  12. small_text_mmo_engine-0.41.1/harness/mcp_stdio.py +485 -0
  13. small_text_mmo_engine-0.41.1/ml/__init__.py +0 -0
  14. small_text_mmo_engine-0.41.1/ml/arena_probe.py +457 -0
  15. small_text_mmo_engine-0.41.1/ml/balance.py +2650 -0
  16. small_text_mmo_engine-0.41.1/ml/conductor/__init__.py +36 -0
  17. small_text_mmo_engine-0.41.1/ml/conductor/churn.py +206 -0
  18. small_text_mmo_engine-0.41.1/ml/conductor/conductor.py +457 -0
  19. small_text_mmo_engine-0.41.1/ml/conductor/metrics.py +124 -0
  20. small_text_mmo_engine-0.41.1/ml/conductor/mixer.py +113 -0
  21. small_text_mmo_engine-0.41.1/ml/conductor/pbt.py +157 -0
  22. small_text_mmo_engine-0.41.1/ml/conductor/registry.py +384 -0
  23. small_text_mmo_engine-0.41.1/ml/conductor/reload.py +75 -0
  24. small_text_mmo_engine-0.41.1/ml/conductor/runners.py +70 -0
  25. small_text_mmo_engine-0.41.1/ml/conductor/soak.py +542 -0
  26. small_text_mmo_engine-0.41.1/ml/conductor/soak_server_config.json +15 -0
  27. small_text_mmo_engine-0.41.1/ml/conductor/supervisor.py +873 -0
  28. small_text_mmo_engine-0.41.1/ml/diversity.py +214 -0
  29. small_text_mmo_engine-0.41.1/ml/dungeon_generator.py +272 -0
  30. small_text_mmo_engine-0.41.1/ml/generalist.py +274 -0
  31. small_text_mmo_engine-0.41.1/ml/guild_probe.py +342 -0
  32. small_text_mmo_engine-0.41.1/ml/launcher.py +314 -0
  33. small_text_mmo_engine-0.41.1/ml/league.py +283 -0
  34. small_text_mmo_engine-0.41.1/ml/market_equilibrium.py +283 -0
  35. small_text_mmo_engine-0.41.1/ml/ml_best.json +11514 -0
  36. small_text_mmo_engine-0.41.1/ml/ml_botfarm.py +564 -0
  37. small_text_mmo_engine-0.41.1/ml/ml_client.py +350 -0
  38. small_text_mmo_engine-0.41.1/ml/ml_config.json +15 -0
  39. small_text_mmo_engine-0.41.1/ml/ml_env.py +3234 -0
  40. small_text_mmo_engine-0.41.1/ml/modes/__init__.py +242 -0
  41. small_text_mmo_engine-0.41.1/ml/modes/arena.py +64 -0
  42. small_text_mmo_engine-0.41.1/ml/open_mode.py +231 -0
  43. small_text_mmo_engine-0.41.1/ml/plugin_inventory.py +175 -0
  44. small_text_mmo_engine-0.41.1/ml/plugins/__init__.py +518 -0
  45. small_text_mmo_engine-0.41.1/ml/plugins/linear.py +52 -0
  46. small_text_mmo_engine-0.41.1/ml/plugins/scripted.py +1060 -0
  47. small_text_mmo_engine-0.41.1/ml/plugins/torch_plugin.py +76 -0
  48. small_text_mmo_engine-0.41.1/ml/repro.py +170 -0
  49. small_text_mmo_engine-0.41.1/ml/reward_dsl.py +373 -0
  50. small_text_mmo_engine-0.41.1/ml/runlog.py +516 -0
  51. small_text_mmo_engine-0.41.1/ml/structured_log.py +52 -0
  52. small_text_mmo_engine-0.41.1/ml/telemetry.py +177 -0
  53. small_text_mmo_engine-0.41.1/ml/transcript.py +69 -0
  54. small_text_mmo_engine-0.41.1/ml/versioning.py +64 -0
  55. small_text_mmo_engine-0.41.1/plugins/README.md +52 -0
  56. small_text_mmo_engine-0.41.1/plugins/__pycache__/_tmp_727_bad.cpython-314.pyc +0 -0
  57. small_text_mmo_engine-0.41.1/plugins/__pycache__/redteam.cpython-314.pyc +0 -0
  58. small_text_mmo_engine-0.41.1/plugins/redteam.py +213 -0
  59. small_text_mmo_engine-0.41.1/pyproject.toml +23 -0
  60. small_text_mmo_engine-0.41.1/server.py +15477 -0
  61. small_text_mmo_engine-0.41.1/server_config.json +107 -0
  62. small_text_mmo_engine-0.41.1/setup.cfg +4 -0
  63. small_text_mmo_engine-0.41.1/small_text_mmo_engine.egg-info/PKG-INFO +273 -0
  64. small_text_mmo_engine-0.41.1/small_text_mmo_engine.egg-info/SOURCES.txt +166 -0
  65. small_text_mmo_engine-0.41.1/small_text_mmo_engine.egg-info/dependency_links.txt +1 -0
  66. small_text_mmo_engine-0.41.1/small_text_mmo_engine.egg-info/entry_points.txt +2 -0
  67. small_text_mmo_engine-0.41.1/small_text_mmo_engine.egg-info/requires.txt +2 -0
  68. small_text_mmo_engine-0.41.1/small_text_mmo_engine.egg-info/top_level.txt +8 -0
  69. small_text_mmo_engine-0.41.1/start.py +447 -0
  70. small_text_mmo_engine-0.41.1/tests/test_arena_match.py +315 -0
  71. small_text_mmo_engine-0.41.1/tests/test_arena_probe.py +460 -0
  72. small_text_mmo_engine-0.41.1/tests/test_arena_ratings.py +548 -0
  73. small_text_mmo_engine-0.41.1/tests/test_arena_spectator.py +257 -0
  74. small_text_mmo_engine-0.41.1/tests/test_arena_spectator_edges.py +204 -0
  75. small_text_mmo_engine-0.41.1/tests/test_balance_harness.py +1341 -0
  76. small_text_mmo_engine-0.41.1/tests/test_checkpoint_reload.py +200 -0
  77. small_text_mmo_engine-0.41.1/tests/test_ci_config.py +86 -0
  78. small_text_mmo_engine-0.41.1/tests/test_companion_assist_cap.py +126 -0
  79. small_text_mmo_engine-0.41.1/tests/test_compose_packaging.py +157 -0
  80. small_text_mmo_engine-0.41.1/tests/test_conductor.py +1314 -0
  81. small_text_mmo_engine-0.41.1/tests/test_conductor_run.py +132 -0
  82. small_text_mmo_engine-0.41.1/tests/test_curriculum.py +127 -0
  83. small_text_mmo_engine-0.41.1/tests/test_dashboard.py +847 -0
  84. small_text_mmo_engine-0.41.1/tests/test_diversity.py +140 -0
  85. small_text_mmo_engine-0.41.1/tests/test_dungeon_descent.py +90 -0
  86. small_text_mmo_engine-0.41.1/tests/test_dungeon_generator.py +137 -0
  87. small_text_mmo_engine-0.41.1/tests/test_env.py +149 -0
  88. small_text_mmo_engine-0.41.1/tests/test_env_attack_mask.py +83 -0
  89. small_text_mmo_engine-0.41.1/tests/test_env_parsing.py +585 -0
  90. small_text_mmo_engine-0.41.1/tests/test_env_reset.py +54 -0
  91. small_text_mmo_engine-0.41.1/tests/test_eval_rewards.py +233 -0
  92. small_text_mmo_engine-0.41.1/tests/test_eval_stats.py +133 -0
  93. small_text_mmo_engine-0.41.1/tests/test_exploit_regressions.py +225 -0
  94. small_text_mmo_engine-0.41.1/tests/test_farm_resume.py +112 -0
  95. small_text_mmo_engine-0.41.1/tests/test_flee.py +250 -0
  96. small_text_mmo_engine-0.41.1/tests/test_freight.py +425 -0
  97. small_text_mmo_engine-0.41.1/tests/test_generalist.py +161 -0
  98. small_text_mmo_engine-0.41.1/tests/test_gm_unit.py +320 -0
  99. small_text_mmo_engine-0.41.1/tests/test_guild_audit.py +577 -0
  100. small_text_mmo_engine-0.41.1/tests/test_guild_bot_role.py +316 -0
  101. small_text_mmo_engine-0.41.1/tests/test_guild_membership.py +461 -0
  102. small_text_mmo_engine-0.41.1/tests/test_guild_probe.py +345 -0
  103. small_text_mmo_engine-0.41.1/tests/test_guild_ranks.py +483 -0
  104. small_text_mmo_engine-0.41.1/tests/test_guild_transfers.py +478 -0
  105. small_text_mmo_engine-0.41.1/tests/test_guild_vault.py +629 -0
  106. small_text_mmo_engine-0.41.1/tests/test_guilds.py +163 -0
  107. small_text_mmo_engine-0.41.1/tests/test_harness.py +362 -0
  108. small_text_mmo_engine-0.41.1/tests/test_intel_log.py +564 -0
  109. small_text_mmo_engine-0.41.1/tests/test_intel_query.py +483 -0
  110. small_text_mmo_engine-0.41.1/tests/test_intel_store.py +277 -0
  111. small_text_mmo_engine-0.41.1/tests/test_json_encoding.py +110 -0
  112. small_text_mmo_engine-0.41.1/tests/test_league.py +182 -0
  113. small_text_mmo_engine-0.41.1/tests/test_live.py +641 -0
  114. small_text_mmo_engine-0.41.1/tests/test_market_equilibrium.py +229 -0
  115. small_text_mmo_engine-0.41.1/tests/test_mcp_client.py +548 -0
  116. small_text_mmo_engine-0.41.1/tests/test_metrics_route.py +293 -0
  117. small_text_mmo_engine-0.41.1/tests/test_mode_seam.py +332 -0
  118. small_text_mmo_engine-0.41.1/tests/test_modes.py +225 -0
  119. small_text_mmo_engine-0.41.1/tests/test_npc_ai_state.py +450 -0
  120. small_text_mmo_engine-0.41.1/tests/test_npc_ai_telemetry.py +162 -0
  121. small_text_mmo_engine-0.41.1/tests/test_npc_archetypes.py +197 -0
  122. small_text_mmo_engine-0.41.1/tests/test_npc_leash.py +496 -0
  123. small_text_mmo_engine-0.41.1/tests/test_npc_tick_parity.py +228 -0
  124. small_text_mmo_engine-0.41.1/tests/test_open_mode.py +199 -0
  125. small_text_mmo_engine-0.41.1/tests/test_pbt.py +174 -0
  126. small_text_mmo_engine-0.41.1/tests/test_persistence.py +737 -0
  127. small_text_mmo_engine-0.41.1/tests/test_plugin_inventory.py +196 -0
  128. small_text_mmo_engine-0.41.1/tests/test_plugins.py +872 -0
  129. small_text_mmo_engine-0.41.1/tests/test_policy_budget.py +488 -0
  130. small_text_mmo_engine-0.41.1/tests/test_quest_grind.py +72 -0
  131. small_text_mmo_engine-0.41.1/tests/test_repro.py +315 -0
  132. small_text_mmo_engine-0.41.1/tests/test_reward_modes.py +624 -0
  133. small_text_mmo_engine-0.41.1/tests/test_rnd.py +109 -0
  134. small_text_mmo_engine-0.41.1/tests/test_runners.py +154 -0
  135. small_text_mmo_engine-0.41.1/tests/test_scores_backup.py +103 -0
  136. small_text_mmo_engine-0.41.1/tests/test_scripted_bots.py +403 -0
  137. small_text_mmo_engine-0.41.1/tests/test_scripted_danger.py +103 -0
  138. small_text_mmo_engine-0.41.1/tests/test_security.py +286 -0
  139. small_text_mmo_engine-0.41.1/tests/test_server_unit.py +7058 -0
  140. small_text_mmo_engine-0.41.1/tests/test_snapshot_additions.py +255 -0
  141. small_text_mmo_engine-0.41.1/tests/test_snapshot_contract.py +280 -0
  142. small_text_mmo_engine-0.41.1/tests/test_source_policy.py +171 -0
  143. small_text_mmo_engine-0.41.1/tests/test_structured_log.py +172 -0
  144. small_text_mmo_engine-0.41.1/tests/test_telemetry.py +281 -0
  145. small_text_mmo_engine-0.41.1/tests/test_torch_plugin_slots.py +53 -0
  146. small_text_mmo_engine-0.41.1/tests/test_training_health.py +686 -0
  147. small_text_mmo_engine-0.41.1/tests/test_training_loops.py +311 -0
  148. small_text_mmo_engine-0.41.1/tests/test_transcript.py +254 -0
  149. small_text_mmo_engine-0.41.1/tests/test_tui.py +1297 -0
  150. small_text_mmo_engine-0.41.1/tests/test_wheel_assets.py +112 -0
  151. small_text_mmo_engine-0.41.1/torch_agents/__init__.py +0 -0
  152. small_text_mmo_engine-0.41.1/torch_agents/dqn_agent.py +1079 -0
  153. small_text_mmo_engine-0.41.1/torch_agents/eval.py +431 -0
  154. small_text_mmo_engine-0.41.1/torch_agents/torch_farm.py +597 -0
  155. small_text_mmo_engine-0.41.1/tui/__init__.py +30 -0
  156. small_text_mmo_engine-0.41.1/tui/__main__.py +13 -0
  157. small_text_mmo_engine-0.41.1/tui/app.py +357 -0
  158. small_text_mmo_engine-0.41.1/tui/panels.py +1635 -0
  159. small_text_mmo_engine-0.41.1/tui/snapshot.py +181 -0
  160. small_text_mmo_engine-0.41.1/tui/tabs.py +73 -0
  161. small_text_mmo_engine-0.41.1/uplot.min.js +2 -0
  162. small_text_mmo_engine-0.41.1/world.json +966 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is instituted.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 killerboyyy777
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing
201
+ permissions and limitations under the License.
@@ -0,0 +1,6 @@
1
+ include dashboard.html
2
+ include uplot.min.js
3
+ include world.json
4
+ include server_config.json
5
+ recursive-include plugins *
6
+ recursive-include ml *.json
@@ -0,0 +1,273 @@
1
+ Metadata-Version: 2.4
2
+ Name: small-text-mmo-engine
3
+ Version: 0.41.1
4
+ Summary: A minimal, hackable text-based MMORPG engine with an ML agent stack.
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.12
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ License-File: THIRD_PARTY_NOTICES.md
10
+ Requires-Dist: websockets==17.4
11
+ Requires-Dist: rich==15.0.0
12
+ Dynamic: license-file
13
+
14
+ # Small text MMO engine
15
+
16
+ [![Docker Pulls](https://ghcr-badge.elias.eu.org/shield/killerboyyy777/Machine-Learning-mmo/machine-learning-mmo)](https://github.com/killerboyyy777/Machine-Learning-mmo/pkgs/container/machine-learning-mmo)
17
+ [![Tests](https://github.com/killerboyyy777/Machine-Learning-mmo/actions/workflows/tests.yml/badge.svg)](https://github.com/killerboyyy777/Machine-Learning-mmo/actions/workflows/tests.yml)
18
+
19
+ A small, hackable text MMORPG engine. It needs Python 3.12 or newer; CI covers 3.12 and 3.14. Rooms, NPCs, items, loot, respawns, parties, a player market, instanced dungeons, and 1v1 and 2v2 arena matches all run over WebSocket with plain JSON messages. Because the protocol is just JSON, a human, a bot, and an LLM agent look identical to the server on the game port; GM control is a separate loopback-only surface.
20
+
21
+ On top sits an ML stack: a Gym-style environment with (224 obs dims, 67 actions), linear and DQN agents with curiosity and PBT, scripted baselines, a 50-agent conductor, and deterministic evaluation.
22
+
23
+ > A human designs and leads this project. AI coding assistants wrote much of the implementation.
24
+
25
+ ## Setup
26
+
27
+ ```bash
28
+ pip install -r requirements.txt
29
+ python3 server.py # world on ws://0.0.0.0:8765
30
+ # open http://localhost:8766/ for the live dashboard
31
+ ```
32
+
33
+ Run `python start.py` on any OS to start the server with a banner. Add `--roles "gather:8,dungeon:4,market:3,commissioner:2"` to also start bots. Edit `world.json` for your own rooms, NPCs, and items. The [wiki](https://github.com/killerboyyy777/Machine-Learning-mmo/wiki) covers game systems, the ML guide, and the API.
34
+
35
+ ## Configuration
36
+
37
+ Environment variables are read at startup. A boolean option is enabled by `1`, `true`, `yes`, or `on` (case-insensitive); unset or any other value leaves it off.
38
+
39
+ | Variable | Default | Effect |
40
+ | --- | --- | --- |
41
+ | `TEXTMMO_GM_SEED` | `0` | World RNG seed and starting GM treasury. Set it for reproducible runs and the live tests. |
42
+ | `TEXTMMO_GM_HOST` | `127.0.0.1` | Bind address for the GM stream on port 8767. That stream has no auth, so `0.0.0.0` opts into Docker-network reachability only; keep the port unpublished (see [SECURITY.md](SECURITY.md)). |
43
+ | `TEXTMMO_REQUIRE_TOKEN` | off | Security-sensitive: require a login token for every account. Unset leaves the server-wide gate off, but a name with existing progress still needs a token. |
44
+ | `TEXTMMO_ALLOW_LEGACY_TOKEN_CLAIM` | off | Security-sensitive: let an account with no stored token hash claim a token at login. Off by default; only a server that never issued tokens should enable it. |
45
+ | `TEXTMMO_MAX_CONNECTIONS` | `1000` | Cap on total connections. |
46
+ | `TEXTMMO_MAX_ROOM_PLAYERS` | `12` | Cap on players per room. |
47
+ | `TEXTMMO_OUTBOUND_QUEUE` | `64` | Cap on the outbound queue. |
48
+ | `TEXTMMO_VERBOSE` | off | Print extra server logs and full tracebacks for handler errors. |
49
+ | `TEXTMMO_LOG_FILE` | unset | Append server stdout and stderr to this file instead of the console. |
50
+ | `TEXTMMO_METRICS` | off | Serve `/metrics` on the dashboard port. Passing `--metrics` to `server.py` does the same; see [Observability](#observability). |
51
+ | `TEXTMMO_TELEMETRY` | off | Conductor/soak only: write `telemetry.jsonl` for a run. |
52
+ | `TEXTMMO_STRUCTURED_LOG` | off | Conductor/soak only: write the `structured.jsonl` event log. |
53
+ | `TEXTMMO_RELOAD` | off | Conductor/soak only: watch the reload directory for changed checkpoints. |
54
+
55
+ ## State files
56
+
57
+ The server keeps durable state in JSON files beside `server.py`. Saves go through a temporary file, and most files rotate the previous copy to a `.1` name first, so a crash mid-write cannot leave a truncated file.
58
+
59
+ | File | Holds | If you delete it |
60
+ | --- | --- | --- |
61
+ | `scores.json` | Short-lived per-player scores, flushed every five seconds and evicted on a TTL. | Player score entries reset; the next start begins with an empty table. |
62
+ | `arena.json` | Arena ratings, recent match history, and the clamp count. | The ladder, history, and clamps reset to empty. |
63
+ | `guilds.json` | Guilds and their vaults. | Guilds and vault balances are lost. |
64
+ | `companions.json` | Player companions. | Companion progress is lost. |
65
+ | `intel.json` | Bot-cadence intel rows. | Intel history is lost. |
66
+ | `freight.json` | Freight contracts and the contract counter. | Freight state is lost. |
67
+
68
+ `world.json` and `server_config.json` are inputs you edit, not saved state. The rotated backups are safe to delete only while their primary file is present and valid: `scores.json.1` and `scores.json.2` are its two generations, while `guilds.json`, `intel.json`, `freight.json`, and `arena.json` keep one `.1` copy each (`companions.json` has none). A missing or unreadable primary falls back to a backup with a warning; a file written by a newer version is left on disk but not loaded. If both the primary and its backups are gone, that state is lost permanently.
69
+
70
+ ## Docker
71
+
72
+ The full stack needs no local Python install.
73
+
74
+ ```bash
75
+ docker compose up # server + dashboard + 4 scripted bots
76
+ # open http://localhost:8766/ (game on ws://localhost:8765)
77
+ docker compose --profile soak up soak # one-shot conductor soak
78
+ docker compose --profile torch up --build # torch farm (builds CPU torch)
79
+ ```
80
+
81
+ `compose.yaml` builds one small image from `python:3.14-slim` and `requirements.txt`. Torch is only in the `torch` profile. The `soak` service shares the server's network namespace (`network_mode: service:server`) and snapshots tables over loopback at `ws://127.0.0.1:8767`, which passes the server's loopback-only GM gate. Port 8767 is not published to the host, and GM has no authentication, so leave it that way; publishing it does not bypass the gate (see [SECURITY.md](SECURITY.md)). The server uses protocol v2 (`PROTOCOL_VERSION = 2`; see the [Protocol](https://github.com/killerboyyy777/Machine-Learning-mmo/wiki/Protocol) page).
82
+
83
+ ### Prebuilt images
84
+
85
+ Images are published to GitHub Container Registry, so a server needs only Docker.
86
+
87
+ ```bash
88
+ docker run --detach --publish 8765:8765 --publish 8766:8766 \
89
+ --env TEXTMMO_GM_SEED=700 \
90
+ ghcr.io/killerboyyy777/machine-learning-mmo:edge
91
+ # open http://localhost:8766/ (game on ws://localhost:8765)
92
+ ```
93
+
94
+ The publishing workflow builds images for `linux/amd64` and `linux/arm64` and pushes these tags to GHCR:
95
+
96
+ - `edge` follows pushes to `master`. It is a moving tag for the newest development build.
97
+ - `edge-<short-sha>` names the specific master commit used for a build. Use it to pin an edge image instead of following the moving tag.
98
+ - `X.Y.Z` and `X.Y` come from version tags such as `vX.Y.Z`.
99
+ - `latest` moves only for stable `v*` release tags. Prerelease tags do not move it.
100
+
101
+ Use `edge` for the current development image. Replace the tag with a version or commit tag to pin a build. Port 8767 stays unpublished, as above.
102
+
103
+ ## Quickstart
104
+
105
+ ```bash
106
+ python3 server.py # terminal 1: world
107
+ python3 ml/ml_client.py # terminal 2: learning agent
108
+ python3 ml/ml_botfarm.py --bots 4 # or a 4-bot training farm
109
+ # Optional, only for the PyTorch DQN / Torch agents:
110
+ pip install -r requirements-train.txt
111
+ python3 torch_agents/dqn_agent.py --steps 5000 # or the PyTorch DQN
112
+ ```
113
+
114
+ ```bash
115
+ python3 tests/test_server_unit.py # offline checks
116
+ echo '{}' > scores.json
117
+ TEXTMMO_GM_SEED=700 python3 server.py # terminal 1 (fresh world)
118
+ python3 tests/test_live.py # terminal 2 (protocol E2E)
119
+ ```
120
+
121
+ ## Ammo
122
+
123
+ A bow fires the best arrow in the ammo family you carry: Arrow (+0), Iron Arrow (+1), Steel Arrow (+2), Fire Arrow (+3) or Blood Arrow (+4). One arrow is consumed per shot, and the best variant in the family wins regardless of the order you hold them.
124
+
125
+ Fire Arrows set the target ablaze for two world ticks, chipping 2 HP per tick. The burn cannot land the killing blow, so loot, gold and credit stay with direct shots. Blood Arrows restore 2 HP to the shooter on each hit, capped at maximum HP. Both effects ride on top of the flat bonus and are crafted with the `fire_arrows` and `blood_arrows` recipes.
126
+
127
+ `stats` lists the count of every ammo variant, including zero counts, and the dashboard Players table and character tracker show the same view. The ML observation's `ammo_best_norm` scales the best loaded bonus by the family maximum (4), so it stays in [0, 1] as variants are added.
128
+
129
+ ## Drop-in agents
130
+
131
+ The conductor loads custom agents from Python files in the top-level `plugins/` directory. Each file registers an `AgentPlugin` subclass with a unique ASCII name, an `agent_type` of `linear`, `scripted`, `torch`, or `custom`, a typed `config_schema()`, and an `act()` policy. Admission refuses invalid manifests and reports the reason without discarding other valid plugins. The [plugin guide](plugins/README.md) has the full contract and a runnable example.
132
+
133
+ Start a conductor with a plugin slot. The directory defaults to `<repo>/plugins`; override it with `--plugin-dir`.
134
+
135
+ ```bash
136
+ python3 ml/conductor/soak.py --agents 4 --slot hello:speed=5
137
+ ```
138
+
139
+ A plugin may also implement the optional episode, reward, learning, and checkpoint hooks described in the plugin guide. Plugins run inside the conductor process. Admission validates a plugin before use, but it is not a security sandbox. A blocking or failing policy can still affect the run.
140
+
141
+ ## Companions
142
+
143
+ Adopt a wolf, mule, or sheep companion, then summon it. Companions earn a share of your XP and level up to 10; the wiki has the details. The `stats` command returns a read-only companion sheet with `name, species, level, hp, max_hp, attack, defense, passive, script_state`. The dashboard Agents tab and the TUI Agents panel show the same fields. DroneLang scripts drive companion actions through `companion script set|show|clear`.
144
+
145
+ ## Guilds
146
+
147
+ Found and run a guild at the Adventurers Guild hall. A guild has a shared vault, three ranks (member, officer, leader), a configurable permission table, and a 500-entry audit log. `guild transfer` proposes gold to another guild and `guild accept` completes it. Nothing is escrowed, and the server re-checks the sending vault when the offer is accepted. Either side can close a proposal early. The receiver runs `guild decline` (leader or officer) and the sender runs `guild cancel`. Both write terminal audit rows on each side and notify the other guild.
148
+
149
+ An offer costs the target an audit row whether or not anyone accepts it. Both the queue and the day are bounded: three offers waiting with one guild, twenty in total, an hour to answer, and per target ten received from any one sender and twenty from everyone combined in a rolling day. Declining frees the queue, not the day. The wiki covers the vault, rank, and withdrawal rules.
150
+
151
+ ## Arena
152
+
153
+ `arena enter` queues a session for a 1v1 match, and `arena enter 2v2` queues for two-a-side. `arena status` reports the queue, the match id, the round, and both team rosters. `arena leave` forfeits. A table pairs as soon as enough live sessions are queued. A session that disconnects forfeits and frees its opponents at once.
154
+
155
+ A match lives in its own instanced room named `a_<match_id>`. That room is not a key in `ROOMS`, so the world map, its NPCs, the ML action space, and `/api/state` never see it. Rounds last 90 seconds, first to two rounds, and a timed-out round is scored on remaining HP. Attacking a player resolves only inside a fighting match, with the same weapon roll and armour reduction as an NPC hit. Outside a match the target is still "not here".
156
+
157
+ A match moves no value. A downed fighter loses no gold, items, or gear, does not enter the death log, and does not count toward the civilian or wild death counters. Gathering, trading, crafting, quests, healing, item use, and equipment changes are refused during a match.
158
+
159
+ The room view for an arena room carries an `arena` block with `match_id, team_size, state, round, rounds_to_win, scores, teams, hp`. `arena status` replies with a `{"type": "arena"}` event carrying the same shape plus the player's own team, rating, rank, match count, and whether that standing is still provisional.
160
+
161
+ ### Ratings
162
+
163
+ Winning or losing a match moves rating on a zero-sum Elo ladder. The server computes one delta from each side's mean rating and makes the other its negation, so a match never mints rating. A draw splits the expectation and counts as a draw, not as a win for whichever side gained rating. Rating starts at 1000 and never drops below 100. The clamp is the one place the sum stops balancing, so `arena.json` counts clamps in `rating_clamps` instead of hiding them.
164
+
165
+ The ladder is durable, so it does not live in `scores.json`, which evicts entries on a TTL. `arena.json` holds the ratings, a 200-row match history, and the clamp count, written atomically with a `.1` generation. A corrupt or future-versioned file loads as an empty ladder with a warning instead of stopping the server. A forfeit or disconnect is a loss with the ordinary delta, so leaving is never cheaper than losing.
166
+
167
+ A player with fewer than five completed matches is provisional. Their rating still moves and still shows, but every provisional row sorts below every established one, so one lucky first win cannot outrank a season of wins. The `min_matches` field in the payloads below gives the count needed.
168
+
169
+ `arena ladder` returns `{"type": "arena_ladder", "ladder", "ladder_size", "ranked_size", "min_matches", "you"}`. `/api/state` carries an additive `arena` block with `queues`, `live`, `ladder`, `ladder_size`, `ranked_size`, `provisional_size`, `min_matches`, `recent`, and `rating_clamps` for the dashboard. Provisional ladder rows carry `"provisional": true`. The `you` object carries `rank` (null while unrated) next to `rating`, `matches`, and `provisional`.
170
+
171
+ ### Watching
172
+
173
+ `arena watch <match_id>` attaches a session to a live match read-only. `arena unwatch` or `arena leave` detaches. A watcher is not in the match roster, so no seating, scoring, or HP path can see it. Every command but `arena` and `help` is refused while watching. The match id is the one in `arena status` or the dashboard's live list.
174
+
175
+ A watcher receives the score line and the combat lines as they happen, plus a `{"type": "arena_view"}` event on attach. That event carries the match id, team size, state, round, scores, both teams with name, HP and rating, and the last twelve match events. It deliberately carries no room id, exits, items, gold, or inventories, so a spectator cannot read anything a fighter holds. When the match ends the watcher gets `{"type": "arena_end"}` with the winner and final score, and its own state is cleared. An audience is capped at eight sessions per match.
176
+
177
+ HTTP clients get the same view. `/api/state` carries the lists, and `GET /api/arena/<match_id>` returns one live match in the `arena_view` shape, or 404 once it has ended. Both come from the builder the socket path uses, so the dashboard panel and a connected client cannot disagree.
178
+
179
+ The dashboard Arena tab renders live matches, the ladder, and recent results. Its follow box polls the per-match endpoint every two seconds. The terminal UI mirrors it as the sixth tab over the same snapshot block.
180
+
181
+ ### Scripted arena agents
182
+
183
+ The conductor's opt-in `arena` scripted role queues eligible agents for 2v2 matches and fights with the normal attack action. An agent queues only when it has at least 80% HP and is idle in a non-hostile, non-dungeon room. It stays queued while waiting, leaves if it loses that eligibility, and abandons a queue when the wait exceeds 120 agent selections. While fighting it attacks when possible and otherwise uses its normal idle fallback of `rest` or `look`. The role sends ordinary arena commands through the pending-command channel and adds no environment actions or observation fields.
184
+
185
+ Run four agents with the role using the conductor's repeatable slot option.
186
+
187
+ ```bash
188
+ python3 ml/conductor/soak.py --agents 4 --slot arena
189
+ ```
190
+
191
+ ## Balance measurement
192
+
193
+ `ml/balance.py` runs a mixed-agent profile against a live server. It samples `/api/state` and the loopback GM stream, scores a scenario matrix against explicit thresholds, writes a report, and exits nonzero when a check fails.
194
+
195
+ ```bash
196
+ python3 ml/balance.py matrix # scenarios, profiles, skips
197
+ TEXTMMO_GM_SEED=700 python3 server.py & # fresh world
198
+ python3 ml/balance.py run --profile smoke # 10 min, 10 agents
199
+ python3 ml/balance.py run --profile gate # 4h x 20 agents x seeds 700/701/702
200
+ python3 ml/balance.py baseline --seed 700 --commit "$(git rev-parse --short HEAD)" \
201
+ --out balance/baseline-08f7453.json
202
+ ```
203
+
204
+ Every later run is compared with the stored v0.10.0 baseline.
205
+
206
+ ```bash
207
+ python3 ml/balance.py evaluate --measurements balance/measurements-smoke-700.json \
208
+ --baseline balance/baseline-08f7453.json
209
+ ```
210
+
211
+ The gate profile also runs the arena probe. It queues four fresh fighters for two 2v2 matches and checks that both matches complete, rating deltas are conserved, gold and item totals stay unchanged, the civilian and wild death counters do not move, and repeating the probe produces the same fingerprint. An unavailable arena command or a failed probe is a blocking coverage failure, not a passing skip.
212
+
213
+ Thresholds live in `DEFAULT_THRESHOLDS`. `--thresholds FILE` deep-merges a JSON override without editing code. The release gate requires measured coverage for economy, combat, craft, acquisition (#532), guilds (#588), arena (#656), market, liveness, and NPC AI v2 (#536). A missing probe or telemetry for any required scenario is a blocking failure, not a passing skip. The `progression` and `party` scenarios are observational because the server does not expose every metric needed to threshold them. Item and gold conservation and companion damage share are blocking checks.
214
+
215
+ ## Generalist doctrine pilot
216
+
217
+ `ml/generalist.py` supplies a generalist whose TRAINING reward is one signal summed across four archetype rewards, plus purist specialists trained on one archetype each. Registering the plugins is an explicit opt-in; the module has no runtime, gate, or reward-default hook. Its same-frame curves and pilot report are informational and never gate a run.
218
+
219
+ Training reward is not an evaluation score. Because the generalist reward adds all four archetype rewards while a purist uses one, comparing those sums head-to-head makes the generalist lead whenever several axes are positive, even though no generalist policy acted or learned. `same_frame_curve` records those same-frame training-reward curves only; it cannot by itself establish that a generalist outperforms a purist.
220
+
221
+ `pilot_report` makes the distinction explicit. With `objective` set, its curves are cumulative outcomes on one common objective from separate per-policy trajectories on matched seeds and frames, and a positive lead is a genuine outcome difference. Without `objective`, curves are treated as training rewards and the generalist is reduced to a weighted average across its active archetypes, so summing more axes cannot manufacture a lead and the verdict stays inconclusive. Curves of unequal length are rejected as `misaligned_data` instead of being compared over a common prefix.
222
+
223
+ The same-frame training-reward comparison is provisional: it carries no honest performance claim. Before v0.19 either confirm a lead that survives this normalization on a common objective, or drop the claim that the pilot compares generalist and purist performance.
224
+
225
+ ## Observability
226
+
227
+ Three measurement surfaces exist, all off by default. A normal server or soak run writes none of them.
228
+
229
+ - **`/metrics`.** The dashboard port serves Prometheus text with aggregate gauges only, such as players online, live connections, rooms, living NPCs, and market trades. No per-player data is exposed. Set `TEXTMMO_METRICS=1` or pass `--metrics` to `server.py` to enable the route. The dashboard has no auth, so leave it off unless you need it.
230
+ - **Conductor telemetry.** `ml/conductor/soak.py` writes `telemetry.jsonl` and a summary `telemetry.json` in the run directory. Enable it with `TEXTMMO_TELEMETRY=1` or `--telemetry-dir DIR`. This is a conductor feature, not a server feature.
231
+ - **Structured event log.** The conductor can append `structured.jsonl` records for episodes and run events. Enable it with `TEXTMMO_STRUCTURED_LOG=1` or `--structured-log-dir DIR`.
232
+
233
+ CI covers these with `tests/test_metrics_route.py`, `tests/test_telemetry.py`, and `tests/test_structured_log.py`.
234
+
235
+ ## Architecture
236
+
237
+ The engine is a WebSocket server that keeps world state in memory.
238
+
239
+ - **Server.** Python reads a simple JSON message format: clients send a `cmd` command and receive typed events with a `type` field. It is not JSON-RPC.
240
+ - **Dashboard.** Static HTML and JavaScript provide live monitoring through `/api/state`.
241
+ - **ML stack.** A Gym environment wraps the game protocol, so DQN and other agents can play.
242
+
243
+ The [wiki](https://github.com/killerboyyy777/Machine-Learning-mmo/wiki) documents the protocol and the ML implementation in detail.
244
+
245
+ ## Release history
246
+
247
+ Releases live in [GitHub Releases](https://github.com/killerboyyy777/Machine-Learning-mmo/releases). Each carries the notes for its version and the tag it was cut from.
248
+
249
+ Through v0.13.0 the project also kept a `CHANGELOG.md` in this repository. It was retired so a version has one history rather than two. The file is still readable at the last commit that carried it: [`CHANGELOG.md` at 5677bc6](https://github.com/killerboyyy777/Machine-Learning-mmo/blob/5677bc6/CHANGELOG.md). That is where the detail behind the early releases lives, including anything before v0.6.0 and the longer form of the terse v0.6.0 to v0.8.0 notes.
250
+
251
+ ## Community
252
+
253
+ - [Contributing guide](CONTRIBUTING.md) covers the workflow for non-coders and researchers, protocol-stability rules, releases, and labels and milestones.
254
+ - [Code of Conduct](CODE_OF_CONDUCT.md) is Contributor Covenant v2.1.
255
+ - [Security policy](SECURITY.md) explains how to report vulnerabilities privately, never in a public issue.
256
+
257
+ ## Support
258
+
259
+ The useful contribution here is not money. It is an issue with a reproduction, an agent run that hits something the tests miss, or a pull request that improves the code. Nothing else is expected.
260
+
261
+ If you want to send something anyway, these addresses are the only channel. They are tips, not a product. There is no paid tier, no priority support, and no promise attached.
262
+
263
+ ```text
264
+ BTC bc1qmkv939k2wqsej657cxj25ppwqdh65y2umnv3gg
265
+ LTC ltc1qjr49nr028mcajlt7prmmnqnjh0552qjj90zdq4
266
+ XMR 82oJRDdiSWWbem3HiYx7ZdDdiPkYQAW4LaGNHpNcJ9DCendQ3XcxHNYQiRMtfghYtSMmARPGqKe2ddSrhtjviTraEyGwgZ2
267
+ ```
268
+
269
+ Crypto transfers are irreversible. Send only what you are content to part with, and do not send from an exchange that may freeze the withdrawal.
270
+
271
+ ## License
272
+
273
+ Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE). Vendored third-party components are listed in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).