playcademy 0.11.12 → 0.11.13
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/dist/edge-play/src/constants.ts +28 -3
- package/dist/index.js +8 -23
- package/dist/utils.js +38 -106
- package/package.json +1 -1
- package/dist/@playcademy/constants/package.json +0 -23
- package/dist/@playcademy/constants/src/auth.ts +0 -13
- package/dist/@playcademy/constants/src/domains.ts +0 -43
- package/dist/@playcademy/constants/src/env-vars.ts +0 -20
- package/dist/@playcademy/constants/src/index.ts +0 -15
- package/dist/@playcademy/constants/src/overworld.ts +0 -327
- package/dist/@playcademy/constants/src/system.ts +0 -10
- package/dist/@playcademy/constants/src/timeback.ts +0 -32
- package/dist/@playcademy/constants/src/workers.ts +0 -21
|
@@ -2,12 +2,37 @@
|
|
|
2
2
|
* Constants for game backend workers
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Environment variables for game backend workers
|
|
7
|
+
*/
|
|
8
|
+
export const ENV_VARS = {
|
|
9
|
+
/** Game-specific API key for calling platform API */
|
|
10
|
+
PLAYCADEMY_API_KEY: 'PLAYCADEMY_API_KEY',
|
|
11
|
+
/** Game ID (UUID) */
|
|
12
|
+
GAME_ID: 'GAME_ID',
|
|
13
|
+
/** Platform API base URL */
|
|
14
|
+
PLAYCADEMY_BASE_URL: 'PLAYCADEMY_BASE_URL',
|
|
15
|
+
} as const
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Worker naming patterns
|
|
19
|
+
* - Production workers: {slug} → accessible at {slug}.playcademy.gg
|
|
20
|
+
* - Staging workers: staging-{slug} → accessible at {slug}-staging.playcademy.gg
|
|
21
|
+
*/
|
|
22
|
+
export const WORKER_NAMING = {
|
|
23
|
+
/** Prefix for staging worker names (e.g., "staging-bamboo") */
|
|
24
|
+
STAGING_PREFIX: 'staging-',
|
|
25
|
+
/** Suffix for staging worker hostnames (e.g., "bamboo-staging.playcademy.gg") */
|
|
26
|
+
STAGING_SUFFIX: '-staging',
|
|
27
|
+
} as const
|
|
6
28
|
|
|
7
29
|
/**
|
|
8
|
-
*
|
|
30
|
+
* TimeBack integration route paths
|
|
31
|
+
* These are relative to /api/ - full paths are /api/integrations/timeback/*
|
|
9
32
|
*/
|
|
10
|
-
|
|
33
|
+
const TIMEBACK_ROUTES = {
|
|
34
|
+
END_ACTIVITY: '/integrations/timeback/end-activity',
|
|
35
|
+
} as const
|
|
11
36
|
|
|
12
37
|
/**
|
|
13
38
|
* Built-in API routes
|
package/dist/index.js
CHANGED
|
@@ -1789,13 +1789,9 @@ var init_system = __esm({
|
|
|
1789
1789
|
});
|
|
1790
1790
|
|
|
1791
1791
|
// ../constants/src/timeback.ts
|
|
1792
|
-
var TIMEBACK_ROUTES;
|
|
1793
1792
|
var init_timeback2 = __esm({
|
|
1794
1793
|
"../constants/src/timeback.ts"() {
|
|
1795
1794
|
"use strict";
|
|
1796
|
-
TIMEBACK_ROUTES = {
|
|
1797
|
-
END_ACTIVITY: "/integrations/timeback/end-activity"
|
|
1798
|
-
};
|
|
1799
1795
|
}
|
|
1800
1796
|
});
|
|
1801
1797
|
|
|
@@ -3595,11 +3591,13 @@ var init_integrations = __esm({
|
|
|
3595
3591
|
});
|
|
3596
3592
|
|
|
3597
3593
|
// ../edge-play/src/constants.ts
|
|
3598
|
-
var ROUTES;
|
|
3594
|
+
var TIMEBACK_ROUTES, ROUTES;
|
|
3599
3595
|
var init_constants4 = __esm({
|
|
3600
3596
|
"../edge-play/src/constants.ts"() {
|
|
3601
3597
|
"use strict";
|
|
3602
|
-
|
|
3598
|
+
TIMEBACK_ROUTES = {
|
|
3599
|
+
END_ACTIVITY: "/integrations/timeback/end-activity"
|
|
3600
|
+
};
|
|
3603
3601
|
ROUTES = {
|
|
3604
3602
|
/** Route index (lists available routes) */
|
|
3605
3603
|
INDEX: "/api",
|
|
@@ -5139,18 +5137,13 @@ async function bundleBackend(config, options = {}) {
|
|
|
5139
5137
|
customRoutes: customRouteData
|
|
5140
5138
|
};
|
|
5141
5139
|
const entryCode = generateEntryCode(customRouteData);
|
|
5142
|
-
const
|
|
5143
|
-
const embeddedEdgeSrc = join3(
|
|
5144
|
-
const monorepoEdgeSrc = join3(
|
|
5140
|
+
const distDir = new URL(".", import.meta.url).pathname;
|
|
5141
|
+
const embeddedEdgeSrc = join3(distDir, "edge-play", "src");
|
|
5142
|
+
const monorepoEdgeSrc = join3(distDir, "../../../../edge-play/src");
|
|
5145
5143
|
const isBuiltPackage = existsSync3(embeddedEdgeSrc);
|
|
5146
5144
|
const edgePlaySrc = isBuiltPackage ? embeddedEdgeSrc : monorepoEdgeSrc;
|
|
5147
|
-
const cliPackageRoot = isBuiltPackage ? join3(
|
|
5145
|
+
const cliPackageRoot = isBuiltPackage ? join3(distDir, "../..") : join3(distDir, "../../..");
|
|
5148
5146
|
const nodeModulesRoot = isBuiltPackage ? cliPackageRoot : getMonorepoRoot();
|
|
5149
|
-
const embeddedConstantsSrcA = join3(currentDir2, "@playcademy/constants/src");
|
|
5150
|
-
const embeddedConstantsSrcB = join3(currentDir2, "node_modules/@playcademy/constants/src");
|
|
5151
|
-
const embeddedConstantsSrc = existsSync3(embeddedConstantsSrcA) ? embeddedConstantsSrcA : embeddedConstantsSrcB;
|
|
5152
|
-
const monorepoConstantsSrc = join3(currentDir2, "../../../constants/src");
|
|
5153
|
-
const constantsSrc = isBuiltPackage ? embeddedConstantsSrc : monorepoConstantsSrc;
|
|
5154
5147
|
const result = await esbuild.build({
|
|
5155
5148
|
stdin: {
|
|
5156
5149
|
contents: entryCode,
|
|
@@ -5182,14 +5175,6 @@ async function bundleBackend(config, options = {}) {
|
|
|
5182
5175
|
* user's game project, enabling esbuild to bundle custom routes into the worker.
|
|
5183
5176
|
*/
|
|
5184
5177
|
"@game-api": join3(workspace, "api"),
|
|
5185
|
-
/**
|
|
5186
|
-
* @playcademy/constants alias for edge-play sources
|
|
5187
|
-
*
|
|
5188
|
-
* Map the bare import to the package entry file, and also support
|
|
5189
|
-
* subpath imports if they are added in the future.
|
|
5190
|
-
*/
|
|
5191
|
-
"@playcademy/constants": join3(constantsSrc, "index.ts"),
|
|
5192
|
-
"@playcademy/constants/*": join3(constantsSrc, "*"),
|
|
5193
5178
|
/**
|
|
5194
5179
|
* Node.js module polyfills for Cloudflare Workers environment
|
|
5195
5180
|
*
|
package/dist/utils.js
CHANGED
|
@@ -262,113 +262,14 @@ var init_file_loader = __esm({
|
|
|
262
262
|
}
|
|
263
263
|
});
|
|
264
264
|
|
|
265
|
-
// ../constants/src/auth.ts
|
|
266
|
-
var init_auth = __esm({
|
|
267
|
-
"../constants/src/auth.ts"() {
|
|
268
|
-
"use strict";
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
// ../constants/src/domains.ts
|
|
273
|
-
var init_domains = __esm({
|
|
274
|
-
"../constants/src/domains.ts"() {
|
|
275
|
-
"use strict";
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
// ../constants/src/env-vars.ts
|
|
280
|
-
var init_env_vars = __esm({
|
|
281
|
-
"../constants/src/env-vars.ts"() {
|
|
282
|
-
"use strict";
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
// ../constants/src/overworld.ts
|
|
287
|
-
var ITEM_SLUGS, CURRENCIES, BADGES, CORE_GAME_UUIDS;
|
|
288
|
-
var init_overworld = __esm({
|
|
289
|
-
"../constants/src/overworld.ts"() {
|
|
290
|
-
"use strict";
|
|
291
|
-
ITEM_SLUGS = {
|
|
292
|
-
/** Primary platform currency */
|
|
293
|
-
PLAYCADEMY_CREDITS: "PLAYCADEMY_CREDITS",
|
|
294
|
-
/** Experience points currency */
|
|
295
|
-
PLAYCADEMY_XP: "PLAYCADEMY_XP",
|
|
296
|
-
/** Core platform badges */
|
|
297
|
-
FOUNDING_MEMBER_BADGE: "FOUNDING_MEMBER_BADGE",
|
|
298
|
-
EARLY_ADOPTER_BADGE: "EARLY_ADOPTER_BADGE",
|
|
299
|
-
FIRST_GAME_BADGE: "FIRST_GAME_BADGE",
|
|
300
|
-
/** Example items */
|
|
301
|
-
COMMON_SWORD: "COMMON_SWORD",
|
|
302
|
-
SMALL_HEALTH_POTION: "SMALL_HEALTH_POTION",
|
|
303
|
-
SMALL_BACKPACK: "SMALL_BACKPACK",
|
|
304
|
-
/** Placeable items */
|
|
305
|
-
LAVA_LAMP: "LAVA_LAMP",
|
|
306
|
-
BOOMBOX: "BOOMBOX",
|
|
307
|
-
CABIN_BED: "CABIN_BED"
|
|
308
|
-
};
|
|
309
|
-
CURRENCIES = {
|
|
310
|
-
/** Primary platform currency slug */
|
|
311
|
-
PRIMARY: ITEM_SLUGS.PLAYCADEMY_CREDITS,
|
|
312
|
-
/** Experience points slug */
|
|
313
|
-
XP: ITEM_SLUGS.PLAYCADEMY_XP
|
|
314
|
-
};
|
|
315
|
-
BADGES = {
|
|
316
|
-
FOUNDING_MEMBER: ITEM_SLUGS.FOUNDING_MEMBER_BADGE,
|
|
317
|
-
EARLY_ADOPTER: ITEM_SLUGS.EARLY_ADOPTER_BADGE,
|
|
318
|
-
FIRST_GAME: ITEM_SLUGS.FIRST_GAME_BADGE
|
|
319
|
-
};
|
|
320
|
-
CORE_GAME_UUIDS = {
|
|
321
|
-
/** Internal playground game for development and testing */
|
|
322
|
-
PLAYGROUND: "00000000-0000-0000-0000-000000000001"
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
// ../constants/src/system.ts
|
|
328
|
-
var init_system = __esm({
|
|
329
|
-
"../constants/src/system.ts"() {
|
|
330
|
-
"use strict";
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
// ../constants/src/timeback.ts
|
|
335
|
-
var TIMEBACK_ROUTES;
|
|
336
|
-
var init_timeback = __esm({
|
|
337
|
-
"../constants/src/timeback.ts"() {
|
|
338
|
-
"use strict";
|
|
339
|
-
TIMEBACK_ROUTES = {
|
|
340
|
-
END_ACTIVITY: "/integrations/timeback/end-activity"
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
// ../constants/src/workers.ts
|
|
346
|
-
var init_workers = __esm({
|
|
347
|
-
"../constants/src/workers.ts"() {
|
|
348
|
-
"use strict";
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
// ../constants/src/index.ts
|
|
353
|
-
var init_src = __esm({
|
|
354
|
-
"../constants/src/index.ts"() {
|
|
355
|
-
"use strict";
|
|
356
|
-
init_auth();
|
|
357
|
-
init_domains();
|
|
358
|
-
init_env_vars();
|
|
359
|
-
init_overworld();
|
|
360
|
-
init_system();
|
|
361
|
-
init_timeback();
|
|
362
|
-
init_workers();
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
|
|
366
265
|
// ../edge-play/src/constants.ts
|
|
367
|
-
var ROUTES;
|
|
266
|
+
var TIMEBACK_ROUTES, ROUTES;
|
|
368
267
|
var init_constants = __esm({
|
|
369
268
|
"../edge-play/src/constants.ts"() {
|
|
370
269
|
"use strict";
|
|
371
|
-
|
|
270
|
+
TIMEBACK_ROUTES = {
|
|
271
|
+
END_ACTIVITY: "/integrations/timeback/end-activity"
|
|
272
|
+
};
|
|
372
273
|
ROUTES = {
|
|
373
274
|
/** Route index (lists available routes) */
|
|
374
275
|
INDEX: "/api",
|
|
@@ -725,8 +626,40 @@ var CONFIG_FILE_NAMES = [
|
|
|
725
626
|
"playcademy.config.mjs"
|
|
726
627
|
];
|
|
727
628
|
|
|
728
|
-
// src/
|
|
729
|
-
|
|
629
|
+
// ../constants/src/overworld.ts
|
|
630
|
+
var ITEM_SLUGS = {
|
|
631
|
+
/** Primary platform currency */
|
|
632
|
+
PLAYCADEMY_CREDITS: "PLAYCADEMY_CREDITS",
|
|
633
|
+
/** Experience points currency */
|
|
634
|
+
PLAYCADEMY_XP: "PLAYCADEMY_XP",
|
|
635
|
+
/** Core platform badges */
|
|
636
|
+
FOUNDING_MEMBER_BADGE: "FOUNDING_MEMBER_BADGE",
|
|
637
|
+
EARLY_ADOPTER_BADGE: "EARLY_ADOPTER_BADGE",
|
|
638
|
+
FIRST_GAME_BADGE: "FIRST_GAME_BADGE",
|
|
639
|
+
/** Example items */
|
|
640
|
+
COMMON_SWORD: "COMMON_SWORD",
|
|
641
|
+
SMALL_HEALTH_POTION: "SMALL_HEALTH_POTION",
|
|
642
|
+
SMALL_BACKPACK: "SMALL_BACKPACK",
|
|
643
|
+
/** Placeable items */
|
|
644
|
+
LAVA_LAMP: "LAVA_LAMP",
|
|
645
|
+
BOOMBOX: "BOOMBOX",
|
|
646
|
+
CABIN_BED: "CABIN_BED"
|
|
647
|
+
};
|
|
648
|
+
var CURRENCIES = {
|
|
649
|
+
/** Primary platform currency slug */
|
|
650
|
+
PRIMARY: ITEM_SLUGS.PLAYCADEMY_CREDITS,
|
|
651
|
+
/** Experience points slug */
|
|
652
|
+
XP: ITEM_SLUGS.PLAYCADEMY_XP
|
|
653
|
+
};
|
|
654
|
+
var BADGES = {
|
|
655
|
+
FOUNDING_MEMBER: ITEM_SLUGS.FOUNDING_MEMBER_BADGE,
|
|
656
|
+
EARLY_ADOPTER: ITEM_SLUGS.EARLY_ADOPTER_BADGE,
|
|
657
|
+
FIRST_GAME: ITEM_SLUGS.FIRST_GAME_BADGE
|
|
658
|
+
};
|
|
659
|
+
var CORE_GAME_UUIDS = {
|
|
660
|
+
/** Internal playground game for development and testing */
|
|
661
|
+
PLAYGROUND: "00000000-0000-0000-0000-000000000001"
|
|
662
|
+
};
|
|
730
663
|
|
|
731
664
|
// src/lib/config/loader.ts
|
|
732
665
|
var ConfigError = class extends Error {
|
|
@@ -946,7 +879,6 @@ function processConfigVariables(config) {
|
|
|
946
879
|
}
|
|
947
880
|
|
|
948
881
|
// src/lib/dev/server.ts
|
|
949
|
-
init_src();
|
|
950
882
|
import { join as join2 } from "path";
|
|
951
883
|
import { serve } from "@hono/node-server";
|
|
952
884
|
import { Hono } from "hono";
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@playcademy/constants",
|
|
3
|
-
"main": "src/index.ts",
|
|
4
|
-
"version": "0.0.1",
|
|
5
|
-
"module": "src/index.ts",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"private": true,
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./src/index.ts",
|
|
11
|
-
"import": "./src/index.ts",
|
|
12
|
-
"default": "./src/index.ts"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@types/bun": "latest",
|
|
17
|
-
"rollup": "^4.52.4",
|
|
18
|
-
"rollup-plugin-dts": "^6.2.3"
|
|
19
|
-
},
|
|
20
|
-
"peerDependencies": {
|
|
21
|
-
"typescript": "^5"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain and URL Constants
|
|
3
|
-
*
|
|
4
|
-
* Centralized domain names and base URLs for the Playcademy platform.
|
|
5
|
-
* These constants are shared across multiple packages to ensure consistency.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Playcademy domain names
|
|
10
|
-
*/
|
|
11
|
-
export const PLAYCADEMY_DOMAINS = {
|
|
12
|
-
/** Primary domain (hub, landing pages) */
|
|
13
|
-
apex: 'playcademy.net',
|
|
14
|
-
/** Marketing/alternative domain */
|
|
15
|
-
apexAlt: 'playcademy.com',
|
|
16
|
-
/** Game backend worker domain */
|
|
17
|
-
games: 'playcademy.gg',
|
|
18
|
-
} as const
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Platform hub base URLs by environment
|
|
22
|
-
* Used by CLI, SDK, and other packages to make API requests
|
|
23
|
-
*/
|
|
24
|
-
export const PLAYCADEMY_BASE_URLS = {
|
|
25
|
-
production: 'https://hub.playcademy.net',
|
|
26
|
-
staging: 'https://hub.dev.playcademy.net',
|
|
27
|
-
} as const
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Game backend worker domains by environment
|
|
31
|
-
* Workers are deployed to Cloudflare and accessible at:
|
|
32
|
-
* - Production: {slug}.playcademy.gg
|
|
33
|
-
* - Staging: {slug}-staging.playcademy.gg
|
|
34
|
-
*/
|
|
35
|
-
export const GAME_WORKER_DOMAINS = {
|
|
36
|
-
production: 'playcademy.gg',
|
|
37
|
-
staging: 'staging.playcademy.gg',
|
|
38
|
-
} as const
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Type exports
|
|
42
|
-
*/
|
|
43
|
-
export type PlatformEnvironment = 'production' | 'staging'
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Environment Variable Names
|
|
3
|
-
*
|
|
4
|
-
* Centralized environment variable names used across the platform.
|
|
5
|
-
* These ensure consistency between deployers and runtime environments.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Environment variables for game backend workers
|
|
10
|
-
* Used by both the deployment system (@playcademy/api-core)
|
|
11
|
-
* and the worker runtime (@playcademy/edge-play)
|
|
12
|
-
*/
|
|
13
|
-
export const WORKER_ENV_VARS = {
|
|
14
|
-
/** Game-specific API key for calling platform API */
|
|
15
|
-
PLAYCADEMY_API_KEY: 'PLAYCADEMY_API_KEY',
|
|
16
|
-
/** Game ID (UUID) */
|
|
17
|
-
GAME_ID: 'GAME_ID',
|
|
18
|
-
/** Platform API base URL */
|
|
19
|
-
PLAYCADEMY_BASE_URL: 'PLAYCADEMY_BASE_URL',
|
|
20
|
-
} as const
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @playcademy/constants
|
|
3
|
-
*
|
|
4
|
-
* Centralized constants shared across the Playcademy platform.
|
|
5
|
-
* This package contains domain names, URLs, environment variable names,
|
|
6
|
-
* and other constants that need to be consistent across multiple packages.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export * from './auth'
|
|
10
|
-
export * from './domains'
|
|
11
|
-
export * from './env-vars'
|
|
12
|
-
export * from './overworld'
|
|
13
|
-
export * from './system'
|
|
14
|
-
export * from './timeback'
|
|
15
|
-
export * from './workers'
|
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Overworld & Game Constants
|
|
3
|
-
*
|
|
4
|
-
* All constants related to the game world, including items, rendering,
|
|
5
|
-
* maps, physics, UI, and core platform games.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
9
|
-
// VIEWPORT & LEVEL SYSTEM
|
|
10
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Minimum viewport dimensions for the game
|
|
14
|
-
*/
|
|
15
|
-
export const MIN_VIEWPORT_WIDTH = 960
|
|
16
|
-
export const MIN_VIEWPORT_HEIGHT = 640
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Maximum player level
|
|
20
|
-
*/
|
|
21
|
-
export const MAX_LEVEL = 100
|
|
22
|
-
|
|
23
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
24
|
-
// ITEMS & ECONOMY
|
|
25
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Item Slugs - Canonical slugs for core platform items
|
|
29
|
-
*/
|
|
30
|
-
export const ITEM_SLUGS = {
|
|
31
|
-
/** Primary platform currency */
|
|
32
|
-
PLAYCADEMY_CREDITS: 'PLAYCADEMY_CREDITS',
|
|
33
|
-
|
|
34
|
-
/** Experience points currency */
|
|
35
|
-
PLAYCADEMY_XP: 'PLAYCADEMY_XP',
|
|
36
|
-
|
|
37
|
-
/** Core platform badges */
|
|
38
|
-
FOUNDING_MEMBER_BADGE: 'FOUNDING_MEMBER_BADGE',
|
|
39
|
-
EARLY_ADOPTER_BADGE: 'EARLY_ADOPTER_BADGE',
|
|
40
|
-
FIRST_GAME_BADGE: 'FIRST_GAME_BADGE',
|
|
41
|
-
|
|
42
|
-
/** Example items */
|
|
43
|
-
COMMON_SWORD: 'COMMON_SWORD',
|
|
44
|
-
SMALL_HEALTH_POTION: 'SMALL_HEALTH_POTION',
|
|
45
|
-
SMALL_BACKPACK: 'SMALL_BACKPACK',
|
|
46
|
-
|
|
47
|
-
/** Placeable items */
|
|
48
|
-
LAVA_LAMP: 'LAVA_LAMP',
|
|
49
|
-
BOOMBOX: 'BOOMBOX',
|
|
50
|
-
CABIN_BED: 'CABIN_BED',
|
|
51
|
-
} as const
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Currency-specific constants for easier access
|
|
55
|
-
*/
|
|
56
|
-
export const CURRENCIES = {
|
|
57
|
-
/** Primary platform currency slug */
|
|
58
|
-
PRIMARY: ITEM_SLUGS.PLAYCADEMY_CREDITS,
|
|
59
|
-
|
|
60
|
-
/** Experience points slug */
|
|
61
|
-
XP: ITEM_SLUGS.PLAYCADEMY_XP,
|
|
62
|
-
} as const
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Currency symbol constants
|
|
66
|
-
*/
|
|
67
|
-
export const CURRENCY_SYMBOLS = {
|
|
68
|
-
/** Primary platform currency symbol */
|
|
69
|
-
PLAYCADEMY_CREDITS: 'PC',
|
|
70
|
-
|
|
71
|
-
/** Experience points symbol */
|
|
72
|
-
PLAYCADEMY_XP: 'XP',
|
|
73
|
-
|
|
74
|
-
/** Default currency symbol */
|
|
75
|
-
DEFAULT: '¤',
|
|
76
|
-
} as const
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Badge constants for easier access
|
|
80
|
-
*/
|
|
81
|
-
export const BADGES = {
|
|
82
|
-
FOUNDING_MEMBER: ITEM_SLUGS.FOUNDING_MEMBER_BADGE,
|
|
83
|
-
EARLY_ADOPTER: ITEM_SLUGS.EARLY_ADOPTER_BADGE,
|
|
84
|
-
FIRST_GAME: ITEM_SLUGS.FIRST_GAME_BADGE,
|
|
85
|
-
} as const
|
|
86
|
-
|
|
87
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
88
|
-
// RENDERING & VISUALS
|
|
89
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Sprite System Constants
|
|
93
|
-
*/
|
|
94
|
-
export const SPRITE_COMPONENTS = ['body', 'outfit', 'hairstyle', 'eyes', 'accessory'] as const
|
|
95
|
-
export const SPRITE_LAYER_ORDER = ['body', 'outfit', 'hairstyle', 'eyes', 'accessory'] as const
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Renderer Z-layer constants – centralised depth values used by the Three.js
|
|
99
|
-
* front-end so magic numbers aren't scattered around the codebase.
|
|
100
|
-
*/
|
|
101
|
-
export const Z_LAYERS = {
|
|
102
|
-
/** Depth step between successive Tiled tile-layers (background → foreground). */
|
|
103
|
-
TILE_LAYER_STEP: 0.01,
|
|
104
|
-
|
|
105
|
-
/** Depth step between stacked sprite components inside a single character. */
|
|
106
|
-
SPRITE_COMPONENT_STEP: 0.002,
|
|
107
|
-
|
|
108
|
-
/** Minimum Z for Y-sorted entities (top of screen). */
|
|
109
|
-
ENTITY_MIN: 0.011,
|
|
110
|
-
|
|
111
|
-
/** Maximum Z for Y-sorted entities (bottom of screen). */
|
|
112
|
-
ENTITY_MAX: 0.0115,
|
|
113
|
-
|
|
114
|
-
/** Fallback Z when map bounds are unavailable. */
|
|
115
|
-
ENTITY_FALLBACK: 0.01125,
|
|
116
|
-
|
|
117
|
-
/** Offset applied to placeable item sprites so they sit above characters. */
|
|
118
|
-
PLACEABLE_OFFSET: 0.012,
|
|
119
|
-
|
|
120
|
-
/** Shadow offset below entity base Z (shadows appear below characters). */
|
|
121
|
-
SHADOW_OFFSET: -0.001,
|
|
122
|
-
} as const
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Shadow constants
|
|
126
|
-
*/
|
|
127
|
-
export const SHADOW_CONSTANTS = {
|
|
128
|
-
/** Shadow radius as a fraction of tileWidth */
|
|
129
|
-
RADIUS_MULTIPLIER: 0.4,
|
|
130
|
-
|
|
131
|
-
/** Y offset in world units as a fraction of one tile width. */
|
|
132
|
-
Y_OFFSET_TILES: -0.9,
|
|
133
|
-
|
|
134
|
-
/** Shadow opacity (semi-transparent) */
|
|
135
|
-
OPACITY: 0.4,
|
|
136
|
-
|
|
137
|
-
/** Y-axis scale for elliptical perspective */
|
|
138
|
-
Y_SCALE: 0.6,
|
|
139
|
-
|
|
140
|
-
/** Minimum shadow size during jumps (30% of original) */
|
|
141
|
-
SCALE_MIN: 0.1,
|
|
142
|
-
|
|
143
|
-
/** Maximum jump height for scaling calculations */
|
|
144
|
-
MAX_JUMP_HEIGHT: 100,
|
|
145
|
-
} as const
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Nameplate constants
|
|
149
|
-
*/
|
|
150
|
-
export const NAMEPLATE_CONSTANTS = {
|
|
151
|
-
/** Adjust nameplate position from base height */
|
|
152
|
-
BASE_Y_ADJUST: -1,
|
|
153
|
-
/** Extra pixels to raise when a head accessory is equipped */
|
|
154
|
-
HEAD_ACCESSORY_EXTRA_PX: 5,
|
|
155
|
-
/** Available background colors for nameplates */
|
|
156
|
-
BACKGROUND_COLORS: [
|
|
157
|
-
'#2d3748', // Default gray
|
|
158
|
-
'#dc2626', // Red
|
|
159
|
-
'#ea580c', // Orange
|
|
160
|
-
'#ca8a04', // Amber
|
|
161
|
-
'#16a34a', // Green
|
|
162
|
-
'#0891b2', // Cyan
|
|
163
|
-
'#2563eb', // Blue
|
|
164
|
-
'#7c3aed', // Purple
|
|
165
|
-
'#c026d3', // Pink
|
|
166
|
-
'#e11d48', // Rose
|
|
167
|
-
'#134e4a', // Dark teal
|
|
168
|
-
'#831843', // Dark pink
|
|
169
|
-
],
|
|
170
|
-
/** Default background color */
|
|
171
|
-
DEFAULT_BACKGROUND_COLOR: '#2d3748',
|
|
172
|
-
} as const
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Particle system constants
|
|
176
|
-
*/
|
|
177
|
-
export const LANDING_PARTICLES = {
|
|
178
|
-
/** Number of particles per landing */
|
|
179
|
-
COUNT: 6,
|
|
180
|
-
|
|
181
|
-
/** Base duration in ms */
|
|
182
|
-
DURATION: 500,
|
|
183
|
-
|
|
184
|
-
/** Spread radius as fraction of tileWidth */
|
|
185
|
-
SPREAD: 0.4,
|
|
186
|
-
|
|
187
|
-
/** Dust particle color */
|
|
188
|
-
COLOR: '#777',
|
|
189
|
-
|
|
190
|
-
/** Particle size in pixels in the game world */
|
|
191
|
-
SIZE: 3,
|
|
192
|
-
|
|
193
|
-
/** Vertical offset as a fraction of tile width (world units). */
|
|
194
|
-
Y_OFFSET_TILES: -0.9,
|
|
195
|
-
} as const
|
|
196
|
-
|
|
197
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
198
|
-
// MAPS
|
|
199
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Map System Constants
|
|
203
|
-
*/
|
|
204
|
-
export const MAP_CONSTANTS = {
|
|
205
|
-
/** Name of the Tiled layer containing map entry points */
|
|
206
|
-
ENTRY_POINT_LAYER_NAME: 'EntryPoints',
|
|
207
|
-
|
|
208
|
-
/** Name of the Tiled layer containing collision objects */
|
|
209
|
-
COLLISION_LAYER_NAME: 'Object Layer 1',
|
|
210
|
-
|
|
211
|
-
/** Name of the Tiled layer containing placeable objects */
|
|
212
|
-
PLACEABLE_AREA_LAYER_NAME: 'PlaceableArea',
|
|
213
|
-
|
|
214
|
-
/** Base path for tilesets */
|
|
215
|
-
TILESET_BASE_PATH: '/public/tilesets',
|
|
216
|
-
} as const
|
|
217
|
-
|
|
218
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
219
|
-
// PHYSICS & MOVEMENT
|
|
220
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Player movement and physics constants
|
|
224
|
-
*/
|
|
225
|
-
export const PLAYER_PHYSICS = {
|
|
226
|
-
/** Initial upward velocity when jumping (pixels per second) */
|
|
227
|
-
JUMP_FORCE: 150,
|
|
228
|
-
|
|
229
|
-
/** Downward acceleration due to gravity (pixels per second^2) */
|
|
230
|
-
GRAVITY: -450,
|
|
231
|
-
} as const
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Bunny hop (jump queuing) constants – Counter-Strike style mechanics.
|
|
235
|
-
*/
|
|
236
|
-
export const BUNNY_HOP = {
|
|
237
|
-
/** Base time window (ms) within which a queued jump is valid. */
|
|
238
|
-
QUEUE_WINDOW_MS: 100,
|
|
239
|
-
|
|
240
|
-
/** Downward velocity threshold (px/s) to allow jump queuing. */
|
|
241
|
-
FALL_SPEED_THRESHOLD: -50,
|
|
242
|
-
|
|
243
|
-
/** Vertical offset threshold (px) to allow queuing close to ground. */
|
|
244
|
-
CLOSE_TO_GROUND_THRESHOLD: 30,
|
|
245
|
-
|
|
246
|
-
/** Speed increase per successful hop. */
|
|
247
|
-
SPEED_INCREMENT: 0.15,
|
|
248
|
-
|
|
249
|
-
/** Maximum total speed multiplier. */
|
|
250
|
-
MAX_SPEED_MULTIPLIER: 5,
|
|
251
|
-
|
|
252
|
-
/** Multiplier applied to jump force on chained hops (slightly lower). */
|
|
253
|
-
HOP_JUMP_FORCE_MULTIPLIER: 0.95,
|
|
254
|
-
} as const
|
|
255
|
-
|
|
256
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
257
|
-
// UI & UX
|
|
258
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Audio defaults
|
|
262
|
-
*/
|
|
263
|
-
export const AUDIO_DEFAULTS = {
|
|
264
|
-
/** Master output volume */
|
|
265
|
-
MASTER_VOLUME: 0.5,
|
|
266
|
-
|
|
267
|
-
/** Background music enabled by default */
|
|
268
|
-
MUSIC_ENABLED: true,
|
|
269
|
-
/** Background music volume */
|
|
270
|
-
MUSIC_VOLUME: 0.5,
|
|
271
|
-
|
|
272
|
-
/** Sound effects enabled by default */
|
|
273
|
-
SFX_ENABLED: true,
|
|
274
|
-
/** Sound effects volume */
|
|
275
|
-
SFX_VOLUME: 0.5,
|
|
276
|
-
} as const
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Toast Duration Constants
|
|
280
|
-
* Centralized toast notification display durations in milliseconds.
|
|
281
|
-
*/
|
|
282
|
-
export const TOAST_DURATION = {
|
|
283
|
-
/** Short duration for simple confirmations */
|
|
284
|
-
SHORT: 3000,
|
|
285
|
-
|
|
286
|
-
/** Standard duration for most notifications */
|
|
287
|
-
STANDARD: 5000,
|
|
288
|
-
|
|
289
|
-
/** Long duration for important notifications */
|
|
290
|
-
LONG: 8000,
|
|
291
|
-
|
|
292
|
-
/** Error message duration */
|
|
293
|
-
ERROR: 4000,
|
|
294
|
-
} as const
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Cache Control Headers
|
|
298
|
-
* Centralized cache control strategies for different asset types and API responses.
|
|
299
|
-
*/
|
|
300
|
-
export const CACHE_CONTROL = {
|
|
301
|
-
/** Immutable assets with content-based versioning (sprites, audio, etc.) */
|
|
302
|
-
IMMUTABLE: 'public, max-age=31536000, immutable',
|
|
303
|
-
|
|
304
|
-
/** JSON data - cached for 1 day in browser, 1 year in CDN */
|
|
305
|
-
JSON_DATA: 'public, max-age=86400, s-maxage=31536000, must-revalidate',
|
|
306
|
-
|
|
307
|
-
/** Character components API - cached for 1 hour in browser, 3 hours in CDN */
|
|
308
|
-
API_CHARACTER_COMPONENTS: 'public, max-age=21600, s-maxage=21600, stale-while-revalidate=3600',
|
|
309
|
-
|
|
310
|
-
/** Level configs API - cached for 1 hour in browser, 12 hours in CDN */
|
|
311
|
-
API_LEVEL_CONFIGS: 'public, max-age=3600, s-maxage=86400, stale-while-revalidate=120',
|
|
312
|
-
|
|
313
|
-
/** Sprite templates API - cached for 1 day in browser, 1 week in CDN */
|
|
314
|
-
API_SPRITE_TEMPLATES: 'public, max-age=86400, s-maxage=86400, stale-while-revalidate=3600',
|
|
315
|
-
} as const
|
|
316
|
-
|
|
317
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
318
|
-
// CORE PLATFORM GAMES
|
|
319
|
-
// ═══════════════════════════════════════════════════════════════════════
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Core Game UUIDs - Canonical UUIDs for core platform games
|
|
323
|
-
*/
|
|
324
|
-
export const CORE_GAME_UUIDS = {
|
|
325
|
-
/** Internal playground game for development and testing */
|
|
326
|
-
PLAYGROUND: '00000000-0000-0000-0000-000000000001',
|
|
327
|
-
} as const
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TimeBack Integration Constants
|
|
3
|
-
*
|
|
4
|
-
* Constants related to TimeBack Caliper integration.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* TimeBack Caliper sensor URLs
|
|
9
|
-
* Allowed sensor URLs for Caliper event validation
|
|
10
|
-
*/
|
|
11
|
-
export const TIMEBACK_CALIPER_SENSORS = [
|
|
12
|
-
'https://samuraimath.com',
|
|
13
|
-
'https://app.alphamath.school',
|
|
14
|
-
'https://mathraiders.com',
|
|
15
|
-
] as const
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* TimeBack integration route paths (on game backend)
|
|
19
|
-
* These routes are available on game backends when TimeBack is enabled
|
|
20
|
-
*
|
|
21
|
-
* NOTE:
|
|
22
|
-
* These paths are relative to /api/ - the full paths are /api/integrations/timeback/*
|
|
23
|
-
*/
|
|
24
|
-
export const TIMEBACK_ROUTES = {
|
|
25
|
-
END_ACTIVITY: '/integrations/timeback/end-activity',
|
|
26
|
-
} as const
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* TimeBack OneRoster organization identifier
|
|
30
|
-
* This is the default organization sourcedId for Playcademy games
|
|
31
|
-
*/
|
|
32
|
-
export const TIMEBACK_ORG_SOURCED_ID = 'PLAYCADEMY' as const
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Worker Naming Constants
|
|
3
|
-
*
|
|
4
|
-
* Conventions for naming Cloudflare workers to avoid collisions
|
|
5
|
-
* between staging and production deployments.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Worker naming patterns
|
|
10
|
-
* - Production workers: {slug} → accessible at {slug}.playcademy.gg
|
|
11
|
-
* - Staging workers: staging-{slug} → accessible at {slug}-staging.playcademy.gg
|
|
12
|
-
*
|
|
13
|
-
* Note: Worker names use a PREFIX (staging-) while hostnames use a SUFFIX (-staging)
|
|
14
|
-
* to follow subdomain naming conventions.
|
|
15
|
-
*/
|
|
16
|
-
export const WORKER_NAMING = {
|
|
17
|
-
/** Prefix for staging worker names (e.g., "staging-bamboo") */
|
|
18
|
-
STAGING_PREFIX: 'staging-',
|
|
19
|
-
/** Suffix for staging worker hostnames (e.g., "bamboo-staging.playcademy.gg") */
|
|
20
|
-
STAGING_SUFFIX: '-staging',
|
|
21
|
-
} as const
|