@origingame/create-game 0.0.0-stage → 0.1.0

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 (581) hide show
  1. package/README.md +57 -2
  2. package/archetypes/README.md +99 -0
  3. package/archetypes/idle/.origin/setup +14 -0
  4. package/archetypes/idle/LICENSES.md +12 -0
  5. package/archetypes/idle/README.md +234 -0
  6. package/archetypes/idle/assets/audio/buy.wav +0 -0
  7. package/archetypes/idle/assets/audio/milestone.wav +0 -0
  8. package/archetypes/idle/assets/audio/nova.wav +0 -0
  9. package/archetypes/idle/assets/audio/orbit.wav +0 -0
  10. package/archetypes/idle/assets/audio/tap.wav +0 -0
  11. package/archetypes/idle/assets/audio/ui-close.ogt +9 -0
  12. package/archetypes/idle/assets/audio/ui-error.ogt +9 -0
  13. package/archetypes/idle/assets/audio/ui-open.ogt +9 -0
  14. package/archetypes/idle/assets/audio/ui-press.ogt +9 -0
  15. package/archetypes/idle/assets/audio/ui-success.ogt +9 -0
  16. package/archetypes/idle/assets/fonts/NotoSansSC-subset.ttf +0 -0
  17. package/archetypes/idle/assets/fonts/NotoSansSC-subset.ttf.ogt +10 -0
  18. package/archetypes/idle/assets/fonts/OFL.txt +93 -0
  19. package/archetypes/idle/assets/fx/drift.ogt +21 -0
  20. package/archetypes/idle/assets/fx/milestone.ogt +21 -0
  21. package/archetypes/idle/assets/fx/nova.ogt +22 -0
  22. package/archetypes/idle/assets/fx/stars.ogt +20 -0
  23. package/archetypes/idle/assets/fx/tap.ogt +23 -0
  24. package/archetypes/idle/assets/looks/idle.ogt +17 -0
  25. package/archetypes/idle/assets/skins/sparkorb/ChakraPetch-BoldItalic.ttf +0 -0
  26. package/archetypes/idle/assets/skins/sparkorb/ChakraPetch-BoldItalic.ttf.ogt +9 -0
  27. package/archetypes/idle/assets/skins/sparkorb/LICENSES.md +19 -0
  28. package/archetypes/idle/assets/skins/sparkorb/OFL.txt +95 -0
  29. package/archetypes/idle/assets/skins/sparkorb/Orbitron-Medium.ttf +0 -0
  30. package/archetypes/idle/assets/skins/sparkorb/Orbitron-Medium.ttf.ogt +9 -0
  31. package/archetypes/idle/assets/skins/sparkorb/Rajdhani-Bold.ttf +0 -0
  32. package/archetypes/idle/assets/skins/sparkorb/Rajdhani-Bold.ttf.ogt +9 -0
  33. package/archetypes/idle/assets/skins/sparkorb/atlas.png +0 -0
  34. package/archetypes/idle/assets/skins/sparkorb/atlas.png.ogt +7 -0
  35. package/archetypes/idle/assets/skins/sparkorb/icons.png +0 -0
  36. package/archetypes/idle/assets/skins/sparkorb/icons.png.ogt +7 -0
  37. package/archetypes/idle/assets/skins/sparkorb/skin.ogt +113 -0
  38. package/archetypes/idle/assets/sprites/glow.png +0 -0
  39. package/archetypes/idle/assets/sprites/glow.png.ogt +8 -0
  40. package/archetypes/idle/assets/sprites/mote-crystal.png +0 -0
  41. package/archetypes/idle/assets/sprites/mote-crystal.png.ogt +7 -0
  42. package/archetypes/idle/assets/sprites/mote-ember.png +0 -0
  43. package/archetypes/idle/assets/sprites/mote-ember.png.ogt +7 -0
  44. package/archetypes/idle/assets/sprites/mote-star.png +0 -0
  45. package/archetypes/idle/assets/sprites/mote-star.png.ogt +7 -0
  46. package/archetypes/idle/assets/sprites/mote-storm.png +0 -0
  47. package/archetypes/idle/assets/sprites/mote-storm.png.ogt +7 -0
  48. package/archetypes/idle/assets/sprites/orb.png +0 -0
  49. package/archetypes/idle/assets/sprites/orb.png.ogt +7 -0
  50. package/archetypes/idle/assets/sprites/spark.png +0 -0
  51. package/archetypes/idle/assets/sprites/spark.png.ogt +7 -0
  52. package/archetypes/idle/assets/strings/en.ogt +62 -0
  53. package/archetypes/idle/assets/strings/zh-CN.ogt +62 -0
  54. package/archetypes/idle/gitattributes +22 -0
  55. package/archetypes/idle/host.d.ts +46 -0
  56. package/archetypes/idle/package.json +18 -0
  57. package/archetypes/idle/project.ogt +14 -0
  58. package/archetypes/idle/references/metal/card.png +0 -0
  59. package/archetypes/idle/references/metal/orbit.png +0 -0
  60. package/archetypes/idle/references/metal/title.png +0 -0
  61. package/archetypes/idle/src/components.ts +139 -0
  62. package/archetypes/idle/src/main.ts +247 -0
  63. package/archetypes/idle/src/numbers.ts +126 -0
  64. package/archetypes/idle/src/systems.ts +340 -0
  65. package/archetypes/idle/src/ui.ts +412 -0
  66. package/archetypes/idle/tests/away.og.ts +42 -0
  67. package/archetypes/idle/tests/flow.og.ts +57 -0
  68. package/archetypes/idle/tests/frames.og.ts +33 -0
  69. package/archetypes/idle/tests/frames.ts +134 -0
  70. package/archetypes/idle/tests/lib.ts +74 -0
  71. package/archetypes/idle/tests/milestone.og.ts +32 -0
  72. package/archetypes/idle/tests/nova.og.ts +52 -0
  73. package/archetypes/idle/tests/offline.og.ts +60 -0
  74. package/archetypes/idle/tests/pad.og.ts +55 -0
  75. package/archetypes/idle/tests/pause.og.ts +68 -0
  76. package/archetypes/idle/tests/phone.og.ts +50 -0
  77. package/archetypes/idle/tests/replay.og.ts +28 -0
  78. package/archetypes/idle/tools/make-assets.py +448 -0
  79. package/archetypes/idle/tools/oglite.py +285 -0
  80. package/archetypes/idle/tsconfig.json +17 -0
  81. package/archetypes/match3/.origin/setup +14 -0
  82. package/archetypes/match3/LICENSES.md +7 -0
  83. package/archetypes/match3/README.md +205 -0
  84. package/archetypes/match3/assets/audio/cascade.wav +0 -0
  85. package/archetypes/match3/assets/audio/clear.wav +0 -0
  86. package/archetypes/match3/assets/audio/lost.wav +0 -0
  87. package/archetypes/match3/assets/audio/refused.wav +0 -0
  88. package/archetypes/match3/assets/audio/select.wav +0 -0
  89. package/archetypes/match3/assets/audio/swap.wav +0 -0
  90. package/archetypes/match3/assets/audio/won.wav +0 -0
  91. package/archetypes/match3/assets/fonts/OFL.txt +93 -0
  92. package/archetypes/match3/assets/fonts/ui.ttf +0 -0
  93. package/archetypes/match3/assets/fonts/ui.ttf.ogt +11 -0
  94. package/archetypes/match3/assets/scenes/main.ogt +24 -0
  95. package/archetypes/match3/assets/sprites/backdrop.png +0 -0
  96. package/archetypes/match3/assets/sprites/board.ogt +21 -0
  97. package/archetypes/match3/assets/sprites/cells.ogt +7 -0
  98. package/archetypes/match3/assets/sprites/cells.png +0 -0
  99. package/archetypes/match3/assets/sprites/cells.png.ogt +7 -0
  100. package/archetypes/match3/assets/sprites/gems.ogt +75 -0
  101. package/archetypes/match3/assets/sprites/gems.png +0 -0
  102. package/archetypes/match3/assets/sprites/panel.png +0 -0
  103. package/archetypes/match3/assets/sprites/ring.png +0 -0
  104. package/archetypes/match3/gitattributes +22 -0
  105. package/archetypes/match3/host.d.ts +46 -0
  106. package/archetypes/match3/package.json +18 -0
  107. package/archetypes/match3/project.ogt +18 -0
  108. package/archetypes/match3/references/metal/cascade.png +0 -0
  109. package/archetypes/match3/references/metal/clearing.png +0 -0
  110. package/archetypes/match3/references/metal/dealt.png +0 -0
  111. package/archetypes/match3/src/art.ts +54 -0
  112. package/archetypes/match3/src/board.ts +112 -0
  113. package/archetypes/match3/src/components.ts +95 -0
  114. package/archetypes/match3/src/layout.ts +25 -0
  115. package/archetypes/match3/src/main.ts +199 -0
  116. package/archetypes/match3/src/systems.ts +631 -0
  117. package/archetypes/match3/tests/drag.og.ts +31 -0
  118. package/archetypes/match3/tests/endings.og.ts +40 -0
  119. package/archetypes/match3/tests/frames.og.ts +49 -0
  120. package/archetypes/match3/tests/frames.ts +134 -0
  121. package/archetypes/match3/tests/hidpi.og.ts +41 -0
  122. package/archetypes/match3/tests/lib.ts +64 -0
  123. package/archetypes/match3/tests/replay.og.ts +28 -0
  124. package/archetypes/match3/tests/sounds.og.ts +50 -0
  125. package/archetypes/match3/tests/swap.og.ts +67 -0
  126. package/archetypes/match3/tools/make-assets.py +404 -0
  127. package/archetypes/match3/tools/oglite.py +285 -0
  128. package/archetypes/match3/tsconfig.json +17 -0
  129. package/archetypes/rhythm/.origin/setup +14 -0
  130. package/archetypes/rhythm/LICENSES.md +13 -0
  131. package/archetypes/rhythm/README.md +235 -0
  132. package/archetypes/rhythm/assets/audio/bass0.wav +0 -0
  133. package/archetypes/rhythm/assets/audio/bass1.wav +0 -0
  134. package/archetypes/rhythm/assets/audio/bass2.wav +0 -0
  135. package/archetypes/rhythm/assets/audio/bass3.wav +0 -0
  136. package/archetypes/rhythm/assets/audio/chords0.wav +0 -0
  137. package/archetypes/rhythm/assets/audio/chords1.wav +0 -0
  138. package/archetypes/rhythm/assets/audio/chords2.wav +0 -0
  139. package/archetypes/rhythm/assets/audio/chords3.wav +0 -0
  140. package/archetypes/rhythm/assets/audio/clear.wav +0 -0
  141. package/archetypes/rhythm/assets/audio/click.wav +0 -0
  142. package/archetypes/rhythm/assets/audio/drums.wav +0 -0
  143. package/archetypes/rhythm/assets/audio/fail.wav +0 -0
  144. package/archetypes/rhythm/assets/audio/leadA.wav +0 -0
  145. package/archetypes/rhythm/assets/audio/leadB.wav +0 -0
  146. package/archetypes/rhythm/assets/audio/miss.wav +0 -0
  147. package/archetypes/rhythm/assets/audio/tap0.wav +0 -0
  148. package/archetypes/rhythm/assets/audio/tap1.wav +0 -0
  149. package/archetypes/rhythm/assets/audio/tap2.wav +0 -0
  150. package/archetypes/rhythm/assets/audio/ui-close.ogt +9 -0
  151. package/archetypes/rhythm/assets/audio/ui-error.ogt +9 -0
  152. package/archetypes/rhythm/assets/audio/ui-open.ogt +9 -0
  153. package/archetypes/rhythm/assets/audio/ui-press.ogt +9 -0
  154. package/archetypes/rhythm/assets/audio/ui-success.ogt +9 -0
  155. package/archetypes/rhythm/assets/charts/neon-pulse.ogt +919 -0
  156. package/archetypes/rhythm/assets/fonts/NotoSansSC-subset.ttf +0 -0
  157. package/archetypes/rhythm/assets/fonts/NotoSansSC-subset.ttf.ogt +10 -0
  158. package/archetypes/rhythm/assets/fonts/OFL.txt +93 -0
  159. package/archetypes/rhythm/assets/fx/hit.ogt +22 -0
  160. package/archetypes/rhythm/assets/skins/lanebeat/ChakraPetch-Medium.ttf +0 -0
  161. package/archetypes/rhythm/assets/skins/lanebeat/ChakraPetch-Medium.ttf.ogt +9 -0
  162. package/archetypes/rhythm/assets/skins/lanebeat/JetBrainsMono-Regular.ttf +0 -0
  163. package/archetypes/rhythm/assets/skins/lanebeat/JetBrainsMono-Regular.ttf.ogt +9 -0
  164. package/archetypes/rhythm/assets/skins/lanebeat/LICENSES.md +17 -0
  165. package/archetypes/rhythm/assets/skins/lanebeat/OFL.txt +95 -0
  166. package/archetypes/rhythm/assets/skins/lanebeat/Orbitron-Bold.ttf +0 -0
  167. package/archetypes/rhythm/assets/skins/lanebeat/Orbitron-Bold.ttf.ogt +9 -0
  168. package/archetypes/rhythm/assets/skins/lanebeat/atlas.png +0 -0
  169. package/archetypes/rhythm/assets/skins/lanebeat/atlas.png.ogt +7 -0
  170. package/archetypes/rhythm/assets/skins/lanebeat/icons.png +0 -0
  171. package/archetypes/rhythm/assets/skins/lanebeat/icons.png.ogt +7 -0
  172. package/archetypes/rhythm/assets/skins/lanebeat/skin.ogt +110 -0
  173. package/archetypes/rhythm/assets/sprites/lane.png +0 -0
  174. package/archetypes/rhythm/assets/sprites/lane.png.ogt +7 -0
  175. package/archetypes/rhythm/assets/sprites/note.png +0 -0
  176. package/archetypes/rhythm/assets/sprites/note.png.ogt +7 -0
  177. package/archetypes/rhythm/assets/sprites/ring.png +0 -0
  178. package/archetypes/rhythm/assets/sprites/ring.png.ogt +7 -0
  179. package/archetypes/rhythm/assets/sprites/spark.png +0 -0
  180. package/archetypes/rhythm/assets/sprites/spark.png.ogt +7 -0
  181. package/archetypes/rhythm/assets/strings/en.ogt +61 -0
  182. package/archetypes/rhythm/assets/strings/zh-CN.ogt +61 -0
  183. package/archetypes/rhythm/gitattributes +22 -0
  184. package/archetypes/rhythm/host.d.ts +46 -0
  185. package/archetypes/rhythm/package.json +18 -0
  186. package/archetypes/rhythm/project.ogt +14 -0
  187. package/archetypes/rhythm/references/metal/highway.png +0 -0
  188. package/archetypes/rhythm/references/metal/results.png +0 -0
  189. package/archetypes/rhythm/references/metal/title.png +0 -0
  190. package/archetypes/rhythm/src/components.ts +147 -0
  191. package/archetypes/rhythm/src/main.ts +202 -0
  192. package/archetypes/rhythm/src/systems.ts +490 -0
  193. package/archetypes/rhythm/src/ui.ts +421 -0
  194. package/archetypes/rhythm/tests/band.og.ts +45 -0
  195. package/archetypes/rhythm/tests/calibrate.og.ts +49 -0
  196. package/archetypes/rhythm/tests/clear.og.ts +51 -0
  197. package/archetypes/rhythm/tests/fail.og.ts +40 -0
  198. package/archetypes/rhythm/tests/flow.og.ts +54 -0
  199. package/archetypes/rhythm/tests/frames.og.ts +35 -0
  200. package/archetypes/rhythm/tests/frames.ts +134 -0
  201. package/archetypes/rhythm/tests/lib.ts +123 -0
  202. package/archetypes/rhythm/tests/pad.og.ts +41 -0
  203. package/archetypes/rhythm/tests/pause.og.ts +77 -0
  204. package/archetypes/rhythm/tests/phone.og.ts +44 -0
  205. package/archetypes/rhythm/tests/replay.og.ts +27 -0
  206. package/archetypes/rhythm/tests/timing.og.ts +37 -0
  207. package/archetypes/rhythm/tools/make-assets.py +383 -0
  208. package/archetypes/rhythm/tools/oglite.py +285 -0
  209. package/archetypes/rhythm/tsconfig.json +17 -0
  210. package/archetypes/roguelike/.origin/setup +14 -0
  211. package/archetypes/roguelike/LICENSES.md +14 -0
  212. package/archetypes/roguelike/README.md +256 -0
  213. package/archetypes/roguelike/assets/ai/foe.ogt +28 -0
  214. package/archetypes/roguelike/assets/ai/guardian.ogt +26 -0
  215. package/archetypes/roguelike/assets/audio/bump.wav +0 -0
  216. package/archetypes/roguelike/assets/audio/drink.wav +0 -0
  217. package/archetypes/roguelike/assets/audio/fall.wav +0 -0
  218. package/archetypes/roguelike/assets/audio/hit.wav +0 -0
  219. package/archetypes/roguelike/assets/audio/hurt.wav +0 -0
  220. package/archetypes/roguelike/assets/audio/item.wav +0 -0
  221. package/archetypes/roguelike/assets/audio/kill.wav +0 -0
  222. package/archetypes/roguelike/assets/audio/pickup.wav +0 -0
  223. package/archetypes/roguelike/assets/audio/roar.wav +0 -0
  224. package/archetypes/roguelike/assets/audio/stairs.wav +0 -0
  225. package/archetypes/roguelike/assets/audio/step.ogt +9 -0
  226. package/archetypes/roguelike/assets/audio/telegraph.wav +0 -0
  227. package/archetypes/roguelike/assets/audio/tomb.wav +0 -0
  228. package/archetypes/roguelike/assets/audio/ui-close.ogt +9 -0
  229. package/archetypes/roguelike/assets/audio/ui-error.ogt +9 -0
  230. package/archetypes/roguelike/assets/audio/ui-open.ogt +9 -0
  231. package/archetypes/roguelike/assets/audio/ui-press.ogt +9 -0
  232. package/archetypes/roguelike/assets/audio/ui-success.ogt +9 -0
  233. package/archetypes/roguelike/assets/audio/won.wav +0 -0
  234. package/archetypes/roguelike/assets/fonts/NotoSansSC-subset.ttf +0 -0
  235. package/archetypes/roguelike/assets/fonts/NotoSansSC-subset.ttf.ogt +10 -0
  236. package/archetypes/roguelike/assets/fonts/OFL.txt +93 -0
  237. package/archetypes/roguelike/assets/maps/dive.ogt +106 -0
  238. package/archetypes/roguelike/assets/skins/lampdive/DotGothic16-Regular.ttf +0 -0
  239. package/archetypes/roguelike/assets/skins/lampdive/DotGothic16-Regular.ttf.ogt +9 -0
  240. package/archetypes/roguelike/assets/skins/lampdive/LICENSES.md +16 -0
  241. package/archetypes/roguelike/assets/skins/lampdive/OFL.txt +93 -0
  242. package/archetypes/roguelike/assets/skins/lampdive/atlas.png +0 -0
  243. package/archetypes/roguelike/assets/skins/lampdive/atlas.png.ogt +7 -0
  244. package/archetypes/roguelike/assets/skins/lampdive/icons.png +0 -0
  245. package/archetypes/roguelike/assets/skins/lampdive/icons.png.ogt +7 -0
  246. package/archetypes/roguelike/assets/skins/lampdive/skin.ogt +115 -0
  247. package/archetypes/roguelike/assets/sprites/dive.ogt +50 -0
  248. package/archetypes/roguelike/assets/sprites/dive.png +0 -0
  249. package/archetypes/roguelike/assets/sprites/dive.png.ogt +7 -0
  250. package/archetypes/roguelike/assets/sprites/glow.png +0 -0
  251. package/archetypes/roguelike/assets/sprites/glow.png.ogt +7 -0
  252. package/archetypes/roguelike/assets/strings/en.ogt +57 -0
  253. package/archetypes/roguelike/assets/strings/zh-CN.ogt +57 -0
  254. package/archetypes/roguelike/assets/tiles/tomb.ogt +31 -0
  255. package/archetypes/roguelike/assets/tiles/tomb.png +0 -0
  256. package/archetypes/roguelike/assets/tiles/tomb.png.ogt +7 -0
  257. package/archetypes/roguelike/gitattributes +22 -0
  258. package/archetypes/roguelike/host.d.ts +46 -0
  259. package/archetypes/roguelike/package.json +18 -0
  260. package/archetypes/roguelike/project.ogt +14 -0
  261. package/archetypes/roguelike/references/metal/dive.png +0 -0
  262. package/archetypes/roguelike/references/metal/over.png +0 -0
  263. package/archetypes/roguelike/references/metal/title.png +0 -0
  264. package/archetypes/roguelike/src/art.ts +23 -0
  265. package/archetypes/roguelike/src/components.ts +169 -0
  266. package/archetypes/roguelike/src/dive.ts +144 -0
  267. package/archetypes/roguelike/src/foes.ts +174 -0
  268. package/archetypes/roguelike/src/main.ts +258 -0
  269. package/archetypes/roguelike/src/systems.ts +620 -0
  270. package/archetypes/roguelike/src/ui.ts +350 -0
  271. package/archetypes/roguelike/tests/flow.og.ts +54 -0
  272. package/archetypes/roguelike/tests/foes.og.ts +45 -0
  273. package/archetypes/roguelike/tests/frames.og.ts +32 -0
  274. package/archetypes/roguelike/tests/frames.ts +134 -0
  275. package/archetypes/roguelike/tests/lib.ts +83 -0
  276. package/archetypes/roguelike/tests/lose.og.ts +44 -0
  277. package/archetypes/roguelike/tests/pad.og.ts +54 -0
  278. package/archetypes/roguelike/tests/pause.og.ts +59 -0
  279. package/archetypes/roguelike/tests/phone.og.ts +54 -0
  280. package/archetypes/roguelike/tests/replay.og.ts +24 -0
  281. package/archetypes/roguelike/tests/win.og.ts +60 -0
  282. package/archetypes/roguelike/tools/make-assets.py +518 -0
  283. package/archetypes/roguelike/tools/oglite.py +285 -0
  284. package/archetypes/roguelike/tsconfig.json +17 -0
  285. package/archetypes/runner/.origin/setup +14 -0
  286. package/archetypes/runner/LICENSES.md +10 -0
  287. package/archetypes/runner/README.md +225 -0
  288. package/archetypes/runner/assets/audio/coin.wav +0 -0
  289. package/archetypes/runner/assets/audio/crash.wav +0 -0
  290. package/archetypes/runner/assets/audio/hold.ogt +9 -0
  291. package/archetypes/runner/assets/audio/jump.wav +0 -0
  292. package/archetypes/runner/assets/audio/start.wav +0 -0
  293. package/archetypes/runner/assets/fonts/OFL.txt +93 -0
  294. package/archetypes/runner/assets/fonts/ui.ttf +0 -0
  295. package/archetypes/runner/assets/fonts/ui.ttf.ogt +11 -0
  296. package/archetypes/runner/assets/maps/far.ogt +25 -0
  297. package/archetypes/runner/assets/maps/near.ogt +25 -0
  298. package/archetypes/runner/assets/maps/roofs.ogt +19 -0
  299. package/archetypes/runner/assets/scenes/main.ogt +35 -0
  300. package/archetypes/runner/assets/sprites/coin.ogt +11 -0
  301. package/archetypes/runner/assets/sprites/coin.png +0 -0
  302. package/archetypes/runner/assets/sprites/coin.png.ogt +7 -0
  303. package/archetypes/runner/assets/sprites/courier.ogt +32 -0
  304. package/archetypes/runner/assets/sprites/courier.png +0 -0
  305. package/archetypes/runner/assets/sprites/courier.png.ogt +7 -0
  306. package/archetypes/runner/assets/sprites/props.ogt +21 -0
  307. package/archetypes/runner/assets/sprites/props.png +0 -0
  308. package/archetypes/runner/assets/sprites/props.png.ogt +7 -0
  309. package/archetypes/runner/assets/sprites/sky.png +0 -0
  310. package/archetypes/runner/assets/sprites/sky.png.ogt +7 -0
  311. package/archetypes/runner/assets/tiles/city.ogt +18 -0
  312. package/archetypes/runner/assets/tiles/city.png +0 -0
  313. package/archetypes/runner/assets/tiles/city.png.ogt +7 -0
  314. package/archetypes/runner/gitattributes +22 -0
  315. package/archetypes/runner/host.d.ts +46 -0
  316. package/archetypes/runner/package.json +18 -0
  317. package/archetypes/runner/project.ogt +18 -0
  318. package/archetypes/runner/references/metal/frames-coin.png +0 -0
  319. package/archetypes/runner/references/metal/frames-crash.png +0 -0
  320. package/archetypes/runner/references/metal/frames-title.png +0 -0
  321. package/archetypes/runner/src/art.ts +57 -0
  322. package/archetypes/runner/src/components.ts +94 -0
  323. package/archetypes/runner/src/main.ts +241 -0
  324. package/archetypes/runner/src/systems.ts +553 -0
  325. package/archetypes/runner/tests/coins.og.ts +30 -0
  326. package/archetypes/runner/tests/flow.og.ts +72 -0
  327. package/archetypes/runner/tests/frames.og.ts +37 -0
  328. package/archetypes/runner/tests/frames.ts +134 -0
  329. package/archetypes/runner/tests/jump.og.ts +44 -0
  330. package/archetypes/runner/tests/lib.ts +42 -0
  331. package/archetypes/runner/tests/records.og.ts +43 -0
  332. package/archetypes/runner/tests/replay.og.ts +36 -0
  333. package/archetypes/runner/tests/sounds.og.ts +43 -0
  334. package/archetypes/runner/tests/tune.og.ts +36 -0
  335. package/archetypes/runner/tools/make-assets.py +603 -0
  336. package/archetypes/runner/tools/oglite.py +285 -0
  337. package/archetypes/runner/tsconfig.json +17 -0
  338. package/archetypes/third-person/.origin/setup +14 -0
  339. package/archetypes/third-person/LICENSES.md +23 -0
  340. package/archetypes/third-person/README.md +249 -0
  341. package/archetypes/third-person/assets/ai/sentinel-east.ogt +69 -0
  342. package/archetypes/third-person/assets/ai/sentinel-north.ogt +69 -0
  343. package/archetypes/third-person/assets/ai/sentinel-west.ogt +69 -0
  344. package/archetypes/third-person/assets/anims/humanoid-clips.glb +0 -0
  345. package/archetypes/third-person/assets/audio/alarm.wav +0 -0
  346. package/archetypes/third-person/assets/audio/dawn.wav +0 -0
  347. package/archetypes/third-person/assets/audio/grab.wav +0 -0
  348. package/archetypes/third-person/assets/audio/ignite.wav +0 -0
  349. package/archetypes/third-person/assets/audio/jump.wav +0 -0
  350. package/archetypes/third-person/assets/audio/night.wav +0 -0
  351. package/archetypes/third-person/assets/audio/splash.wav +0 -0
  352. package/archetypes/third-person/assets/audio/step.ogt +9 -0
  353. package/archetypes/third-person/assets/audio/ui-close.ogt +9 -0
  354. package/archetypes/third-person/assets/audio/ui-error.ogt +9 -0
  355. package/archetypes/third-person/assets/audio/ui-open.ogt +9 -0
  356. package/archetypes/third-person/assets/audio/ui-press.ogt +9 -0
  357. package/archetypes/third-person/assets/audio/ui-success.ogt +9 -0
  358. package/archetypes/third-person/assets/audio/vale.wav +0 -0
  359. package/archetypes/third-person/assets/fonts/NotoSansSC-subset.ttf +0 -0
  360. package/archetypes/third-person/assets/fonts/NotoSansSC-subset.ttf.ogt +10 -0
  361. package/archetypes/third-person/assets/fonts/OFL.txt +93 -0
  362. package/archetypes/third-person/assets/fx/burst.ogt +25 -0
  363. package/archetypes/third-person/assets/fx/fire.ogt +24 -0
  364. package/archetypes/third-person/assets/fx/smoke.ogt +24 -0
  365. package/archetypes/third-person/assets/fx/splash.ogt +24 -0
  366. package/archetypes/third-person/assets/luts/teal-orange.cube +4917 -0
  367. package/archetypes/third-person/assets/models/stout.glb +0 -0
  368. package/archetypes/third-person/assets/models/strider.glb +0 -0
  369. package/archetypes/third-person/assets/models/strider.glb.ogt +9 -0
  370. package/archetypes/third-person/assets/nav/vale.ogt +43 -0
  371. package/archetypes/third-person/assets/rigs/strider.ogt +6 -0
  372. package/archetypes/third-person/assets/skins/ember/Cinzel-Bold.ttf +0 -0
  373. package/archetypes/third-person/assets/skins/ember/Cinzel-Bold.ttf.ogt +9 -0
  374. package/archetypes/third-person/assets/skins/ember/LICENSES.md +13 -0
  375. package/archetypes/third-person/assets/skins/ember/Newsreader-Medium.ttf +0 -0
  376. package/archetypes/third-person/assets/skins/ember/Newsreader-Medium.ttf.ogt +9 -0
  377. package/archetypes/third-person/assets/skins/ember/OFL.txt +94 -0
  378. package/archetypes/third-person/assets/skins/ember/atlas.png +0 -0
  379. package/archetypes/third-person/assets/skins/ember/atlas.png.ogt +7 -0
  380. package/archetypes/third-person/assets/skins/ember/icons.png +0 -0
  381. package/archetypes/third-person/assets/skins/ember/icons.png.ogt +7 -0
  382. package/archetypes/third-person/assets/skins/ember/skin.ogt +109 -0
  383. package/archetypes/third-person/assets/strings/en.ogt +47 -0
  384. package/archetypes/third-person/assets/strings/zh-CN.ogt +47 -0
  385. package/archetypes/third-person/assets/terrain/vale-control.png +0 -0
  386. package/archetypes/third-person/assets/terrain/vale.ogt +42 -0
  387. package/archetypes/third-person/assets/terrain/vale.png +0 -0
  388. package/archetypes/third-person/assets/textures/decals.png +0 -0
  389. package/archetypes/third-person/assets/textures/flame.png +0 -0
  390. package/archetypes/third-person/assets/textures/smoke.png +0 -0
  391. package/archetypes/third-person/assets/textures/spark.png +0 -0
  392. package/archetypes/third-person/assets/textures/terrain-grass.png +0 -0
  393. package/archetypes/third-person/assets/textures/terrain-path.png +0 -0
  394. package/archetypes/third-person/assets/textures/terrain-rock.png +0 -0
  395. package/archetypes/third-person/assets/textures/terrain-sand.png +0 -0
  396. package/archetypes/third-person/gitattributes +22 -0
  397. package/archetypes/third-person/host.d.ts +46 -0
  398. package/archetypes/third-person/package.json +18 -0
  399. package/archetypes/third-person/project.ogt +14 -0
  400. package/archetypes/third-person/references/metal/beacon.png +0 -0
  401. package/archetypes/third-person/references/metal/dawn.png +0 -0
  402. package/archetypes/third-person/references/metal/title.png +0 -0
  403. package/archetypes/third-person/references/webgl2/beacon.png +0 -0
  404. package/archetypes/third-person/src/anim.ts +87 -0
  405. package/archetypes/third-person/src/beacons.ts +80 -0
  406. package/archetypes/third-person/src/components.ts +148 -0
  407. package/archetypes/third-person/src/hero.ts +293 -0
  408. package/archetypes/third-person/src/main.ts +164 -0
  409. package/archetypes/third-person/src/sentinels.ts +159 -0
  410. package/archetypes/third-person/src/sound.ts +66 -0
  411. package/archetypes/third-person/src/ui.ts +451 -0
  412. package/archetypes/third-person/src/world.ts +212 -0
  413. package/archetypes/third-person/tests/flow.og.ts +70 -0
  414. package/archetypes/third-person/tests/frames.og.ts +35 -0
  415. package/archetypes/third-person/tests/frames.ts +134 -0
  416. package/archetypes/third-person/tests/hitstop.og.ts +26 -0
  417. package/archetypes/third-person/tests/lib.ts +87 -0
  418. package/archetypes/third-person/tests/lose.og.ts +44 -0
  419. package/archetypes/third-person/tests/pause.og.ts +64 -0
  420. package/archetypes/third-person/tests/phone.og.ts +65 -0
  421. package/archetypes/third-person/tests/replay.og.ts +32 -0
  422. package/archetypes/third-person/tests/restart.og.ts +28 -0
  423. package/archetypes/third-person/tests/sentinels.og.ts +48 -0
  424. package/archetypes/third-person/tests/win.og.ts +62 -0
  425. package/archetypes/third-person/tools/make-assets.py +353 -0
  426. package/archetypes/third-person/tools/oglite.py +285 -0
  427. package/archetypes/third-person/tsconfig.json +17 -0
  428. package/archetypes/topdown/.origin/setup +14 -0
  429. package/archetypes/topdown/LICENSES.md +10 -0
  430. package/archetypes/topdown/README.md +235 -0
  431. package/archetypes/topdown/assets/ai/slime.ogt +49 -0
  432. package/archetypes/topdown/assets/audio/coin.wav +0 -0
  433. package/archetypes/topdown/assets/audio/door.wav +0 -0
  434. package/archetypes/topdown/assets/audio/hit.wav +0 -0
  435. package/archetypes/topdown/assets/audio/hurt.wav +0 -0
  436. package/archetypes/topdown/assets/audio/key.wav +0 -0
  437. package/archetypes/topdown/assets/audio/step.ogt +9 -0
  438. package/archetypes/topdown/assets/fonts/OFL.txt +93 -0
  439. package/archetypes/topdown/assets/fonts/ui.ttf +0 -0
  440. package/archetypes/topdown/assets/fonts/ui.ttf.ogt +9 -0
  441. package/archetypes/topdown/assets/maps/tomb.tmj +2183 -0
  442. package/archetypes/topdown/assets/sprites/hero.ogt +58 -0
  443. package/archetypes/topdown/assets/sprites/hero.png +0 -0
  444. package/archetypes/topdown/assets/sprites/hero.png.ogt +7 -0
  445. package/archetypes/topdown/assets/sprites/items.ogt +15 -0
  446. package/archetypes/topdown/assets/sprites/items.png +0 -0
  447. package/archetypes/topdown/assets/sprites/items.png.ogt +7 -0
  448. package/archetypes/topdown/assets/sprites/slime.ogt +17 -0
  449. package/archetypes/topdown/assets/sprites/slime.png +0 -0
  450. package/archetypes/topdown/assets/sprites/slime.png.ogt +7 -0
  451. package/archetypes/topdown/assets/tiles/dungeon.ogt +65 -0
  452. package/archetypes/topdown/assets/tiles/dungeon.png +0 -0
  453. package/archetypes/topdown/assets/tiles/dungeon.png.ogt +7 -0
  454. package/archetypes/topdown/gitattributes +22 -0
  455. package/archetypes/topdown/host.d.ts +46 -0
  456. package/archetypes/topdown/package.json +18 -0
  457. package/archetypes/topdown/project.ogt +14 -0
  458. package/archetypes/topdown/references/metal/crit.png +0 -0
  459. package/archetypes/topdown/references/metal/dash.png +0 -0
  460. package/archetypes/topdown/references/metal/east.png +0 -0
  461. package/archetypes/topdown/references/metal/start.png +0 -0
  462. package/archetypes/topdown/src/art.ts +48 -0
  463. package/archetypes/topdown/src/components.ts +128 -0
  464. package/archetypes/topdown/src/main.ts +275 -0
  465. package/archetypes/topdown/src/systems.ts +503 -0
  466. package/archetypes/topdown/tests/ai.og.ts +64 -0
  467. package/archetypes/topdown/tests/combat.og.ts +72 -0
  468. package/archetypes/topdown/tests/door.og.ts +62 -0
  469. package/archetypes/topdown/tests/flee.og.ts +49 -0
  470. package/archetypes/topdown/tests/frames.og.ts +45 -0
  471. package/archetypes/topdown/tests/frames.ts +134 -0
  472. package/archetypes/topdown/tests/lib.ts +71 -0
  473. package/archetypes/topdown/tests/replay.og.ts +40 -0
  474. package/archetypes/topdown/tests/walk.og.ts +46 -0
  475. package/archetypes/topdown/tools/make-assets.py +623 -0
  476. package/archetypes/topdown/tools/oglite.py +285 -0
  477. package/archetypes/topdown/tsconfig.json +17 -0
  478. package/archetypes/tower-defense/.origin/setup +14 -0
  479. package/archetypes/tower-defense/LICENSES.md +15 -0
  480. package/archetypes/tower-defense/README.md +240 -0
  481. package/archetypes/tower-defense/assets/ai/plant.ogt +16 -0
  482. package/archetypes/tower-defense/assets/audio/clear.wav +0 -0
  483. package/archetypes/tower-defense/assets/audio/frost.wav +0 -0
  484. package/archetypes/tower-defense/assets/audio/leak.wav +0 -0
  485. package/archetypes/tower-defense/assets/audio/lost.wav +0 -0
  486. package/archetypes/tower-defense/assets/audio/night.wav +0 -0
  487. package/archetypes/tower-defense/assets/audio/plant.wav +0 -0
  488. package/archetypes/tower-defense/assets/audio/pop.wav +0 -0
  489. package/archetypes/tower-defense/assets/audio/thorn.wav +0 -0
  490. package/archetypes/tower-defense/assets/audio/ui-close.ogt +9 -0
  491. package/archetypes/tower-defense/assets/audio/ui-error.ogt +9 -0
  492. package/archetypes/tower-defense/assets/audio/ui-open.ogt +9 -0
  493. package/archetypes/tower-defense/assets/audio/ui-press.ogt +9 -0
  494. package/archetypes/tower-defense/assets/audio/ui-success.ogt +9 -0
  495. package/archetypes/tower-defense/assets/audio/wave.wav +0 -0
  496. package/archetypes/tower-defense/assets/audio/won.wav +0 -0
  497. package/archetypes/tower-defense/assets/fonts/NotoSansSC-subset.ttf +0 -0
  498. package/archetypes/tower-defense/assets/fonts/NotoSansSC-subset.ttf.ogt +10 -0
  499. package/archetypes/tower-defense/assets/fonts/OFL.txt +93 -0
  500. package/archetypes/tower-defense/assets/fx/fireflies.ogt +21 -0
  501. package/archetypes/tower-defense/assets/fx/pop.ogt +21 -0
  502. package/archetypes/tower-defense/assets/maps/garden.ogt +91 -0
  503. package/archetypes/tower-defense/assets/skins/pathguard/Fredoka-SemiBold.ttf +0 -0
  504. package/archetypes/tower-defense/assets/skins/pathguard/Fredoka-SemiBold.ttf.ogt +9 -0
  505. package/archetypes/tower-defense/assets/skins/pathguard/LICENSES.md +13 -0
  506. package/archetypes/tower-defense/assets/skins/pathguard/LilitaOne-Regular.ttf +0 -0
  507. package/archetypes/tower-defense/assets/skins/pathguard/LilitaOne-Regular.ttf.ogt +9 -0
  508. package/archetypes/tower-defense/assets/skins/pathguard/OFL.txt +94 -0
  509. package/archetypes/tower-defense/assets/skins/pathguard/atlas.png +0 -0
  510. package/archetypes/tower-defense/assets/skins/pathguard/atlas.png.ogt +7 -0
  511. package/archetypes/tower-defense/assets/skins/pathguard/icons.png +0 -0
  512. package/archetypes/tower-defense/assets/skins/pathguard/icons.png.ogt +7 -0
  513. package/archetypes/tower-defense/assets/skins/pathguard/skin.ogt +111 -0
  514. package/archetypes/tower-defense/assets/sprites/garden.ogt +66 -0
  515. package/archetypes/tower-defense/assets/sprites/garden.png +0 -0
  516. package/archetypes/tower-defense/assets/sprites/garden.png.ogt +7 -0
  517. package/archetypes/tower-defense/assets/sprites/glow.png +0 -0
  518. package/archetypes/tower-defense/assets/sprites/glow.png.ogt +7 -0
  519. package/archetypes/tower-defense/assets/sprites/ring.png +0 -0
  520. package/archetypes/tower-defense/assets/sprites/ring.png.ogt +7 -0
  521. package/archetypes/tower-defense/assets/sprites/spark.png +0 -0
  522. package/archetypes/tower-defense/assets/sprites/spark.png.ogt +7 -0
  523. package/archetypes/tower-defense/assets/strings/en.ogt +47 -0
  524. package/archetypes/tower-defense/assets/strings/zh-CN.ogt +47 -0
  525. package/archetypes/tower-defense/assets/tiles/garden.ogt +10 -0
  526. package/archetypes/tower-defense/assets/tiles/garden.png +0 -0
  527. package/archetypes/tower-defense/assets/tiles/garden.png.ogt +7 -0
  528. package/archetypes/tower-defense/gitattributes +22 -0
  529. package/archetypes/tower-defense/host.d.ts +46 -0
  530. package/archetypes/tower-defense/package.json +18 -0
  531. package/archetypes/tower-defense/project.ogt +14 -0
  532. package/archetypes/tower-defense/references/metal/end.png +0 -0
  533. package/archetypes/tower-defense/references/metal/title.png +0 -0
  534. package/archetypes/tower-defense/references/metal/wave.png +0 -0
  535. package/archetypes/tower-defense/src/art.ts +24 -0
  536. package/archetypes/tower-defense/src/components.ts +156 -0
  537. package/archetypes/tower-defense/src/main.ts +253 -0
  538. package/archetypes/tower-defense/src/systems.ts +658 -0
  539. package/archetypes/tower-defense/src/ui.ts +382 -0
  540. package/archetypes/tower-defense/tests/flow.og.ts +56 -0
  541. package/archetypes/tower-defense/tests/frames.og.ts +31 -0
  542. package/archetypes/tower-defense/tests/frames.ts +134 -0
  543. package/archetypes/tower-defense/tests/lib.ts +81 -0
  544. package/archetypes/tower-defense/tests/lose.og.ts +40 -0
  545. package/archetypes/tower-defense/tests/maze.og.ts +53 -0
  546. package/archetypes/tower-defense/tests/pad.og.ts +41 -0
  547. package/archetypes/tower-defense/tests/pause.og.ts +59 -0
  548. package/archetypes/tower-defense/tests/phone.og.ts +49 -0
  549. package/archetypes/tower-defense/tests/replay.og.ts +28 -0
  550. package/archetypes/tower-defense/tests/win.og.ts +58 -0
  551. package/archetypes/tower-defense/tools/make-assets.py +640 -0
  552. package/archetypes/tower-defense/tools/oglite.py +285 -0
  553. package/archetypes/tower-defense/tsconfig.json +17 -0
  554. package/bin/create.ts +496 -0
  555. package/looks/catalogue.json +1871 -0
  556. package/package.json +31 -4
  557. package/template/.origin/setup +14 -0
  558. package/template/LICENSES.md +23 -0
  559. package/template/README.md +37 -0
  560. package/template/assets/ai/guard.ogt +48 -0
  561. package/template/assets/audio/blip.wav +0 -0
  562. package/template/assets/audio/click.ogt +9 -0
  563. package/template/assets/fonts/NotoSansSC-Regular-subset.ttf +0 -0
  564. package/template/assets/fonts/NotoSansSC-Regular-subset.ttf.ogt +12 -0
  565. package/template/assets/fonts/OFL.txt +93 -0
  566. package/template/assets/looks/origin-game.ogt +12 -0
  567. package/template/assets/models/dropship.glb +0 -0
  568. package/template/assets/models/walker.glb +0 -0
  569. package/template/assets/nav/yard.ogt +27 -0
  570. package/template/assets/scenes/main.ogt +34 -0
  571. package/template/assets/strings/en.ogt +14 -0
  572. package/template/assets/textures/stone.png +0 -0
  573. package/template/assets/textures/stone_n.png +0 -0
  574. package/template/assets/textures/stone_n.png.ogt +7 -0
  575. package/template/gitattributes +22 -0
  576. package/template/package.json +18 -0
  577. package/template/project.ogt +25 -0
  578. package/template/src/main.ts +246 -0
  579. package/template/tests/guard.og.ts +67 -0
  580. package/template/tests/smoke.og.ts +43 -0
  581. package/template/tsconfig.json +17 -0
@@ -0,0 +1,169 @@
1
+ // Every piece of Lamp Dive's state lives in these reflected types: dumps,
2
+ // the probe, Tune and the command channel's `get` and `set` read and write
3
+ // them by name.
4
+ //
5
+ // The dive (Game), the knobs (Tuning), the player's settings (Prefs) and
6
+ // where each foe stands (Foes, so the hero's system can find what it walks
7
+ // into) are resources. The actors are pooled rows spawned in `start`: the
8
+ // hero, the foes, the loot and one voice per sound.
9
+
10
+ import { bool, defineComponent, defineResource, f32, f64, i32, u32 } from "@origingame/engine";
11
+
12
+ /** The screen the game is on. */
13
+ export const Phase = { Title: 0, Play: 1, Over: 2 } as const;
14
+
15
+ /** What a foe is (Foe.kind). */
16
+ export const FoeKind = { Rat: 0, Skeleton: 1, Guardian: 2 } as const;
17
+ export const FOES = ["rat", "skeleton", "guardian"] as const;
18
+
19
+ /** What a find is (Loot.kind). */
20
+ export const LootKind = { Potion: 0, Blade: 1, Ward: 2, Oil: 3, Coin: 4, Relic: 5 } as const;
21
+ export const LOOT = ["potion", "blade", "ward", "oil", "coin", "relic"] as const;
22
+
23
+ /** Sound requests: bits of Game.sfx that the Voices system plays once each. */
24
+ export const Sound = { Step: 1, Hit: 2, Hurt: 4, Kill: 8, Pickup: 16, Item: 32, Drink: 64, Stairs: 128, Roar: 256, Telegraph: 512, Fall: 1024, Won: 2048, Bump: 4096, Move: 8192 } as const;
25
+
26
+ /** The most foes and finds a floor holds. */
27
+ export const FOE_SLOTS = 10;
28
+ export const LOOT_SLOTS = 12;
29
+
30
+ /** The dive: the lamp-bearer, the floor, the turn, the counts and the effects' bookkeeping. */
31
+ export const Game = defineResource("Game", {
32
+ phase: u32(Phase.Title, { doc: "Phase.* of src/components.ts." }),
33
+ leftTitle: bool(false, { doc: "The player has left the title the game opened on: from then on the title enters with the skin's entrance (the opening one is built settled, og.ui.mainMenu's instant: the web draws it behind the play gate)." }),
34
+ paused: bool(false),
35
+ settingsOpen: bool(false),
36
+ held: bool(false, { doc: "The time scale is held at 0 (paused or in the settings)." }),
37
+ dives: u32(0, { doc: "Dives started on this device (the store's `record`)." }),
38
+ relics: u32(0, { doc: "Dives that took the relic (the store's `record`)." }),
39
+ recordRequest: u32(0, { doc: "The store request reading `record`." }),
40
+ recordRevision: u32(0, { doc: "The revision `record` was read or written at." }),
41
+ recordWrite: u32(0, { doc: "The store request writing `record`." }),
42
+ recordMerge: bool(false, { doc: "A write was refused as stale: the record is read again and the merge written." }),
43
+ recordDives: u32(0, { doc: "Dives in the record as last read or written: Game.dives less this is what this device adds." }),
44
+ recordRelics: u32(0, { doc: "Relics in the record as last read or written." }),
45
+ recordConflicts: u32(0, { doc: "Record writes refused as stale (another device or tab wrote first)." }),
46
+ seed: u32(0, { doc: "This dive's seed: every floor's rooms, foes and finds come from og.Rng streams forked with it." }),
47
+ floor: u32(0, { doc: "The floor the lamp-bearer is on (1 or 2; 0 before the first dive)." }),
48
+ deepest: u32(0),
49
+ build: bool(false, { doc: "The Hero system carves the floor this tick." }),
50
+ place: bool(false, { doc: "The Foes and Loot systems place this floor's rows this tick." }),
51
+ hp: i32(0),
52
+ hpMax: i32(0),
53
+ attack: i32(0, { doc: "Damage a strike deals (before the die's +0 or +1)." }),
54
+ armour: i32(0, { doc: "Damage a foe's strike loses." }),
55
+ lamp: f32(0, { unit: "cells", doc: "How far the lamp lights." }),
56
+ potions: u32(0),
57
+ gold: u32(0),
58
+ kills: u32(0),
59
+ hits: u32(0, { doc: "Strikes that landed on a foe." }),
60
+ hurts: u32(0, { doc: "Strikes that landed on the lamp-bearer." }),
61
+ finds: u32(0, { doc: "Things picked up." }),
62
+ turns: u32(0),
63
+ heroX: i32(0, { doc: "The lamp-bearer's cell, a map column." }),
64
+ heroY: i32(0, { doc: "The lamp-bearer's cell, a map row (0 the top)." }),
65
+ stairsX: i32(-1, { doc: "The stairs' cell on floor 1 (-1 none)." }),
66
+ stairsY: i32(-1),
67
+ foesTurn: bool(false, { doc: "The foes act this turn: their behaviour (assets/ai/*.ogt) checks it." }),
68
+ lock: u32(0, { unit: "ticks", doc: "Ticks before the next action is taken (the step's or the strike's animation)." }),
69
+ strikeSlot: i32(-1, { doc: "The foe the lamp-bearer struck this tick, for the Foes system."}),
70
+ strikeDamage: i32(0),
71
+ queued: u32(0, { doc: "An action asked for while the last played out (0 none, 1-4 a direction, 5 wait, 6 drink)." }),
72
+ repeat: u32(0, { unit: "ticks", doc: "Ticks a direction has been held (it repeats after 14, then every 7)." }),
73
+ lastDir: u32(0, { doc: "The direction held last tick (0 none, 1 up, 2 right, 3 down, 4 left)." }),
74
+ padDir: u32(0, { doc: "The HUD d-pad's direction this tick (written by Ui)." }),
75
+ padWait: bool(false, { doc: "The HUD's Wait was pressed this tick." }),
76
+ padDrink: bool(false, { doc: "The HUD's Drink was pressed this tick." }),
77
+ refusedTick: i32(-1, { unit: "ticks", doc: "The tick a draught was refused (the HUD shakes Drink)." }),
78
+ foesAt: i32(-1, { unit: "ticks", doc: "The tick foesTurn went up; the Foes system takes it down on a later tick, after og.ai has thought with it." }),
79
+ foeMind: f64(0, { doc: "assets/ai/foe.ogt's behaviour handle." }),
80
+ guardianMind: f64(0, { doc: "assets/ai/guardian.ogt's behaviour handle." }),
81
+ won: bool(false),
82
+ killedBy: i32(-1, { doc: "FoeKind.* of the foe that put the lamp out (-1 none)." }),
83
+ overTicks: u32(0, { unit: "ticks", doc: "Ticks since the lamp went out or the relic was taken; the card comes after a beat." }),
84
+ newRecord: bool(false),
85
+ sfx: u32(0),
86
+ fogDirty: bool(false, { doc: "The lamp-bearer moved: the Fog system lights the cells it sees." }),
87
+ lit: u32(0, { doc: "Cells the lamp lights now." }),
88
+ seen: u32(0, { doc: "Cells of this floor the lamp has ever lit (lit now or remembered)." }),
89
+ grid: f64(0, { doc: "The floor's og.nav grid." }),
90
+ map: f64(0, { doc: "The floor's og.Tilemap entity." }),
91
+ glow: f64(0, { doc: "The lamp's light texture." }),
92
+ viewW: f32(0, { unit: "cssPx" }),
93
+ viewH: f32(0, { unit: "cssPx" }),
94
+ language: u32(0, { doc: "Prefs.language, mirrored for the facts." }),
95
+ });
96
+
97
+ /** The knobs. Tune reads the tunable fields; `set:Tuning.<field>=<value>` writes them. */
98
+ export const Tuning = defineResource("Tuning", {
99
+ heroHp: i32(20, { min: 1, max: 99, step: 1, tunable: true, label: "Lamp-bearer's health" }),
100
+ heroAttack: i32(3, { min: 1, max: 20, step: 1, tunable: true, label: "Strike" }),
101
+ lamp: f32(4.5, { min: 2, max: 12, step: 0.5, unit: "cells", tunable: true, label: "Lamp reach" }),
102
+ potionHeal: i32(8, { min: 1, max: 40, step: 1, tunable: true, label: "A draught heals" }),
103
+ ratHp: i32(5, { min: 1, max: 40, tunable: true, label: "Rat health" }),
104
+ ratAttack: i32(1, { min: 0, max: 20, tunable: true, label: "Rat strike" }),
105
+ skeletonHp: i32(9, { min: 1, max: 60, tunable: true, label: "Skeleton health" }),
106
+ skeletonAttack: i32(2, { min: 0, max: 20, tunable: true, label: "Skeleton strike" }),
107
+ guardianHp: i32(18, { min: 1, max: 99, tunable: true, label: "Guardian health" }),
108
+ guardianAttack: i32(3, { min: 0, max: 20, tunable: true, label: "Guardian strike", doc: "Its charged strike, every third turn and telegraphed the turn before, deals twice this." }),
109
+ sight: f32(6, { min: 1, max: 15, step: 0.5, unit: "m", tunable: true, label: "Foes' sight", doc: "How far a foe sees (og.Perception.sight); walls hide the lamp-bearer." }),
110
+ stepTime: f32(0.09, { min: 0.02, max: 0.4, step: 0.01, unit: "s", tunable: true, label: "Step time", doc: "How long a step's tween takes; actions wait for it." }),
111
+ hitStop: u32(4, { min: 0, max: 12, unit: "ticks", tunable: true, label: "Hit stop" }),
112
+ });
113
+
114
+ /** The player's settings: kept in og.platform's settings, restored on the first ticks. */
115
+ export const Prefs = defineResource("Prefs", {
116
+ master: f32(1, { min: 0, max: 1 }),
117
+ music: f32(0.7, { min: 0, max: 1 }),
118
+ effects: f32(1, { min: 0, max: 1 }),
119
+ language: u32(0, { doc: "0 English, 1 简体中文 (LANGUAGES in src/ui.ts)." }),
120
+ reducedMotion: bool(false),
121
+ loadRequest: u32(0),
122
+ saves: u32(0),
123
+ });
124
+
125
+ /** Where each foe stands and whether it is up: the Hero system reads it to strike what it walks into. */
126
+ export const Foes = defineResource("Foes", Object.fromEntries(
127
+ Array.from({ length: FOE_SLOTS }, (_, i) => [
128
+ [`x${i}`, i32(-1)],
129
+ [`y${i}`, i32(-1)],
130
+ ]).flat(),
131
+ ) as Record<string, ReturnType<typeof i32>>);
132
+
133
+ /** The lamp-bearer. */
134
+ export const Hero = defineComponent("Hero", {
135
+ steps: u32(0, { doc: "Cells walked." }),
136
+ bumps: u32(0, { doc: "Steps into stone (refused with a bump)." }),
137
+ });
138
+
139
+ /** A foe: a pooled row a floor switches on. What it decides is assets/ai/<kind>.ogt (og.ai). */
140
+ export const Foe = defineComponent("Foe", {
141
+ slot: u32(0),
142
+ active: bool(false),
143
+ kind: u32(FoeKind.Rat),
144
+ hp: i32(0),
145
+ hpMax: i32(0),
146
+ attack: i32(0),
147
+ cx: i32(0, { doc: "Its cell." }),
148
+ cy: i32(0),
149
+ turns: u32(0, { doc: "Its turns on this floor (the guardian charges every third)." }),
150
+ charging: bool(false, { doc: "Its next strike is charged (telegraphed in red)." }),
151
+ dying: u32(0, { unit: "ticks" }),
152
+ });
153
+
154
+ /** A find on the floor. */
155
+ export const Loot = defineComponent("Loot", {
156
+ slot: u32(0),
157
+ active: bool(false),
158
+ kind: u32(LootKind.Potion),
159
+ amount: u32(0, { doc: "Gold in a coin pile." }),
160
+ cx: i32(0),
161
+ cy: i32(0),
162
+ taken: u32(0, { unit: "ticks", doc: "Ticks since it was picked up (it rises and fades, then the row parks)." }),
163
+ });
164
+
165
+ /** One voice: plays its sound once when Game.sfx asks for its bit. */
166
+ export const Sfx = defineComponent("Sfx", {
167
+ bit: u32(0),
168
+ plays: u32(0),
169
+ });
@@ -0,0 +1,144 @@
1
+ // A floor's plan: rooms, the corridors between them, where the lamp-bearer
2
+ // starts, the stairs (floor 1) or the relic and its guardian (floor 2), the
3
+ // foes and the finds. A pure function of the dive's seed and the floor
4
+ // number: the plan comes from an og.Rng stream forked with both, so every
5
+ // system that needs it (the Hero carves it, the Foes and the Loot place
6
+ // their rows) computes the same plan, and a dive replays from its seed.
7
+
8
+ import type { RngStream } from "@origingame/engine";
9
+ import { FoeKind, LootKind } from "./components.ts";
10
+
11
+ /** The floor's size in cells (assets/maps/dive.ogt). */
12
+ export const W = 28;
13
+ export const H = 20;
14
+
15
+ export interface Room {
16
+ readonly x: number;
17
+ readonly y: number;
18
+ readonly w: number;
19
+ readonly h: number;
20
+ }
21
+
22
+ export interface Plan {
23
+ /** 1 where the floor is stone, row-major from the top row. */
24
+ readonly walls: Uint8Array;
25
+ readonly rooms: readonly Room[];
26
+ readonly start: { x: number; y: number };
27
+ /** Floor 1's way down. */
28
+ readonly stairs: { x: number; y: number } | null;
29
+ /** Floor 2's relic, in the farthest room. */
30
+ readonly relic: { x: number; y: number } | null;
31
+ readonly foes: ReadonlyArray<{ kind: number; x: number; y: number }>;
32
+ readonly loot: ReadonlyArray<{ kind: number; x: number; y: number; amount: number }>;
33
+ }
34
+
35
+ const centre = (r: Room) => ({ x: r.x + Math.floor(r.w / 2), y: r.y + Math.floor(r.h / 2) });
36
+
37
+ /**
38
+ * Rooms placed at random without touching, joined in order of their
39
+ * centres by L-shaped corridors (which way the L turns is a coin), then the
40
+ * start in the first room, the goal in the room farthest from it by walking
41
+ * distance, and the foes and finds in the others.
42
+ */
43
+ export function planFloor(rng: RngStream, floor: number): Plan {
44
+ const walls = new Uint8Array(W * H).fill(1);
45
+ const rooms: Room[] = [];
46
+ for (let attempt = 0; attempt < 80 && rooms.length < 8; attempt++) {
47
+ const w = rng.integer(4, 7);
48
+ const h = rng.integer(3, 5);
49
+ const x = rng.integer(1, W - w - 1);
50
+ const y = rng.integer(1, H - h - 1);
51
+ const touches = rooms.some((r) => x <= r.x + r.w && r.x <= x + w && y <= r.y + r.h && r.y <= y + h);
52
+ if (!touches) rooms.push({ x, y, w, h });
53
+ }
54
+ rooms.sort((a, b) => centre(a).x - centre(b).x || centre(a).y - centre(b).y);
55
+ const open = (x: number, y: number) => {
56
+ if (x > 0 && y > 0 && x < W - 1 && y < H - 1) walls[y * W + x] = 0;
57
+ };
58
+ for (const r of rooms) for (let y = r.y; y < r.y + r.h; y++) for (let x = r.x; x < r.x + r.w; x++) open(x, y);
59
+ for (let i = 1; i < rooms.length; i++) {
60
+ const a = centre(rooms[i - 1]!);
61
+ const b = centre(rooms[i]!);
62
+ const flat = rng.chance(0.5);
63
+ const corner = flat ? { x: b.x, y: a.y } : { x: a.x, y: b.y };
64
+ for (const [p, q] of [[a, corner], [corner, b]] as const) {
65
+ for (let x = Math.min(p.x, q.x); x <= Math.max(p.x, q.x); x++) open(x, p.y);
66
+ for (let y = Math.min(p.y, q.y); y <= Math.max(p.y, q.y); y++) open(q.x, y);
67
+ }
68
+ }
69
+ const start = centre(rooms[0]!);
70
+ // Walking distance from the start to every open cell (four ways).
71
+ const dist = new Int32Array(W * H).fill(-1);
72
+ const queue = [start.y * W + start.x];
73
+ dist[queue[0]!] = 0;
74
+ for (let k = 0; k < queue.length; k++) {
75
+ const c = queue[k]!;
76
+ for (const d of [1, -1, W, -W]) {
77
+ const n = c + d;
78
+ if (n >= 0 && n < W * H && walls[n] === 0 && dist[n]! < 0) {
79
+ dist[n] = dist[c]! + 1;
80
+ queue.push(n);
81
+ }
82
+ }
83
+ }
84
+ let far = 0;
85
+ rooms.forEach((r, i) => {
86
+ const c = centre(r);
87
+ if (dist[c.y * W + c.x]! > dist[centre(rooms[far]!).y * W + centre(rooms[far]!).x]!) far = i;
88
+ });
89
+ const goal = centre(rooms[far]!);
90
+ const taken = new Set<number>([start.y * W + start.x, goal.y * W + goal.x]);
91
+ /** A free cell of a room, not its doorway rows: tries a few times, then the room's centre. */
92
+ const spot = (r: Room) => {
93
+ for (let k = 0; k < 12; k++) {
94
+ const x = rng.integer(r.x, r.x + r.w - 1);
95
+ const y = rng.integer(r.y, r.y + r.h - 1);
96
+ if (!taken.has(y * W + x)) {
97
+ taken.add(y * W + x);
98
+ return { x, y };
99
+ }
100
+ }
101
+ return null;
102
+ };
103
+ const foes: Array<{ kind: number; x: number; y: number }> = [];
104
+ const loot: Array<{ kind: number; x: number; y: number; amount: number }> = [];
105
+ const others = rooms.map((_, i) => i).filter((i) => i !== 0);
106
+ others.forEach((i, k) => {
107
+ const r = rooms[i]!;
108
+ const count = floor === 2 ? 1 + (k % 2) : 1;
109
+ for (let n = 0; n < count; n++) {
110
+ const at = spot(r);
111
+ if (at === null) continue;
112
+ if (i === far && floor === 2) continue;
113
+ const kind = floor === 1 ? (k % 3 === 2 ? FoeKind.Skeleton : FoeKind.Rat) : n === 0 ? FoeKind.Skeleton : FoeKind.Rat;
114
+ foes.push({ kind, ...at });
115
+ }
116
+ });
117
+ if (floor === 2) {
118
+ // The guardian stands between the relic and the way in.
119
+ const g = { x: goal.x - 1, y: goal.y };
120
+ taken.add(g.y * W + g.x);
121
+ foes.push({ kind: FoeKind.Guardian, ...g });
122
+ }
123
+ const finds = floor === 1 ? [LootKind.Potion, LootKind.Blade, LootKind.Oil, LootKind.Coin, LootKind.Coin, LootKind.Potion] : [LootKind.Potion, LootKind.Ward, LootKind.Coin, LootKind.Coin, LootKind.Potion];
124
+ finds.forEach((kind, k) => {
125
+ const r = rooms[others[k % others.length]!]!;
126
+ const at = spot(r);
127
+ if (at !== null) loot.push({ kind, ...at, amount: kind === LootKind.Coin ? rng.integer(5, 15) : 0 });
128
+ });
129
+ if (floor === 2) loot.push({ kind: LootKind.Relic, ...goal, amount: 0 });
130
+ return {
131
+ walls,
132
+ rooms,
133
+ start,
134
+ stairs: floor === 1 ? goal : null,
135
+ relic: floor === 2 ? goal : null,
136
+ foes: foes.slice(0, 10),
137
+ loot: loot.slice(0, 12),
138
+ };
139
+ }
140
+
141
+ /** The stream a floor is planned from: the world's seed, the dive's and the floor's. */
142
+ export function floorStream(rng: { fork(label: string): RngStream }, seed: number, floor: number): RngStream {
143
+ return rng.fork(`dive-${seed}-floor-${floor}`);
144
+ }
@@ -0,0 +1,174 @@
1
+ // The foes' actions: the game's commands their behaviours raise (og.ai
2
+ // queues each with the foe's handle; they run before the next tick). One
3
+ // command is one foe's whole turn.
4
+ //
5
+ // - strike: the lamp-bearer is next to it: it loses the foe's strike less
6
+ // its armour (at least 1), twice that for a charged strike; a hit holds
7
+ // the world, flashes the lamp-bearer red, shakes and kicks the camera.
8
+ // - hunt: a step along og.nav's path to the lamp-bearer (or to where the
9
+ // foe last saw it), never onto another foe; into the lamp-bearer it is a
10
+ // strike.
11
+ // - roam: a step in a direction of the dice (rats roam every turn,
12
+ // skeletons every other).
13
+ // - brace: the guardian holds its ground.
14
+ // The guardian charges every third turn: the turn before, it glows red and
15
+ // a "!" rises over it, so the lamp-bearer can step back and let the charge
16
+ // pass.
17
+
18
+ import { og } from "@origingame/engine";
19
+ import type { Entity, Value, World } from "@origingame/engine";
20
+ import { Foe, FoeKind, FOE_SLOTS, Game, Sound } from "./components.ts";
21
+ import { H, W } from "./dive.ts";
22
+ import { cellCenter, feel, float, isWall, lazyTuning, must, must2, RED } from "./systems.ts";
23
+ import { say } from "./ui.ts";
24
+
25
+ type FoeV = Value<typeof Foe>;
26
+ type GameV = Value<typeof Game>;
27
+
28
+ interface Ctx {
29
+ me: Entity;
30
+ f: FoeV;
31
+ g: GameV;
32
+ }
33
+
34
+ function context(world: World, args: readonly string[]): Ctx | null {
35
+ const me = Number(args[0]) as Entity;
36
+ const foe = world.get(me, Foe);
37
+ const game = world.resource(Game);
38
+ if (!foe.ok || !game.ok) throw new Error(`${args[0]} is not a foe`);
39
+ const g = game.value;
40
+ if (!foe.value.active || foe.value.dying > 0 || g.hp <= 0 || g.won) return null;
41
+ return { me, f: foe.value as FoeV, g };
42
+ }
43
+
44
+ /**
45
+ * Counts the foe's turn. The guardian's every third turn is charged,
46
+ * telegraphed a turn ahead; a charge not struck with on that turn (the
47
+ * lamp-bearer stepped away) is spent.
48
+ */
49
+ function turnTaken(world: World, c: Ctx): void {
50
+ const turns = c.f.turns + 1;
51
+ const charging = c.f.kind === FoeKind.Guardian && turns % 3 === 2;
52
+ if (charging) {
53
+ const at = cellCenter(c.f.cx, c.f.cy);
54
+ float(world, say(world, "float.charge"), at.x, at.y + 0.9, RED, true, 0.6);
55
+ c.g.sfx |= Sound.Telegraph;
56
+ }
57
+ must(world.set(c.me, Foe, { turns, charging }));
58
+ }
59
+
60
+ function occupied(world: World, x: number, y: number, me: Entity): boolean {
61
+ for (let i = 0; i < FOE_SLOTS; i++) {
62
+ const e = world.find(`foe-${i}`);
63
+ if (e === null || e === me) continue;
64
+ const f = world.get(e, Foe);
65
+ if (f.ok && f.value.active && f.value.cx === x && f.value.cy === y) return true;
66
+ }
67
+ return false;
68
+ }
69
+
70
+ function stepTo(world: World, c: Ctx, x: number, y: number): boolean {
71
+ if (x < 0 || y < 0 || x >= W || y >= H || isWall(world, c.g, x, y) || occupied(world, x, y, c.me)) return false;
72
+ if (x === c.g.heroX && y === c.g.heroY) return false;
73
+ must(world.set(c.me, Foe, { cx: x, cy: y }));
74
+ const to = cellCenter(x, y);
75
+ must(og.tween.to(world, { entity: c.me, field: "position", to: [to.x, to.y, 0], duration: lazyTuning(world).stepTime, ease: "quadOut" }));
76
+ return true;
77
+ }
78
+
79
+ /** `strike:<foe>`: the foe strikes the lamp-bearer beside it. */
80
+ export function strike(world: World, args: readonly string[]): void {
81
+ const c = context(world, args);
82
+ if (c === null) return;
83
+ const { f, g } = c;
84
+ if (Math.abs(f.cx - g.heroX) + Math.abs(f.cy - g.heroY) !== 1) {
85
+ hunt(world, args);
86
+ return;
87
+ }
88
+ const charged = f.charging;
89
+ const dmg = Math.max(1, f.attack * (charged ? 2 : 1) - g.armour);
90
+ g.hp = Math.max(0, g.hp - dmg);
91
+ g.hurts += 1;
92
+ g.sfx |= Sound.Hurt;
93
+ const hero = world.find("hero");
94
+ const at = cellCenter(g.heroX, g.heroY);
95
+ float(world, say(world, "float.hurt", { n: dmg }), at.x, at.y + 0.7, RED, charged);
96
+ if (hero !== null) {
97
+ must(og.tween.flash(world, { entity: hero, color: RED, duration: 0.2 }));
98
+ must(og.tween.squash(world, { entity: hero, impact: { x: 1.25, y: 0.75 }, duration: 0.2 }));
99
+ }
100
+ const from = cellCenter(f.cx, f.cy);
101
+ // The foe lunges at the lamp-bearer and back.
102
+ must(og.tween.sequence(world, [
103
+ { entity: c.me, field: "position", to: [from.x + (at.x - from.x) * 0.35, from.y + (at.y - from.y) * 0.35, 0], duration: 0.05, ease: "quadOut" },
104
+ { entity: c.me, field: "position", to: [from.x, from.y, 0], duration: 0.09, ease: "quadIn" },
105
+ ]));
106
+ const dead = g.hp === 0;
107
+ must(og.time.hitStop(world, dead ? 16 : charged ? 8 : 3));
108
+ const k = feel(world);
109
+ must(og.camera.shake(world, (dead ? 0.7 : charged ? 0.5 : 0.25) * k));
110
+ must(og.camera.kick(world, { x: at.x - from.x, y: at.y - from.y, z: 0 }, (charged ? 0.25 : 0.12) * k));
111
+ if (dead) {
112
+ g.killedBy = f.kind;
113
+ g.overTicks = 0;
114
+ g.sfx |= Sound.Fall;
115
+ }
116
+ turnTaken(world, c);
117
+ }
118
+
119
+ /** `hunt:<foe>`: a step along og.nav's path to the lamp-bearer, or to where the foe last saw it. */
120
+ export function hunt(world: World, args: readonly string[]): void {
121
+ const c = context(world, args);
122
+ if (c === null) return;
123
+ const { f, g } = c;
124
+ const eyes = world.get(c.me, og.Perception);
125
+ const sees = eyes.ok && eyes.value.sees;
126
+ let tx = g.heroX;
127
+ let ty = g.heroY;
128
+ if (!sees && eyes.ok) {
129
+ tx = Math.floor(eyes.value.lastSeen.x);
130
+ ty = H - 1 - Math.floor(eyes.value.lastSeen.y);
131
+ }
132
+ if (Math.abs(f.cx - g.heroX) + Math.abs(f.cy - g.heroY) === 1 && sees) {
133
+ strike(world, args);
134
+ return;
135
+ }
136
+ const from = cellCenter(f.cx, f.cy);
137
+ const to = cellCenter(tx, ty);
138
+ const path = og.nav.findPath(world, { nav: g.grid as unknown as never, from: { x: from.x, y: from.y, z: 0 }, to: { x: to.x, y: to.y, z: 0 }, smooth: false });
139
+ let moved = false;
140
+ if (path.ok && path.value.points.length > 1) {
141
+ const next = path.value.points[1]!;
142
+ const dx = Math.sign(Math.round(next.x - 0.5) - f.cx);
143
+ const dy = Math.sign(H - 1 - Math.round(next.y - 0.5) - f.cy);
144
+ // Along the longer leg first, then the other.
145
+ const tries = Math.abs(next.x - from.x) >= Math.abs(next.y - from.y) ? [[dx, 0], [0, dy]] : [[0, dy], [dx, 0]];
146
+ for (const [sx, sy] of tries) {
147
+ if ((sx !== 0 || sy !== 0) && !moved) moved = stepTo(world, c, f.cx + sx!, f.cy + sy!);
148
+ }
149
+ }
150
+ turnTaken(world, c);
151
+ }
152
+
153
+ /** `roam:<foe>`: a step in a direction of the dice (a skeleton keeps still every other turn). */
154
+ export function roam(world: World, args: readonly string[]): void {
155
+ const c = context(world, args);
156
+ if (c === null) return;
157
+ const rng = must2(world.resource(og.Rng));
158
+ if (c.f.kind === FoeKind.Rat || c.f.turns % 2 === 0) {
159
+ const start = rng.integer(0, 3);
160
+ const dirs = [[0, -1], [1, 0], [0, 1], [-1, 0]];
161
+ for (let k = 0; k < 4; k++) {
162
+ const [dx, dy] = dirs[(start + k) % 4]!;
163
+ if (stepTo(world, c, c.f.cx + dx!, c.f.cy + dy!)) break;
164
+ }
165
+ }
166
+ turnTaken(world, c);
167
+ }
168
+
169
+ /** `brace:<foe>`: the guardian holds its ground (its charge still counts). */
170
+ export function brace(world: World, args: readonly string[]): void {
171
+ const c = context(world, args);
172
+ if (c === null) return;
173
+ turnTaken(world, c);
174
+ }