@energy8platform/game-engine 0.15.1 → 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.
Files changed (62) hide show
  1. package/README.md +22 -12
  2. package/dist/assets.d.ts +2 -14
  3. package/dist/core.cjs.js +16 -201
  4. package/dist/core.cjs.js.map +1 -1
  5. package/dist/core.d.ts +4 -35
  6. package/dist/core.esm.js +12 -197
  7. package/dist/core.esm.js.map +1 -1
  8. package/dist/debug.cjs.js +5 -233
  9. package/dist/debug.cjs.js.map +1 -1
  10. package/dist/debug.d.ts +2 -140
  11. package/dist/debug.esm.js +2 -233
  12. package/dist/debug.esm.js.map +1 -1
  13. package/dist/index.cjs.js +36 -442
  14. package/dist/index.cjs.js.map +1 -1
  15. package/dist/index.d.ts +10 -195
  16. package/dist/index.esm.js +29 -439
  17. package/dist/index.esm.js.map +1 -1
  18. package/dist/lua.cjs.js +7 -1493
  19. package/dist/lua.cjs.js.map +1 -1
  20. package/dist/lua.d.ts +1 -403
  21. package/dist/lua.esm.js +1 -1483
  22. package/dist/lua.esm.js.map +1 -1
  23. package/dist/react.cjs.js +15 -10
  24. package/dist/react.cjs.js.map +1 -1
  25. package/dist/react.d.ts +4 -35
  26. package/dist/react.esm.js +15 -10
  27. package/dist/react.esm.js.map +1 -1
  28. package/dist/ui.cjs.js +15 -10
  29. package/dist/ui.cjs.js.map +1 -1
  30. package/dist/ui.esm.js +15 -10
  31. package/dist/ui.esm.js.map +1 -1
  32. package/dist/vite.cjs.js +19 -175
  33. package/dist/vite.cjs.js.map +1 -1
  34. package/dist/vite.d.ts +8 -3
  35. package/dist/vite.esm.js +10 -173
  36. package/dist/vite.esm.js.map +1 -1
  37. package/package.json +6 -16
  38. package/src/core/GameApplication.ts +14 -18
  39. package/src/debug/index.ts +4 -2
  40. package/src/index.ts +3 -3
  41. package/src/loading/LoadingScene.ts +1 -1
  42. package/src/loading/index.ts +9 -2
  43. package/src/lua/index.ts +3 -31
  44. package/src/types.ts +16 -41
  45. package/src/ui/FlexContainer.ts +15 -10
  46. package/src/vite/index.ts +13 -196
  47. package/bin/simulate.ts +0 -139
  48. package/scripts/install-simulate.mjs +0 -101
  49. package/src/debug/DevBridge.ts +0 -305
  50. package/src/loading/CSSPreloader.ts +0 -129
  51. package/src/loading/logo.ts +0 -95
  52. package/src/lua/ActionRouter.ts +0 -132
  53. package/src/lua/LuaEngine.ts +0 -412
  54. package/src/lua/LuaEngineAPI.ts +0 -314
  55. package/src/lua/NativeSimulationRunner.ts +0 -367
  56. package/src/lua/ParallelSimulationRunner.ts +0 -156
  57. package/src/lua/PersistentState.ts +0 -80
  58. package/src/lua/SessionManager.ts +0 -227
  59. package/src/lua/SimulationRunner.ts +0 -192
  60. package/src/lua/SimulationWorker.ts +0 -44
  61. package/src/lua/fengari.d.ts +0 -10
  62. package/src/lua/types.ts +0 -149
package/src/lua/types.ts DELETED
@@ -1,149 +0,0 @@
1
- import type { SessionData, PlayParams } from '@energy8platform/game-sdk';
2
-
3
- // ─── Game Definition (Platform JSON Config) ─────────────
4
-
5
- export interface GameDefinition {
6
- id: string;
7
- type: 'SLOT' | 'TABLE';
8
- actions: Record<string, ActionDefinition>;
9
- bet_levels?: number[] | BetLevelsConfig;
10
- max_win?: MaxWinConfig;
11
- buy_bonus?: BuyBonusConfig;
12
- ante_bet?: AnteBetConfig;
13
- persistent_state?: PersistentStateConfig;
14
- }
15
-
16
- export interface BetLevelsConfig {
17
- levels?: number[];
18
- min?: number;
19
- max?: number;
20
- }
21
-
22
- export interface MaxWinConfig {
23
- multiplier?: number;
24
- fixed?: number;
25
- }
26
-
27
- export interface BuyBonusConfig {
28
- modes: Record<string, BuyBonusMode>;
29
- }
30
-
31
- export interface BuyBonusMode {
32
- cost_multiplier: number;
33
- /** Distribution of forced scatter counts. Optional — if omitted, Lua script handles bonus setup itself. */
34
- scatter_distribution?: Record<string, number>;
35
- /** Optional description */
36
- description?: string;
37
- }
38
-
39
- export interface AnteBetConfig {
40
- cost_multiplier: number;
41
- }
42
-
43
- export interface PersistentStateConfig {
44
- vars: string[];
45
- exposed_vars: string[];
46
- }
47
-
48
- // ─── Actions & Transitions ──────────────────────────────
49
-
50
- export interface ActionDefinition {
51
- stage: string;
52
- debit: 'bet' | 'buy_bonus_cost' | 'ante_bet_cost' | 'none';
53
- credit?: 'win' | 'none' | 'defer';
54
- requires_session?: boolean;
55
- buy_bonus_mode?: string;
56
- transitions: TransitionRule[];
57
- input_schema?: Record<string, unknown>;
58
- }
59
-
60
- export interface TransitionRule {
61
- condition: string;
62
- creates_session?: boolean;
63
- complete_session?: boolean;
64
- credit_override?: 'defer';
65
- next_actions: string[];
66
- session_config?: SessionConfig;
67
- add_spins_var?: string;
68
- }
69
-
70
- export interface SessionConfig {
71
- total_spins_var: string;
72
- persistent_vars?: string[];
73
- }
74
-
75
- // ─── Lua Engine Config & Results ────────────────────────
76
-
77
- export interface LuaEngineConfig {
78
- /** Lua script source code */
79
- script: string;
80
- /** Platform game definition (actions, transitions, bet levels, etc.) */
81
- gameDefinition: GameDefinition;
82
- /** Seed for deterministic RNG (for simulation/replay) */
83
- seed?: number;
84
- /** Custom logger function */
85
- logger?: (level: string, msg: string) => void;
86
- /** Skip marshalling data fields (matrix, wins, etc.) for faster simulation */
87
- simulationMode?: boolean;
88
- }
89
-
90
- export interface LuaPlayResult {
91
- totalWin: number;
92
- data: Record<string, unknown>;
93
- nextActions: string[];
94
- session: SessionData | null;
95
- variables: Record<string, number>;
96
- creditDeferred: boolean;
97
- }
98
-
99
- // ─── Simulation ─────────────────────────────────────────
100
-
101
- export interface SimulationConfig {
102
- /** Lua script source code */
103
- script: string;
104
- /** Platform game definition */
105
- gameDefinition: GameDefinition;
106
- /** Number of iterations to run */
107
- iterations: number;
108
- /** Bet amount per spin */
109
- bet: number;
110
- /** RNG seed for deterministic results */
111
- seed?: number;
112
- /** Which action to simulate (default: 'spin') */
113
- action?: string;
114
- /** Params for the action (buy_bonus mode, ante_bet, etc.) */
115
- params?: Record<string, unknown>;
116
- /** Report progress every N iterations (default: 100_000) */
117
- progressInterval?: number;
118
- /** Progress callback */
119
- onProgress?: (completed: number, total: number) => void;
120
- /** Number of worker threads for parallel simulation (default: os.cpus().length) */
121
- workerCount?: number;
122
- }
123
-
124
- export interface SimulationResult {
125
- gameId: string;
126
- action: string;
127
- iterations: number;
128
- durationMs: number;
129
- totalRtp: number;
130
- baseGameRtp: number;
131
- bonusRtp: number;
132
- hitFrequency: number;
133
- maxWin: number;
134
- maxWinHits: number;
135
- bonusTriggered: number;
136
- bonusSpinsPlayed: number;
137
- /** Raw accumulators for aggregation across workers */
138
- _raw?: SimulationRawAccumulators;
139
- }
140
-
141
- export interface SimulationRawAccumulators {
142
- totalWagered: number;
143
- totalWon: number;
144
- baseGameWin: number;
145
- bonusWin: number;
146
- hits: number;
147
- }
148
-
149
- export type { SessionData, PlayParams };