@jfvilas/kwirth-plugin-rallyx 0.1.3 → 0.1.4

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 (3) hide show
  1. package/README.md +74 -54
  2. package/front.js +2 -2
  3. package/package.json +6 -2
package/README.md CHANGED
@@ -1,76 +1,96 @@
1
- # Rally-X
1
+ # Rally-X — a channel plugin for Kwirth
2
2
 
3
- A Rally-X arcade game channel plugin for [Kwirth](https://kwirthmagnify.dev), the Kubernetes
4
- observability and operations platform ([source](https://github.com/kwirthmagnify/kwirth)).
3
+ A Rally-X arcade game inside a [Kwirth](https://kwirthmagnify.dev) tab: drive your blue car through the maze,
4
+ pick up the flags before the fuel runs out, and lose the red cars behind a cloud of smoke. A homebrew
5
+ recreation of the 1980 arcade classic, with a high-score table shared by everyone on the cluster.
6
+
7
+ ![A round in play](https://raw.githubusercontent.com/jfvilas/kwirth/master/plugins/rallyx/docs/screenshots/game.png)
8
+
9
+ - Kwirth: https://kwirthmagnify.dev — source at https://github.com/kwirthmagnify/kwirth
10
+ - Plugin source: https://github.com/jfvilas/kwirth (folder `plugins/rallyx`)
11
+ - The game is MIT licensed, Copyright (c) 2017 Marco Parenzan; see [NOTICE.md](NOTICE.md).
5
12
 
6
13
  ## What it is
7
14
 
8
- This plugin runs a homebrew recreation of the classic 1980s Rally-X arcade game
9
- (originally by Midway/Namco) inside a Kwirth tab. The game is built with Phaser
10
- 2.x and runs in an isolated iframe, so its globals never clash with Kwirth's
11
- React/MUI.
15
+ A **standalone channel**: it reads nothing of the cluster, asks for no cluster scope and selects no pods.
16
+ Picking it switches the view to `none` on its own.
17
+
18
+ The game is built with Phaser 2 and runs in an isolated iframe, so its globals never clash with Kwirth's.
19
+ Phaser, RequireJS and every asset travel inside the plugin's `front.js`, so it needs no network once
20
+ installed. The iframe **survives tab switches**: switching away hides it, coming back puts it in place again,
21
+ and only stopping the channel destroys it. A small bridge reports the game's state to the tab, which shows
22
+ it in the bar above the game: score, lives, round, fuel and best score.
12
23
 
13
- The game state (score, lives, round, fuel) is displayed in a HUD bar above the
14
- game area. High scores are persisted in a Kubernetes ConfigMap, shared across
15
- all users of the cluster.
24
+ ## Using it
16
25
 
17
- ## How it works
26
+ Add the **rallyx** channel to a tab and start it. The setup asks for:
18
27
 
19
- - The game (Phaser + RequireJS + all assets) is bundled into the plugin's
20
- `front.js` as text and base64. At runtime, it is injected into an iframe via
21
- `srcdoc` — no network requests needed.
22
- - The iframe survives tab switches: switching away hides it, switching back
23
- repositions it. Only stopping the channel destroys it.
24
- - A `postMessage` bridge reports game state to the plugin for HUD display and
25
- score persistence.
26
- - High scores are stored via the back channel's `writeStorage` (ConfigMap
27
- `kwirth-store-channel-rallyx-scores`).
28
+ | Field | Meaning |
29
+ |---|---|
30
+ | **Notify a sender when the record is beaten** | Optional: one of Kwirth's senders gets a message when someone takes the top of the table |
31
+ | **Pause when the tab loses focus** | The game freezes when you click elsewhere, and goes on when you click it again |
32
+
33
+ | Key | Action |
34
+ |---|---|
35
+ | Arrows | Drive |
36
+ | Ctrl | Smoke screen |
37
+ | Space / Ctrl | Start, on the title screen |
38
+ | Ctrl+Shift+Enter | Kwirth's full screen, also while the game has the focus |
28
39
 
29
- ## Installation
40
+ The game keeps its 4:3 proportions and fits the tab.
30
41
 
31
- Rally-X is published to npm as `@jfvilas/kwirth-plugin-rallyx` and listed in the **jfvilas marketplace**.
32
- If your Kwirth does not list it yet, add this manifest as a marketplace:
42
+ ## The high-score table
43
+
44
+ It lives in the cluster, not in the browser: the back end stores it in a ConfigMap,
45
+ `kwirth-store-channel-rallyx-scores`, so every user of that Kwirth sees the same table and it survives
46
+ changing machines.
47
+
48
+ ## Installing it in Kwirth
49
+
50
+ It is published on npmjs as `@jfvilas/kwirth-plugin-rallyx` and listed in the jfvilas marketplace. If your
51
+ Kwirth does not list it yet, add it as a marketplace with this manifest URL:
33
52
 
34
53
  ```
35
54
  https://raw.githubusercontent.com/jfvilas/kwirth/master/manifest.json
36
55
  ```
37
56
 
38
- Then install **Rally-X** from the plugin manager and add the channel to a tab. Source code at
39
- [github.com/jfvilas/kwirth](https://github.com/jfvilas/kwirth) (folder `plugins/rallyx`).
57
+ Then install `rallyx` from the plugin manager. No restart is needed and it depends on no other extension.
40
58
 
41
- ## Controls
59
+ ## Screenshots
42
60
 
43
- | Key | Action |
44
- |-----|--------|
45
- | ← ↑ → ↓ | Drive |
46
- | Ctrl | Drop smoke |
47
- | Space / Ctrl | Start (on title screen) |
61
+ The setup:
48
62
 
49
- ## Architecture
63
+ ![Setup](https://raw.githubusercontent.com/jfvilas/kwirth/master/plugins/rallyx/docs/screenshots/setup.png)
64
+
65
+ The title screen:
66
+
67
+ ![Title](https://raw.githubusercontent.com/jfvilas/kwirth/master/plugins/rallyx/docs/screenshots/title.png)
68
+
69
+ Full screen:
70
+
71
+ ![Full screen](https://raw.githubusercontent.com/jfvilas/kwirth/master/plugins/rallyx/docs/screenshots/fullscreen.png)
72
+
73
+ ## Building
50
74
 
51
75
  ```
52
- src/
53
- ├── back/index.ts — back channel: score persistence (ConfigMap)
54
- ├── common/RallyxTypes.ts — shared types
55
- ├── front/
56
- │ ├── index.ts — registers RallyxChannel on window.__kwirth_plugins__
57
- │ ├── RallyxChannel.tsx — IChannel impl (lifecycle, message routing)
58
- │ ├── RallyxMachine.ts — iframe manager (builds HTML, manages lifecycle)
59
- │ ├── RallyxTabContent.tsx — tab UI (HUD, game area, scores overlay)
60
- │ ├── RallyxSetup.tsx — setup dialog (sender notification, pause-on-blur)
61
- │ ├── RallyxConfig.ts — config classes
62
- │ ├── RallyxData.ts — channel state (survives tab switches)
63
- │ ├── RallyxScores.ts — score store (back + local fallback)
64
- │ ├── icons.tsx — plugin icon
65
- │ └── rallyx/
66
- │ ├── phaser.txt — Phaser 2.x library
67
- │ ├── require.txt — RequireJS library
68
- │ ├── js/*.txt — game modules (named AMD defines)
69
- │ └── assets/ — game assets (PNGs, tilemap JSON)
70
- └── types/assets.d.ts — ambient declarations for non-TS imports
76
+ npm install
77
+ npm run build # typecheck + dist/
78
+ npm run watch # fast rebuild without typecheck
79
+ npm test # unit tests
71
80
  ```
72
81
 
73
- ## License
82
+ The e2e (`e2e/`, Playwright) runs against a live Kwirth with its own `.creds.json`;
83
+ `tests/zz-readme.spec.ts` takes the screenshots of this README.
74
84
 
75
- The upstream game is MIT licensed (Copyright (c) 2017 Marco Parenzan).
76
- See [NOTICE.md](NOTICE.md) for full attribution.
85
+ ```
86
+ src/
87
+ ├── back/index.ts back channel: the score table (ConfigMap)
88
+ ├── common/RallyxTypes.ts shared types
89
+ └── front/
90
+ ├── RallyxChannel.tsx the channel: lifecycle and messages
91
+ ├── RallyxMachine.ts the iframe: builds its HTML, keeps it alive
92
+ ├── RallyxTabContent.tsx the tab: HUD, game area, score panel
93
+ ├── RallyxSetup.tsx the setup dialog
94
+ ├── RallyxScores.ts the score store (back, with a local fallback)
95
+ └── rallyx/ Phaser, RequireJS, the game modules and its assets
96
+ ```
package/front.js CHANGED
@@ -4076,9 +4076,9 @@ var ASSETS = ${buildAssetsMap()};
4076
4076
  // iframe: after using a Kwirth menu, clicking the game left the keyboard outside it. It is asked for here.
4077
4077
  window.addEventListener("pointerdown", function () { window.focus(); }, true);
4078
4078
  window.addEventListener("keydown", function (e) {
4079
- if (e.key === "F11" && e.ctrlKey && e.altKey && !e.shiftKey) {
4079
+ if (e.key === "Enter" && e.ctrlKey && e.shiftKey && !e.altKey && !e.metaKey) {
4080
4080
  e.preventDefault();
4081
- window.parent.postMessage({ type: "${FORWARD_KEY_MESSAGE}", key: e.key, ctrlKey: true, altKey: true, shiftKey: false }, "*");
4081
+ window.parent.postMessage({ type: "${FORWARD_KEY_MESSAGE}", key: e.key, ctrlKey: true, altKey: false, shiftKey: true }, "*");
4082
4082
  }
4083
4083
  }, true);
4084
4084
  `;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "id": "rallyx",
5
5
  "name": "@jfvilas/kwirth-plugin-rallyx",
6
6
  "displayName": "Rally-X",
7
- "version": "0.1.3",
7
+ "version": "0.1.4",
8
8
  "description": "Rally-X arcade game channel plugin for Kwirth - a classic 1980s rally maze game playable in a Kwirth tab, with per-tab persistent game state and high-score table",
9
9
  "icon": "<svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><circle cx='12' cy='12' r='3'/><path d='M12 9V3M9 12H3M15 12h6'/></svg>",
10
10
  "website": "https://kwirthmagnify.dev",
@@ -14,5 +14,9 @@
14
14
  "directory": "plugins/rallyx"
15
15
  },
16
16
  "requiresRestart": false,
17
- "requiresExtension": []
17
+ "requiresExtension": [],
18
+ "tags": [
19
+ "game",
20
+ "arcade"
21
+ ]
18
22
  }