minimojs 1.0.0-alpha.40 → 1.0.0-alpha.41
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.
|
@@ -293,7 +293,8 @@ export declare class Room {
|
|
|
293
293
|
*
|
|
294
294
|
* {@link Multiplayer.lobby} shows the lobby over the game, in HTML: creating a
|
|
295
295
|
* room, joining one by its code, sharing its link, and waiting for the others
|
|
296
|
-
* until the host starts. A player who
|
|
296
|
+
* until the host starts. A player who opened the room's link lands in it as
|
|
297
|
+
* soon as the game calls it.
|
|
297
298
|
*
|
|
298
299
|
* ```js
|
|
299
300
|
* import { Multiplayer } from "https://cdn.jsdelivr.net/npm/minimojs@<version>/dist/minimo-multiplayer.js";
|
|
@@ -309,15 +310,27 @@ export declare class Room {
|
|
|
309
310
|
* const choice = await room.showResults(); // "rematch" or "leave"
|
|
310
311
|
* ```
|
|
311
312
|
*
|
|
312
|
-
* A
|
|
313
|
-
*
|
|
314
|
-
*
|
|
313
|
+
* A player who opens a room's link has already chosen to play online and
|
|
314
|
+
* which room to join. So a game asks {@link Multiplayer.pendingRoom} as soon
|
|
315
|
+
* as its assets are loaded, before showing anything. When a room is pending,
|
|
316
|
+
* it skips every screen that only leads to a room or that the host decides,
|
|
317
|
+
* such as a title screen, menus, playing alone or online, creating or joining,
|
|
318
|
+
* the mode, the difficulty, the rules, or the level, and shows only the
|
|
319
|
+
* choices that are the player's own, such as a character or a color, before
|
|
320
|
+
* {@link Multiplayer.lobby} or after it:
|
|
315
321
|
*
|
|
316
322
|
* ```js
|
|
317
323
|
* const pending = await mp.pendingRoom();
|
|
318
|
-
* if (pending)
|
|
319
|
-
*
|
|
324
|
+
* if (pending) {
|
|
325
|
+
* await chooseCharacter(); // only the player's own choices
|
|
326
|
+
* room = await mp.lobby(); // that room's lobby, or its game in progress
|
|
327
|
+
* } else showWelcome(); // Play online, then mp.lobby() to create or join
|
|
320
328
|
* ```
|
|
329
|
+
*
|
|
330
|
+
* What every player must share is the host's choice and travels in the
|
|
331
|
+
* room's state. A player returning to a room after a reload (`invited` is
|
|
332
|
+
* false) is asked again only what the game could not keep. When the player
|
|
333
|
+
* closes the lobby, show the welcome screen.
|
|
321
334
|
*/
|
|
322
335
|
export declare class Multiplayer {
|
|
323
336
|
/**
|
|
@@ -757,7 +757,8 @@ export class Room {
|
|
|
757
757
|
*
|
|
758
758
|
* {@link Multiplayer.lobby} shows the lobby over the game, in HTML: creating a
|
|
759
759
|
* room, joining one by its code, sharing its link, and waiting for the others
|
|
760
|
-
* until the host starts. A player who
|
|
760
|
+
* until the host starts. A player who opened the room's link lands in it as
|
|
761
|
+
* soon as the game calls it.
|
|
761
762
|
*
|
|
762
763
|
* ```js
|
|
763
764
|
* import { Multiplayer } from "https://cdn.jsdelivr.net/npm/minimojs@<version>/dist/minimo-multiplayer.js";
|
|
@@ -773,15 +774,27 @@ export class Room {
|
|
|
773
774
|
* const choice = await room.showResults(); // "rematch" or "leave"
|
|
774
775
|
* ```
|
|
775
776
|
*
|
|
776
|
-
* A
|
|
777
|
-
*
|
|
778
|
-
*
|
|
777
|
+
* A player who opens a room's link has already chosen to play online and
|
|
778
|
+
* which room to join. So a game asks {@link Multiplayer.pendingRoom} as soon
|
|
779
|
+
* as its assets are loaded, before showing anything. When a room is pending,
|
|
780
|
+
* it skips every screen that only leads to a room or that the host decides,
|
|
781
|
+
* such as a title screen, menus, playing alone or online, creating or joining,
|
|
782
|
+
* the mode, the difficulty, the rules, or the level, and shows only the
|
|
783
|
+
* choices that are the player's own, such as a character or a color, before
|
|
784
|
+
* {@link Multiplayer.lobby} or after it:
|
|
779
785
|
*
|
|
780
786
|
* ```js
|
|
781
787
|
* const pending = await mp.pendingRoom();
|
|
782
|
-
* if (pending)
|
|
783
|
-
*
|
|
788
|
+
* if (pending) {
|
|
789
|
+
* await chooseCharacter(); // only the player's own choices
|
|
790
|
+
* room = await mp.lobby(); // that room's lobby, or its game in progress
|
|
791
|
+
* } else showWelcome(); // Play online, then mp.lobby() to create or join
|
|
784
792
|
* ```
|
|
793
|
+
*
|
|
794
|
+
* What every player must share is the host's choice and travels in the
|
|
795
|
+
* room's state. A player returning to a room after a reload (`invited` is
|
|
796
|
+
* false) is asked again only what the game could not keep. When the player
|
|
797
|
+
* closes the lobby, show the welcome screen.
|
|
785
798
|
*/
|
|
786
799
|
export class Multiplayer {
|
|
787
800
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minimojs",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.41",
|
|
4
4
|
"description": "MinimoJS v1 — ultra-minimal, flat, deterministic 2D web game engine. Image-first sprites with emoji as a zero-asset alternative, rAF loop, TypeScript-first, LLM-friendly.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/minimo.js",
|