vibedgames 0.9.0 → 0.10.1

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 (88) hide show
  1. package/README.md +3 -2
  2. package/assets/align-framing.py +242 -0
  3. package/assets/render-model.py +406 -0
  4. package/assets/tilemap-editor.html +630 -0
  5. package/dist/THIRD_PARTY_NOTICES.txt +2 -2
  6. package/dist/{chunk-56OY4TEP.js → chunk-2SBBKY5C.js} +1361 -4493
  7. package/dist/{chunk-FC233UKH.js → chunk-2ZKS7V72.js} +16 -16
  8. package/dist/chunk-37LLKM73.js +124 -0
  9. package/dist/{chunk-BMTHAVMS.js → chunk-3HGBIUM5.js} +22 -19
  10. package/dist/chunk-3UGGMFJJ.js +22 -0
  11. package/dist/{chunk-3HUWAJQH.js → chunk-42K3BJJH.js} +93 -76
  12. package/dist/{chunk-ST5FC2W3.js → chunk-43P4U7CB.js} +20 -11
  13. package/dist/chunk-4RYTTD4D.js +53 -0
  14. package/dist/{chunk-WSRIF6K4.js → chunk-4UU622RK.js} +5 -4
  15. package/dist/chunk-52E6EKZV.js +72 -0
  16. package/dist/chunk-6IUFHPMV.js +62 -0
  17. package/dist/chunk-6KXXZXSO.js +475 -0
  18. package/dist/chunk-72KHWZMN.js +87 -0
  19. package/dist/{chunk-ZCYWDKYP.js → chunk-A556KALN.js} +14 -13
  20. package/dist/{chunk-UFR6G6BL.js → chunk-ABTUEIRC.js} +554 -254
  21. package/dist/chunk-ALPTHSUT.js +132 -0
  22. package/dist/{chunk-PEUP4MZR.js → chunk-AWJNAGPE.js} +6 -3
  23. package/dist/chunk-BJAN3RMY.js +48 -0
  24. package/dist/{chunk-HNRVSBRK.js → chunk-BN3Q7UEC.js} +20 -17
  25. package/dist/chunk-BZOMEG3X.js +412 -0
  26. package/dist/{chunk-ZYCSYJWX.js → chunk-COSLGSVO.js} +14 -24
  27. package/dist/{chunk-KZBZNTM4.js → chunk-CTY2WZQK.js} +9 -13
  28. package/dist/chunk-DH6WPL3X.js +47 -0
  29. package/dist/chunk-DPLFCKXP.js +80 -0
  30. package/dist/{chunk-K2U7L4RU.js → chunk-E3FJUPLT.js} +15 -21
  31. package/dist/chunk-E7NDOZ27.js +428 -0
  32. package/dist/{chunk-TBQ5BU3Q.js → chunk-F42QKWBB.js} +18 -18
  33. package/dist/chunk-F4J6XCHT.js +73 -0
  34. package/dist/chunk-FB3UDZAV.js +168 -0
  35. package/dist/chunk-FJXPMA63.js +48 -0
  36. package/dist/chunk-FNJL6Z5C.js +71 -0
  37. package/dist/chunk-G63MXDX2.js +45 -0
  38. package/dist/{chunk-VFFOT7KD.js → chunk-G66HRVDW.js} +1 -1
  39. package/dist/{chunk-AXTLPJ2F.js → chunk-H2C4QUTG.js} +8 -7
  40. package/dist/{chunk-H3IPLBXQ.js → chunk-HRKVAXNN.js} +17 -14
  41. package/dist/chunk-HSCTPDEU.js +126 -0
  42. package/dist/{chunk-UXCWSWWX.js → chunk-HSMG6U7J.js} +8 -7
  43. package/dist/chunk-I5LELJSK.js +22 -0
  44. package/dist/{chunk-7CXMMC5S.js → chunk-JN4WZCR7.js} +5 -4
  45. package/dist/{chunk-7QZSDU52.js → chunk-K36EOII3.js} +5 -4
  46. package/dist/chunk-KLFBAFXD.js +25 -0
  47. package/dist/{chunk-355VG7EO.js → chunk-LONQWRTR.js} +107 -77
  48. package/dist/{chunk-Z5TFZQ5U.js → chunk-LORGE2NB.js} +68 -62
  49. package/dist/{chunk-LY2GQ32S.js → chunk-MEAO33XW.js} +22 -20
  50. package/dist/{chunk-OD2MNYXD.js → chunk-MR5KIFI7.js} +23 -22
  51. package/dist/{chunk-2VUUMXAQ.js → chunk-N2UHAQXC.js} +18 -11
  52. package/dist/chunk-NG2X3SMF.js +91 -0
  53. package/dist/chunk-OFJIG4K3.js +6482 -0
  54. package/dist/chunk-P74GTK23.js +91 -0
  55. package/dist/chunk-PKM3JOKQ.js +62 -0
  56. package/dist/{chunk-NDHXM4PL.js → chunk-Q3XQPNF6.js} +12 -12
  57. package/dist/{chunk-RXHTGX7C.js → chunk-Q5NZNXJE.js} +6 -10
  58. package/dist/chunk-QEKVZ7BX.js +57 -0
  59. package/dist/chunk-QNWCBPVO.js +215 -0
  60. package/dist/{chunk-US6QZICZ.js → chunk-RPJR3S5S.js} +32 -18
  61. package/dist/chunk-RPSUFZAG.js +3307 -0
  62. package/dist/chunk-RRI23NK2.js +40 -0
  63. package/dist/{chunk-6EWHKL7Z.js → chunk-SXYQL4GK.js} +7 -6
  64. package/dist/{chunk-ZI6PKVXG.js → chunk-TMPBGXT4.js} +6 -5
  65. package/dist/{chunk-UZM6OSW5.js → chunk-UPHB5HWO.js} +15 -13
  66. package/dist/chunk-UTSSDFQL.js +64 -0
  67. package/dist/chunk-V5ADM3WC.js +741 -0
  68. package/dist/{chunk-25BAMW5X.js → chunk-VIEKOGKG.js} +18 -2
  69. package/dist/chunk-VUV5U4J5.js +117 -0
  70. package/dist/{chunk-LXS3NJYD.js → chunk-VZEJ2ZHE.js} +14 -15
  71. package/dist/chunk-W2QPNAZ3.js +58 -0
  72. package/dist/chunk-YLUB6252.js +45 -0
  73. package/dist/{chunk-Z4Z24FWO.js → chunk-YNCYMWER.js} +8 -5
  74. package/dist/chunk-YXOGRERG.js +91 -0
  75. package/dist/index.js +39 -36
  76. package/package.json +31 -16
  77. package/templates/none/src/main.ts +4 -0
  78. package/templates/none/vite.config.ts +0 -2
  79. package/templates/phaser/src/main.ts +0 -1
  80. package/templates/phaser/src/scenes/game-scene.ts +10 -8
  81. package/templates/phaser/vite.config.ts +0 -2
  82. package/templates/react-r3f/src/app.tsx +3 -1
  83. package/templates/react-r3f/src/main.tsx +1 -0
  84. package/templates/react-r3f/vite.config.ts +0 -2
  85. package/templates/threejs/src/main.ts +10 -1
  86. package/templates/threejs/vite.config.ts +0 -2
  87. package/LICENSE +0 -21
  88. package/dist/chunk-J6PKNPI2.js +0 -26
@@ -1,14 +1,12 @@
1
1
  import type { GameObjects, Input } from "phaser";
2
2
  import { Scene } from "phaser";
3
3
 
4
- // World pixels per second.
5
4
  const SPEED = 240;
6
5
  const SIZE = 48;
7
6
 
8
7
  type Direction = "up" | "down" | "left" | "right";
9
8
 
10
- const clamp = (value: number, min: number, max: number): number =>
11
- Math.min(max, Math.max(min, value));
9
+ const clamp = (value: number, min: number, max: number) => Math.min(max, Math.max(min, value));
12
10
 
13
11
  /** A square you drive with the arrow keys or WASD. Replace it with your game. */
14
12
  export class GameScene extends Scene {
@@ -19,7 +17,7 @@ export class GameScene extends Scene {
19
17
  super("game");
20
18
  }
21
19
 
22
- create(): void {
20
+ create() {
23
21
  const { width, height } = this.scale;
24
22
  const font = { color: "#ffffff", fontFamily: "system-ui, sans-serif" };
25
23
  this.add.text(width / 2, 48, "__VG_SLUG__", { ...font, fontSize: "32px" }).setOrigin(0.5);
@@ -34,6 +32,7 @@ export class GameScene extends Scene {
34
32
  this.player = this.add.rectangle(width / 2, height / 2, SIZE, SIZE, 0x5b_e3_ff);
35
33
 
36
34
  const { keyboard } = this.input;
35
+
37
36
  if (keyboard) {
38
37
  this.keys = {
39
38
  down: [keyboard.addKey("DOWN"), keyboard.addKey("S")],
@@ -44,19 +43,22 @@ export class GameScene extends Scene {
44
43
  }
45
44
  }
46
45
 
47
- override update(_time: number, delta: number): void {
46
+ override update(_time: number, delta: number) {
48
47
  const { keys, player } = this;
48
+
49
49
  if (!keys || !player) {
50
50
  return;
51
51
  }
52
- const held = (direction: Direction): number =>
53
- keys[direction].some((key) => key.isDown) ? 1 : 0;
52
+
53
+ const held = (direction: Direction) => (keys[direction].some((key) => key.isDown) ? 1 : 0);
54
+
54
55
  const dx = held("right") - held("left");
55
56
  const dy = held("down") - held("up");
57
+
56
58
  if (dx === 0 && dy === 0) {
57
59
  return;
58
60
  }
59
- // Normalised so a diagonal is no faster than a straight line.
61
+
60
62
  const step = (SPEED * delta) / 1000 / Math.hypot(dx, dy);
61
63
  const half = SIZE / 2;
62
64
  player.x = clamp(player.x + dx * step, half, this.scale.width - half);
@@ -1,7 +1,5 @@
1
1
  import { defineConfig } from "vite";
2
2
 
3
- // A relative base keeps built asset URLs relative, so the bundle works wherever it is
4
- // hosted — including {slug}.vibedgames.com after `vg deploy ./dist`.
5
3
  export default defineConfig({
6
4
  base: "./",
7
5
  server: { port: 5173 },
@@ -3,17 +3,19 @@ import { Canvas, useFrame } from "@react-three/fiber";
3
3
  import { useRef } from "react";
4
4
  import type { Mesh } from "three";
5
5
 
6
- // Replace the cube with your game.
7
6
  const SpinningCube = () => {
8
7
  const ref = useRef<Mesh>(null);
9
8
  useFrame((_state, delta) => {
10
9
  const mesh = ref.current;
10
+
11
11
  if (!mesh) {
12
12
  return;
13
13
  }
14
+
14
15
  mesh.rotation.x += delta * 0.5;
15
16
  mesh.rotation.y += delta;
16
17
  });
18
+
17
19
  return (
18
20
  <mesh ref={ref}>
19
21
  <boxGeometry args={[1, 1, 1]} />
@@ -4,6 +4,7 @@ import { createRoot } from "react-dom/client";
4
4
  import { App } from "./app";
5
5
 
6
6
  const root = document.querySelector("#root");
7
+
7
8
  if (!root) {
8
9
  throw new Error("index.html is missing its #root element");
9
10
  }
@@ -1,8 +1,6 @@
1
1
  import react from "@vitejs/plugin-react";
2
2
  import { defineConfig } from "vite";
3
3
 
4
- // A relative base keeps built asset URLs relative, so the bundle works wherever it is
5
- // hosted — including {slug}.vibedgames.com after `vg deploy ./dist`.
6
4
  export default defineConfig({
7
5
  base: "./",
8
6
  plugins: [react()],
@@ -11,24 +11,33 @@ import {
11
11
  } from "three";
12
12
 
13
13
  const scene = new Scene();
14
+
14
15
  scene.background = new Color("#0e1020");
15
16
 
16
17
  const camera = new PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100);
18
+
17
19
  camera.position.set(0, 1.5, 4);
20
+
18
21
  camera.lookAt(0, 0, 0);
19
22
 
20
23
  const renderer = new WebGLRenderer({ antialias: true });
24
+
21
25
  renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
26
+
22
27
  renderer.setSize(window.innerWidth, window.innerHeight);
28
+
23
29
  document.body.append(renderer.domElement);
24
30
 
25
31
  scene.add(new AmbientLight(0xff_ff_ff, 0.4));
32
+
26
33
  const sun = new DirectionalLight(0xff_ff_ff, 2);
34
+
27
35
  sun.position.set(3, 5, 2);
36
+
28
37
  scene.add(sun);
29
38
 
30
- // Replace the cube with your game.
31
39
  const cube = new Mesh(new BoxGeometry(1, 1, 1), new MeshStandardMaterial({ color: "#5be3ff" }));
40
+
32
41
  scene.add(cube);
33
42
 
34
43
  window.addEventListener("resize", () => {
@@ -1,7 +1,5 @@
1
1
  import { defineConfig } from "vite";
2
2
 
3
- // A relative base keeps built asset URLs relative, so the bundle works wherever it is
4
- // hosted — including {slug}.vibedgames.com after `vg deploy ./dist`.
5
3
  export default defineConfig({
6
4
  base: "./",
7
5
  server: { port: 5173 },
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Kaiyu Hsu
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,26 +0,0 @@
1
- import { createRequire as __createRequire } from "node:module";
2
- import { dirname as __pathDirname } from "node:path";
3
- import { fileURLToPath as __fileURLToPath } from "node:url";
4
- const require = __createRequire(import.meta.url);
5
- var __filename = __fileURLToPath(import.meta.url);
6
- var __dirname = __pathDirname(__filename);
7
-
8
- // src/lib/types.ts
9
- var isJsonObject = (value) => (
10
- // Object() is the identity only on objects; arrays are split off explicitly.
11
- Object(value) === value && !Array.isArray(value)
12
- );
13
- var isJsonString = (value) => (
14
- // String() is the identity only on strings.
15
- String(value) === value
16
- );
17
- var isJsonNumber = (value) => (
18
- // JSON cannot encode NaN/Infinity, so isFinite matches every JSON number.
19
- Number.isFinite(value)
20
- );
21
-
22
- export {
23
- isJsonObject,
24
- isJsonString,
25
- isJsonNumber
26
- };