@energy8platform/game-engine 0.15.2 → 0.16.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.
- package/README.md +22 -12
- package/dist/assets.d.ts +2 -14
- package/dist/core.cjs.js +16 -201
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.d.ts +4 -35
- package/dist/core.esm.js +12 -197
- package/dist/core.esm.js.map +1 -1
- package/dist/debug.cjs.js +5 -233
- package/dist/debug.cjs.js.map +1 -1
- package/dist/debug.d.ts +2 -140
- package/dist/debug.esm.js +2 -233
- package/dist/debug.esm.js.map +1 -1
- package/dist/index.cjs.js +21 -432
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +10 -195
- package/dist/index.esm.js +14 -429
- package/dist/index.esm.js.map +1 -1
- package/dist/lua.cjs.js +7 -1493
- package/dist/lua.cjs.js.map +1 -1
- package/dist/lua.d.ts +1 -403
- package/dist/lua.esm.js +1 -1483
- package/dist/lua.esm.js.map +1 -1
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.d.ts +4 -35
- package/dist/react.esm.js.map +1 -1
- package/dist/vite.cjs.js +19 -175
- package/dist/vite.cjs.js.map +1 -1
- package/dist/vite.d.ts +8 -3
- package/dist/vite.esm.js +10 -173
- package/dist/vite.esm.js.map +1 -1
- package/package.json +6 -16
- package/src/core/GameApplication.ts +14 -18
- package/src/debug/index.ts +4 -2
- package/src/index.ts +3 -3
- package/src/loading/LoadingScene.ts +1 -1
- package/src/loading/index.ts +9 -2
- package/src/lua/index.ts +3 -31
- package/src/types.ts +16 -41
- package/src/vite/index.ts +13 -196
- package/bin/simulate.ts +0 -139
- package/scripts/install-simulate.mjs +0 -101
- package/src/debug/DevBridge.ts +0 -305
- package/src/loading/CSSPreloader.ts +0 -129
- package/src/loading/logo.ts +0 -95
- package/src/lua/ActionRouter.ts +0 -132
- package/src/lua/LuaEngine.ts +0 -412
- package/src/lua/LuaEngineAPI.ts +0 -314
- package/src/lua/NativeSimulationRunner.ts +0 -367
- package/src/lua/ParallelSimulationRunner.ts +0 -156
- package/src/lua/PersistentState.ts +0 -80
- package/src/lua/SessionManager.ts +0 -227
- package/src/lua/SimulationRunner.ts +0 -192
- package/src/lua/SimulationWorker.ts +0 -44
- package/src/lua/fengari.d.ts +0 -10
- package/src/lua/types.ts +0 -149
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Container, ApplicationOptions, Application, Texture, AnimatedSprite, Spritesheet, TextStyle, ColorSource } from 'pixi.js';
|
|
2
|
-
import { CasinoGameSDK, InitData, GameConfigData, SessionData
|
|
2
|
+
import { CasinoGameSDK, InitData, GameConfigData, SessionData } from '@energy8platform/game-sdk';
|
|
3
3
|
export { AnywhereWinData, BalanceData, BridgeDestroyedError, BridgeNotReadyError, GameConfigData, InitData, PaylineData, PlayParams, PlayResultData, SDKError, SessionData, SymbolData, TimeoutError, WinLineData } from '@energy8platform/game-sdk';
|
|
4
|
+
import { LoadingScreenConfig, AssetManifest, PlatformSession } from '@energy8platform/platform-core';
|
|
5
|
+
export { AssetBundle, AssetEntry, AssetManifest, LoadingScreenConfig } from '@energy8platform/platform-core';
|
|
6
|
+
export { DevBridge, DevBridgeConfig } from '@energy8platform/platform-core/dev-bridge';
|
|
7
|
+
export { ActionDefinition, GameDefinition, LuaEngineConfig, LuaPlayResult, TransitionRule } from '@energy8platform/platform-core/lua';
|
|
4
8
|
|
|
5
9
|
declare enum ScaleMode {
|
|
6
10
|
/** Fit inside container, maintain aspect ratio (letterbox/pillarbox) */
|
|
@@ -15,41 +19,7 @@ declare enum Orientation {
|
|
|
15
19
|
PORTRAIT = "portrait",
|
|
16
20
|
ANY = "any"
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
/** Background color (hex number or CSS string) */
|
|
20
|
-
backgroundColor?: number | string;
|
|
21
|
-
/** Background gradient (CSS string applied to the CSS preloader) */
|
|
22
|
-
backgroundGradient?: string;
|
|
23
|
-
/** Logo texture alias (must be in 'preload' bundle) */
|
|
24
|
-
logoAsset?: string;
|
|
25
|
-
/** Logo scale (default: 1) */
|
|
26
|
-
logoScale?: number;
|
|
27
|
-
/** Show percentage text below the loader bar */
|
|
28
|
-
showPercentage?: boolean;
|
|
29
|
-
/** Custom progress text formatter */
|
|
30
|
-
progressTextFormatter?: (progress: number) => string;
|
|
31
|
-
/** Show "Tap to start" after loading (needed for mobile audio unlock) */
|
|
32
|
-
tapToStart?: boolean;
|
|
33
|
-
/** "Tap to start" label text */
|
|
34
|
-
tapToStartText?: string;
|
|
35
|
-
/** Minimum display time in ms (so the user sees the brand, even if loading is fast) */
|
|
36
|
-
minDisplayTime?: number;
|
|
37
|
-
/** CSS preloader custom HTML (shown before PixiJS is ready) */
|
|
38
|
-
cssPreloaderHTML?: string;
|
|
39
|
-
}
|
|
40
|
-
interface AssetEntry {
|
|
41
|
-
alias: string;
|
|
42
|
-
src: string | string[];
|
|
43
|
-
/** Optional data to pass to the loader */
|
|
44
|
-
data?: Record<string, unknown>;
|
|
45
|
-
}
|
|
46
|
-
interface AssetBundle {
|
|
47
|
-
name: string;
|
|
48
|
-
assets: AssetEntry[];
|
|
49
|
-
}
|
|
50
|
-
interface AssetManifest {
|
|
51
|
-
bundles: AssetBundle[];
|
|
52
|
-
}
|
|
22
|
+
|
|
53
23
|
interface AudioConfig {
|
|
54
24
|
/** Default volumes per category (0..1) */
|
|
55
25
|
music?: number;
|
|
@@ -725,6 +695,8 @@ declare class GameApplication extends EventEmitter<GameEngineEvents> {
|
|
|
725
695
|
fpsOverlay: FPSOverlay | null;
|
|
726
696
|
/** Data received from SDK initialization */
|
|
727
697
|
initData: InitData | null;
|
|
698
|
+
/** Platform session (SDK + optional DevBridge). null until start() runs. */
|
|
699
|
+
platformSession: PlatformSession | null;
|
|
728
700
|
/** Configuration */
|
|
729
701
|
readonly config: GameApplicationConfig;
|
|
730
702
|
private _running;
|
|
@@ -2194,162 +2166,5 @@ declare class LoadingScene extends Scene {
|
|
|
2194
2166
|
private transitionToGame;
|
|
2195
2167
|
}
|
|
2196
2168
|
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
type: 'SLOT' | 'TABLE';
|
|
2200
|
-
actions: Record<string, ActionDefinition>;
|
|
2201
|
-
bet_levels?: number[] | BetLevelsConfig;
|
|
2202
|
-
max_win?: MaxWinConfig;
|
|
2203
|
-
buy_bonus?: BuyBonusConfig;
|
|
2204
|
-
ante_bet?: AnteBetConfig;
|
|
2205
|
-
persistent_state?: PersistentStateConfig;
|
|
2206
|
-
}
|
|
2207
|
-
interface BetLevelsConfig {
|
|
2208
|
-
levels?: number[];
|
|
2209
|
-
min?: number;
|
|
2210
|
-
max?: number;
|
|
2211
|
-
}
|
|
2212
|
-
interface MaxWinConfig {
|
|
2213
|
-
multiplier?: number;
|
|
2214
|
-
fixed?: number;
|
|
2215
|
-
}
|
|
2216
|
-
interface BuyBonusConfig {
|
|
2217
|
-
modes: Record<string, BuyBonusMode>;
|
|
2218
|
-
}
|
|
2219
|
-
interface BuyBonusMode {
|
|
2220
|
-
cost_multiplier: number;
|
|
2221
|
-
/** Distribution of forced scatter counts. Optional — if omitted, Lua script handles bonus setup itself. */
|
|
2222
|
-
scatter_distribution?: Record<string, number>;
|
|
2223
|
-
/** Optional description */
|
|
2224
|
-
description?: string;
|
|
2225
|
-
}
|
|
2226
|
-
interface AnteBetConfig {
|
|
2227
|
-
cost_multiplier: number;
|
|
2228
|
-
}
|
|
2229
|
-
interface PersistentStateConfig {
|
|
2230
|
-
vars: string[];
|
|
2231
|
-
exposed_vars: string[];
|
|
2232
|
-
}
|
|
2233
|
-
interface ActionDefinition {
|
|
2234
|
-
stage: string;
|
|
2235
|
-
debit: 'bet' | 'buy_bonus_cost' | 'ante_bet_cost' | 'none';
|
|
2236
|
-
credit?: 'win' | 'none' | 'defer';
|
|
2237
|
-
requires_session?: boolean;
|
|
2238
|
-
buy_bonus_mode?: string;
|
|
2239
|
-
transitions: TransitionRule[];
|
|
2240
|
-
input_schema?: Record<string, unknown>;
|
|
2241
|
-
}
|
|
2242
|
-
interface TransitionRule {
|
|
2243
|
-
condition: string;
|
|
2244
|
-
creates_session?: boolean;
|
|
2245
|
-
complete_session?: boolean;
|
|
2246
|
-
credit_override?: 'defer';
|
|
2247
|
-
next_actions: string[];
|
|
2248
|
-
session_config?: SessionConfig;
|
|
2249
|
-
add_spins_var?: string;
|
|
2250
|
-
}
|
|
2251
|
-
interface SessionConfig {
|
|
2252
|
-
total_spins_var: string;
|
|
2253
|
-
persistent_vars?: string[];
|
|
2254
|
-
}
|
|
2255
|
-
interface LuaEngineConfig {
|
|
2256
|
-
/** Lua script source code */
|
|
2257
|
-
script: string;
|
|
2258
|
-
/** Platform game definition (actions, transitions, bet levels, etc.) */
|
|
2259
|
-
gameDefinition: GameDefinition;
|
|
2260
|
-
/** Seed for deterministic RNG (for simulation/replay) */
|
|
2261
|
-
seed?: number;
|
|
2262
|
-
/** Custom logger function */
|
|
2263
|
-
logger?: (level: string, msg: string) => void;
|
|
2264
|
-
/** Skip marshalling data fields (matrix, wins, etc.) for faster simulation */
|
|
2265
|
-
simulationMode?: boolean;
|
|
2266
|
-
}
|
|
2267
|
-
interface LuaPlayResult {
|
|
2268
|
-
totalWin: number;
|
|
2269
|
-
data: Record<string, unknown>;
|
|
2270
|
-
nextActions: string[];
|
|
2271
|
-
session: SessionData | null;
|
|
2272
|
-
variables: Record<string, number>;
|
|
2273
|
-
creditDeferred: boolean;
|
|
2274
|
-
}
|
|
2275
|
-
|
|
2276
|
-
interface DevBridgeConfig {
|
|
2277
|
-
/** Mock initial balance */
|
|
2278
|
-
balance?: number;
|
|
2279
|
-
/** Mock currency */
|
|
2280
|
-
currency?: string;
|
|
2281
|
-
/** Game config */
|
|
2282
|
-
gameConfig?: Partial<GameConfigData>;
|
|
2283
|
-
/** Base URL for assets (default: '/assets/') */
|
|
2284
|
-
assetsUrl?: string;
|
|
2285
|
-
/** Active session to resume (null = no active session) */
|
|
2286
|
-
session?: SessionData | null;
|
|
2287
|
-
/** Custom play result handler — return mock result data */
|
|
2288
|
-
onPlay?: (params: PlayParams) => Partial<PlayResultData>;
|
|
2289
|
-
/** Simulated network delay in ms */
|
|
2290
|
-
networkDelay?: number;
|
|
2291
|
-
/** Enable debug logging */
|
|
2292
|
-
debug?: boolean;
|
|
2293
|
-
/** Lua script source code. When set, play requests are routed to the Vite dev server's LuaEngine. */
|
|
2294
|
-
luaScript?: string;
|
|
2295
|
-
/** Game definition for Lua engine (actions, transitions, etc.) */
|
|
2296
|
-
gameDefinition?: GameDefinition;
|
|
2297
|
-
/** RNG seed for deterministic Lua execution */
|
|
2298
|
-
luaSeed?: number;
|
|
2299
|
-
}
|
|
2300
|
-
/**
|
|
2301
|
-
* Mock host bridge for local development.
|
|
2302
|
-
*
|
|
2303
|
-
* Uses the SDK's `Bridge` class in `devMode` to communicate with
|
|
2304
|
-
* `CasinoGameSDK` via a shared in-memory `MemoryChannel`, removing
|
|
2305
|
-
* the need for postMessage and iframes.
|
|
2306
|
-
*
|
|
2307
|
-
* When `luaScript` is set, play requests are sent to the Vite dev server
|
|
2308
|
-
* which runs LuaEngine in Node.js — no fengari in the browser.
|
|
2309
|
-
*
|
|
2310
|
-
* @example
|
|
2311
|
-
* ```ts
|
|
2312
|
-
* import { DevBridge } from '@energy8platform/game-engine/debug';
|
|
2313
|
-
*
|
|
2314
|
-
* const devBridge = new DevBridge({
|
|
2315
|
-
* balance: 5000,
|
|
2316
|
-
* currency: 'EUR',
|
|
2317
|
-
* gameConfig: { id: 'my-slot', type: 'slot', betLevels: [0.2, 0.5, 1, 2] },
|
|
2318
|
-
* onPlay: ({ action, bet }) => ({
|
|
2319
|
-
* totalWin: Math.random() > 0.5 ? bet * (Math.random() * 20) : 0,
|
|
2320
|
-
* data: { matrix: [[1,2,3],[4,5,6],[7,8,9]] },
|
|
2321
|
-
* }),
|
|
2322
|
-
* });
|
|
2323
|
-
* devBridge.start();
|
|
2324
|
-
* ```
|
|
2325
|
-
*/
|
|
2326
|
-
declare class DevBridge {
|
|
2327
|
-
private _config;
|
|
2328
|
-
private _balance;
|
|
2329
|
-
private _roundCounter;
|
|
2330
|
-
private _bridge;
|
|
2331
|
-
private _useLuaServer;
|
|
2332
|
-
constructor(config?: DevBridgeConfig);
|
|
2333
|
-
/** Current mock balance */
|
|
2334
|
-
get balance(): number;
|
|
2335
|
-
/** Start listening for SDK messages */
|
|
2336
|
-
start(): void;
|
|
2337
|
-
/** Stop listening */
|
|
2338
|
-
stop(): void;
|
|
2339
|
-
/** Set mock balance */
|
|
2340
|
-
setBalance(balance: number): void;
|
|
2341
|
-
/** Destroy the dev bridge */
|
|
2342
|
-
destroy(): void;
|
|
2343
|
-
private handleGameReady;
|
|
2344
|
-
private handlePlayRequest;
|
|
2345
|
-
private executeLuaOnServer;
|
|
2346
|
-
private buildFallbackResult;
|
|
2347
|
-
private handlePlayAck;
|
|
2348
|
-
private handleGetBalance;
|
|
2349
|
-
private handleGetState;
|
|
2350
|
-
private handleOpenDeposit;
|
|
2351
|
-
private delayedSend;
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
export { AssetManager, AudioManager, BalanceDisplay, Button, DevBridge, Easing, EventEmitter, FPSOverlay, FlexContainer, GameApplication, InputManager, Label, Layout, LoadingScene, Modal, Orientation, Panel, ProgressBar, ScaleMode, Scene, SceneManager, ScrollContainer, SpineHelper, SpriteAnimation, StateMachine, Timeline, Toast, TransitionType, Tween, ViewportManager, WinDisplay };
|
|
2355
|
-
export type { ActionDefinition, AlignItems, AssetBundle, AssetEntry, AssetManifest, AudioConfig, BalanceDisplayConfig, ButtonConfig, ButtonState, DevBridgeConfig, EasingFunction, FlexContainerConfig, FlexDirection, FlexItemConfig, GameApplicationConfig, GameDefinition, GameEngineEvents, IScene, JustifyContent, LabelConfig, LayoutAlignment, LayoutAnchor, LayoutConfig, LayoutDirection, LoadingScreenConfig, LuaEngineConfig, LuaPlayResult, ModalConfig, PanelConfig, ProgressBarConfig, SceneConstructor, ScrollContainerConfig, ScrollDirection, SpriteAnimationConfig, ToastConfig, ToastType, TransitionConfig, TransitionRule, TweenOptions, WinDisplayConfig };
|
|
2169
|
+
export { AssetManager, AudioManager, BalanceDisplay, Button, Easing, EventEmitter, FPSOverlay, FlexContainer, GameApplication, InputManager, Label, Layout, LoadingScene, Modal, Orientation, Panel, ProgressBar, ScaleMode, Scene, SceneManager, ScrollContainer, SpineHelper, SpriteAnimation, StateMachine, Timeline, Toast, TransitionType, Tween, ViewportManager, WinDisplay };
|
|
2170
|
+
export type { AlignItems, AudioConfig, BalanceDisplayConfig, ButtonConfig, ButtonState, EasingFunction, FlexContainerConfig, FlexDirection, FlexItemConfig, GameApplicationConfig, GameEngineEvents, IScene, JustifyContent, LabelConfig, LayoutAlignment, LayoutAnchor, LayoutConfig, LayoutDirection, ModalConfig, PanelConfig, ProgressBarConfig, SceneConstructor, ScrollContainerConfig, ScrollDirection, SpriteAnimationConfig, ToastConfig, ToastType, TransitionConfig, TweenOptions, WinDisplayConfig };
|