@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.
- package/README.md +74 -54
- package/front.js +2 -2
- 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
|
|
4
|
-
|
|
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
|
+

|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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
|
-
|
|
26
|
+
Add the **rallyx** channel to a tab and start it. The setup asks for:
|
|
18
27
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
40
|
+
The game keeps its 4:3 proportions and fits the tab.
|
|
30
41
|
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
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
|
-
##
|
|
59
|
+
## Screenshots
|
|
42
60
|
|
|
43
|
-
|
|
44
|
-
|-----|--------|
|
|
45
|
-
| ← ↑ → ↓ | Drive |
|
|
46
|
-
| Ctrl | Drop smoke |
|
|
47
|
-
| Space / Ctrl | Start (on title screen) |
|
|
61
|
+
The setup:
|
|
48
62
|
|
|
49
|
-
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
The title screen:
|
|
66
|
+
|
|
67
|
+

|
|
68
|
+
|
|
69
|
+
Full screen:
|
|
70
|
+
|
|
71
|
+

|
|
72
|
+
|
|
73
|
+
## Building
|
|
50
74
|
|
|
51
75
|
```
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
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
|
-
|
|
76
|
-
|
|
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 === "
|
|
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:
|
|
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.
|
|
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
|
}
|