@loonylabs/create-game 0.1.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/bin/create-game.js +213 -0
- package/package.json +18 -0
- package/template/.claude/skills/aigdtk-create-game-stories/SKILL.md +177 -0
- package/template/.claude/skills/aigdtk-create-game-stories/story-template.md +85 -0
- package/template/.claude/skills/aigdtk-implement-game-stories/SKILL.md +129 -0
- package/template/.claude/skills/aigdtk-new-game/SKILL.md +126 -0
- package/template/.claude/skills/aigdtk-shared/ascii-grammar.md +133 -0
- package/template/.claude/skills/aigdtk-shared/enemies.md +112 -0
- package/template/.claude/skills/aigdtk-shared/framework.md +93 -0
- package/template/.claude/skills/aigdtk-shared/visuals.md +125 -0
- package/template/apps/client/index.html +14 -0
- package/template/apps/client/package.json +31 -0
- package/template/apps/client/public/assets/audio/enemy_killed.wav +0 -0
- package/template/apps/client/src/components/App.svelte +290 -0
- package/template/apps/client/src/components/CraftingPanel.svelte +253 -0
- package/template/apps/client/src/components/DevPanel.svelte +180 -0
- package/template/apps/client/src/components/DungeonClearOverlay.svelte +53 -0
- package/template/apps/client/src/components/EquipmentPanel.svelte +191 -0
- package/template/apps/client/src/components/HealthBar.svelte +50 -0
- package/template/apps/client/src/components/Hub/BackToHubButton.svelte +37 -0
- package/template/apps/client/src/components/Hub/ExperienceCard.svelte +115 -0
- package/template/apps/client/src/components/Hub/Hub.svelte +88 -0
- package/template/apps/client/src/components/Inventory.svelte +174 -0
- package/template/apps/client/src/components/Runner/RunnerDeathScreen.svelte +182 -0
- package/template/apps/client/src/components/Runner/RunnerHUD.svelte +157 -0
- package/template/apps/client/src/components/Shooter/DamageNumbers.svelte +96 -0
- package/template/apps/client/src/components/Shooter/GameOverScreen.svelte +109 -0
- package/template/apps/client/src/components/Shooter/ShooterHUD.svelte +95 -0
- package/template/apps/client/src/components/SkillBar.svelte +146 -0
- package/template/apps/client/src/components/ToastSystem.svelte +158 -0
- package/template/apps/client/src/game.ts +918 -0
- package/template/apps/client/src/input.ts +92 -0
- package/template/apps/client/src/lib/audio/CombatDetector.test.ts +59 -0
- package/template/apps/client/src/lib/audio/CombatDetector.ts +53 -0
- package/template/apps/client/src/lib/audio/MusicManager.ts +137 -0
- package/template/apps/client/src/lib/audio/SoundManager.ts +59 -0
- package/template/apps/client/src/lib/audio/index.ts +9 -0
- package/template/apps/client/src/main.ts +32 -0
- package/template/apps/client/src/renderer/basecamp.ts +126 -0
- package/template/apps/client/src/renderer/dungeon.ts +250 -0
- package/template/apps/client/src/renderer/dungeonPortal.ts +73 -0
- package/template/apps/client/src/renderer/dungeonZone.ts +301 -0
- package/template/apps/client/src/renderer/entities.ts +197 -0
- package/template/apps/client/src/renderer/runnerTrack.ts +221 -0
- package/template/apps/client/src/renderer/shaders/SkyShader.ts +190 -0
- package/template/apps/client/src/renderer/shaders/TerrainShaderMaterial.ts +133 -0
- package/template/apps/client/src/renderer/shaders/floor.frag.glsl.ts +17 -0
- package/template/apps/client/src/renderer/shaders/shaderConfig.ts +18 -0
- package/template/apps/client/src/renderer/shaders/spawn.frag.glsl.ts +19 -0
- package/template/apps/client/src/renderer/shaders/terrain.frag.glsl.ts +314 -0
- package/template/apps/client/src/renderer/shaders/terrain.vert.glsl.ts +16 -0
- package/template/apps/client/src/renderer/shaders/wall.frag.glsl.ts +20 -0
- package/template/apps/client/src/renderer/shooterArena.ts +102 -0
- package/template/apps/client/src/renderer/voxelChunkStreamer.ts +79 -0
- package/template/apps/client/src/renderer/voxelMesh.ts +86 -0
- package/template/apps/client/src/renderer/voxelTerrain.ts +74 -0
- package/template/apps/client/src/socket.ts +268 -0
- package/template/apps/client/src/store.ts +74 -0
- package/template/apps/client/src/style.css +60 -0
- package/template/apps/client/tsconfig.json +11 -0
- package/template/apps/client/vite.config.ts +10 -0
- package/template/apps/client/vitest.config.ts +8 -0
- package/template/apps/experiences/diablo/index.ts +94 -0
- package/template/apps/experiences/diablo/systems/dungeonClearSystem.ts +60 -0
- package/template/apps/experiences/diablo/systems/enemyAISystem.ts +11 -0
- package/template/apps/experiences/diablo/systems/entitySyncSystem.ts +80 -0
- package/template/apps/experiences/diablo/systems/itemPickupSystem.ts +11 -0
- package/template/apps/experiences/diablo/systems/movementSystem.ts +13 -0
- package/template/apps/experiences/diablo/systems/physicsSystem.ts +92 -0
- package/template/apps/experiences/diablo/systems/transitionSystem.ts +105 -0
- package/template/apps/experiences/runner/data/runner-config.ts +54 -0
- package/template/apps/experiences/runner/index.ts +143 -0
- package/template/apps/experiences/runner/systems/collectibleSystem.ts +157 -0
- package/template/apps/experiences/runner/systems/deathSystem.ts +42 -0
- package/template/apps/experiences/runner/systems/entitySyncSystem.ts +59 -0
- package/template/apps/experiences/runner/systems/obstacleSystem.ts +91 -0
- package/template/apps/experiences/runner/systems/runnerPhysicsSystem.ts +82 -0
- package/template/apps/experiences/runner/systems/trackStreamSystem.ts +19 -0
- package/template/apps/experiences/runner/track/laneSystem.ts +53 -0
- package/template/apps/experiences/runner/track/segmentTypes.ts +141 -0
- package/template/apps/experiences/runner/track/trackGenerator.ts +292 -0
- package/template/apps/experiences/shooter/ai/aiStateMachine.ts +394 -0
- package/template/apps/experiences/shooter/ai/lineOfSight.ts +32 -0
- package/template/apps/experiences/shooter/arena/arenaGenerator.ts +101 -0
- package/template/apps/experiences/shooter/arena/arenaTypes.ts +49 -0
- package/template/apps/experiences/shooter/arena/hitscan.ts +101 -0
- package/template/apps/experiences/shooter/data/enemy-types.ts +108 -0
- package/template/apps/experiences/shooter/data/wave-definitions.ts +40 -0
- package/template/apps/experiences/shooter/data/weapon-config.ts +80 -0
- package/template/apps/experiences/shooter/index.ts +127 -0
- package/template/apps/experiences/shooter/systems/enemyAISystem.ts +113 -0
- package/template/apps/experiences/shooter/systems/entitySyncSystem.ts +68 -0
- package/template/apps/experiences/shooter/systems/shooterPhysicsSystem.ts +89 -0
- package/template/apps/experiences/shooter/systems/waveSpawnerSystem.ts +87 -0
- package/template/apps/experiences/shooter/systems/weaponSystem.ts +157 -0
- package/template/apps/game-data/src/areas/area-manifest.json +18 -0
- package/template/apps/game-data/src/assets/migration.test.ts +291 -0
- package/template/apps/game-data/src/audio/music-config.json +21 -0
- package/template/apps/game-data/src/audio/sound-config.json +11 -0
- package/template/apps/game-data/src/combat/action-types.ts +2 -0
- package/template/apps/game-data/src/combat/enemy-def.ts +12 -0
- package/template/apps/game-data/src/combat/hitboxes.ts +23 -0
- package/template/apps/game-data/src/dungeon/cell-types.ts +20 -0
- package/template/apps/game-data/src/dungeon/cell-visuals.ts +13 -0
- package/template/apps/game-data/src/dungeon/door-directions.ts +2 -0
- package/template/apps/game-data/src/enemies/enemy-defs.json +32 -0
- package/template/apps/game-data/src/equipment/slots.json +5 -0
- package/template/apps/game-data/src/events/event-defs.ts +20 -0
- package/template/apps/game-data/src/events/event-types.ts +10 -0
- package/template/apps/game-data/src/events/toast-config.json +49 -0
- package/template/apps/game-data/src/items/item-pool.json +13 -0
- package/template/apps/game-data/src/loot/item-pool.ts +14 -0
- package/template/apps/game-data/src/loot/rarities.ts +2 -0
- package/template/apps/game-data/src/physics/dungeon-physics-config.ts +12 -0
- package/template/apps/game-data/src/physics/jump-config.ts +17 -0
- package/template/apps/game-data/src/recipes/recipe-book.json +68 -0
- package/template/apps/game-data/src/rooms/room_basecamp.json +16 -0
- package/template/apps/game-data/src/rooms/room_corridor_ew.json +9 -0
- package/template/apps/game-data/src/rooms/room_corridor_ns.json +11 -0
- package/template/apps/game-data/src/rooms/room_crossroads.json +11 -0
- package/template/apps/game-data/src/rooms/room_dead_end.json +10 -0
- package/template/apps/game-data/src/rooms/room_staircase.json +12 -0
- package/template/apps/game-data/src/rooms/room_start.json +11 -0
- package/template/apps/game-data/src/skills/skill-book.json +20 -0
- package/template/apps/game-data/src/voxel/biome-terrain.ts +76 -0
- package/template/apps/game-data/src/voxel/materials.ts +45 -0
- package/template/apps/game-data/src/voxel/sandbox-terrain-config.ts +19 -0
- package/template/apps/game-data/src/world/area-config.ts +33 -0
- package/template/apps/game-data/src/world/biome-def.ts +15 -0
- package/template/apps/game-data/src/world/biomes.json +57 -0
- package/template/apps/game-data/src/world/movement.ts +2 -0
- package/template/apps/game-data/src/world/overworld-layout.test.ts +93 -0
- package/template/apps/game-data/src/world/overworld-layout.ts +127 -0
- package/template/apps/server/data/game.db +0 -0
- package/template/apps/server/package.json +30 -0
- package/template/apps/server/src/areaManager.ts +346 -0
- package/template/apps/server/src/db/client.ts +45 -0
- package/template/apps/server/src/db/schema.ts +40 -0
- package/template/apps/server/src/gameLoop.ts +267 -0
- package/template/apps/server/src/gameState.ts +3 -0
- package/template/apps/server/src/handlers/actionEvent.ts +55 -0
- package/template/apps/server/src/handlers/craftHandler.ts +59 -0
- package/template/apps/server/src/handlers/equipHandler.ts +73 -0
- package/template/apps/server/src/handlers/raycastHandler.ts +97 -0
- package/template/apps/server/src/handlers/skillHandler.ts +87 -0
- package/template/apps/server/src/handlers/terraformHandler.ts +74 -0
- package/template/apps/server/src/index.ts +597 -0
- package/template/apps/server/src/persistence.ts +135 -0
- package/template/apps/server/src/rooms.ts +20 -0
- package/template/apps/server/src/systems/dungeonPhysics.test.ts +32 -0
- package/template/apps/server/src/systems/dungeonPhysics.ts +16 -0
- package/template/apps/server/src/systems/enemyAI.ts +129 -0
- package/template/apps/server/src/systems/itemPickup.ts +31 -0
- package/template/apps/server/src/tests/areaManager.test.ts +77 -0
- package/template/apps/server/src/tests/diablo-experience.test.ts +60 -0
- package/template/apps/server/src/tests/runner-experience.test.ts +273 -0
- package/template/apps/server/src/tests/runner-powerups-scoring.test.ts +221 -0
- package/template/apps/server/src/tests/server.integration.test.ts +92 -0
- package/template/apps/server/src/tests/shooter-enemy-ai.test.ts +328 -0
- package/template/apps/server/src/tests/shooter-experience.test.ts +281 -0
- package/template/apps/server/src/tests/voxelChunkCache.test.ts +29 -0
- package/template/apps/server/src/tests/voxelSandbox.test.ts +133 -0
- package/template/apps/server/src/voxelChunkCache.ts +31 -0
- package/template/apps/server/src/voxelPlayerState.ts +23 -0
- package/template/apps/server/tsconfig.json +17 -0
- package/template/apps/server/vitest.config.ts +8 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { describe, test, expect } from 'vitest';
|
|
2
|
+
import { VoxelChunkCache } from '../voxelChunkCache.js';
|
|
3
|
+
import { createVoxelPlayerPhysics } from '../voxelPlayerState.js';
|
|
4
|
+
import { getTerrainHeight, updatePhysicsBody, updateJumpState, tryJump, snapToGround, consumeJumpBuffer, DEFAULT_PHYSICS_CONFIG, DEFAULT_JUMP_CONFIG } from '@loonylabs/gamedev-core';
|
|
5
|
+
import { SANDBOX_TERRAIN_OPTIONS, SANDBOX_SPAWN } from '../../../game-data/src/voxel/sandbox-terrain-config.js';
|
|
6
|
+
|
|
7
|
+
const SEED = 42;
|
|
8
|
+
|
|
9
|
+
function createSandboxEnv() {
|
|
10
|
+
const cache = new VoxelChunkCache(SEED, SANDBOX_TERRAIN_OPTIONS);
|
|
11
|
+
const getGroundY = (x: number, z: number) => getTerrainHeight(cache.getChunkFn, x, z);
|
|
12
|
+
return { cache, getGroundY };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe('Voxel Sandbox Physics', () => {
|
|
16
|
+
test('terrain height is queryable at spawn position', () => {
|
|
17
|
+
const { getGroundY } = createSandboxEnv();
|
|
18
|
+
const height = getGroundY(SANDBOX_SPAWN.x, SANDBOX_SPAWN.z);
|
|
19
|
+
expect(height).not.toBeNull();
|
|
20
|
+
expect(height).toBeGreaterThan(0);
|
|
21
|
+
expect(height).toBeLessThan(64);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('player spawns at terrain height and is grounded', () => {
|
|
25
|
+
const { getGroundY } = createSandboxEnv();
|
|
26
|
+
const spawnHeight = getGroundY(SANDBOX_SPAWN.x, SANDBOX_SPAWN.z)!;
|
|
27
|
+
const physics = createVoxelPlayerPhysics(SANDBOX_SPAWN.x, spawnHeight, SANDBOX_SPAWN.z);
|
|
28
|
+
|
|
29
|
+
expect(physics.body.x).toBe(SANDBOX_SPAWN.x);
|
|
30
|
+
expect(physics.body.y).toBe(spawnHeight);
|
|
31
|
+
expect(physics.body.z).toBe(SANDBOX_SPAWN.z);
|
|
32
|
+
expect(physics.body.isGrounded).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('gravity pulls player to ground when spawned in air', () => {
|
|
36
|
+
const { getGroundY } = createSandboxEnv();
|
|
37
|
+
const spawnHeight = getGroundY(SANDBOX_SPAWN.x, SANDBOX_SPAWN.z)!;
|
|
38
|
+
// Spawn 10 units above terrain
|
|
39
|
+
const physics = createVoxelPlayerPhysics(SANDBOX_SPAWN.x, spawnHeight + 10, SANDBOX_SPAWN.z);
|
|
40
|
+
physics.body.isGrounded = false;
|
|
41
|
+
|
|
42
|
+
// Simulate ~1 second (20 ticks at 50ms)
|
|
43
|
+
for (let i = 0; i < 20; i++) {
|
|
44
|
+
updatePhysicsBody(physics.body, 0.05, getGroundY, DEFAULT_PHYSICS_CONFIG);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
expect(physics.body.isGrounded).toBe(true);
|
|
48
|
+
expect(physics.body.y).toBeCloseTo(spawnHeight, 0);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('PLAYER_JUMP makes player airborne then lands', () => {
|
|
52
|
+
const { getGroundY } = createSandboxEnv();
|
|
53
|
+
const spawnHeight = getGroundY(SANDBOX_SPAWN.x, SANDBOX_SPAWN.z)!;
|
|
54
|
+
const physics = createVoxelPlayerPhysics(SANDBOX_SPAWN.x, spawnHeight, SANDBOX_SPAWN.z);
|
|
55
|
+
|
|
56
|
+
// Jump
|
|
57
|
+
const jumped = tryJump(physics.body, physics.jumpState, DEFAULT_JUMP_CONFIG);
|
|
58
|
+
expect(jumped).toBe(true);
|
|
59
|
+
expect(physics.body.isGrounded).toBe(false);
|
|
60
|
+
expect(physics.body.velocityY).toBeGreaterThan(0);
|
|
61
|
+
|
|
62
|
+
// Simulate until landing (~2 seconds)
|
|
63
|
+
for (let i = 0; i < 40; i++) {
|
|
64
|
+
updateJumpState(physics.jumpState, physics.body, 0.05);
|
|
65
|
+
updatePhysicsBody(physics.body, 0.05, getGroundY, DEFAULT_PHYSICS_CONFIG);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
expect(physics.body.isGrounded).toBe(true);
|
|
69
|
+
expect(physics.body.y).toBeCloseTo(spawnHeight, 0);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('horizontal movement snaps to terrain height for small steps', () => {
|
|
73
|
+
const { getGroundY } = createSandboxEnv();
|
|
74
|
+
const spawnHeight = getGroundY(SANDBOX_SPAWN.x, SANDBOX_SPAWN.z)!;
|
|
75
|
+
const physics = createVoxelPlayerPhysics(SANDBOX_SPAWN.x, spawnHeight, SANDBOX_SPAWN.z);
|
|
76
|
+
|
|
77
|
+
// Small step — within snap threshold
|
|
78
|
+
physics.body.x += 0.2;
|
|
79
|
+
physics.body.z += 0.2;
|
|
80
|
+
snapToGround(physics.body, getGroundY, DEFAULT_PHYSICS_CONFIG);
|
|
81
|
+
|
|
82
|
+
const newHeight = getGroundY(physics.body.x, physics.body.z);
|
|
83
|
+
expect(newHeight).not.toBeNull();
|
|
84
|
+
// For small steps, body should be snapped to terrain
|
|
85
|
+
if (physics.body.isGrounded) {
|
|
86
|
+
expect(physics.body.y).toBeCloseTo(newHeight!, 1);
|
|
87
|
+
} else {
|
|
88
|
+
// Walked off a cliff — gravity will handle it
|
|
89
|
+
expect(physics.body.isGrounded).toBe(false);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('large horizontal step off cliff makes player airborne', () => {
|
|
94
|
+
const { getGroundY } = createSandboxEnv();
|
|
95
|
+
const spawnHeight = getGroundY(SANDBOX_SPAWN.x, SANDBOX_SPAWN.z)!;
|
|
96
|
+
const physics = createVoxelPlayerPhysics(SANDBOX_SPAWN.x, spawnHeight, SANDBOX_SPAWN.z);
|
|
97
|
+
|
|
98
|
+
// Move far enough that terrain height differs significantly
|
|
99
|
+
physics.body.x += 5;
|
|
100
|
+
physics.body.z += 5;
|
|
101
|
+
snapToGround(physics.body, getGroundY, DEFAULT_PHYSICS_CONFIG);
|
|
102
|
+
|
|
103
|
+
const newHeight = getGroundY(physics.body.x, physics.body.z);
|
|
104
|
+
expect(newHeight).not.toBeNull();
|
|
105
|
+
// Either snapped or went airborne — both are valid physics behavior
|
|
106
|
+
if (Math.abs(spawnHeight - newHeight!) > DEFAULT_PHYSICS_CONFIG.groundSnapThreshold) {
|
|
107
|
+
// Large height difference — could go airborne
|
|
108
|
+
expect(true).toBe(true); // physics handled it
|
|
109
|
+
} else {
|
|
110
|
+
expect(physics.body.y).toBeCloseTo(newHeight!, 1);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('entity snapshot includes correct 3D data', () => {
|
|
115
|
+
const { getGroundY } = createSandboxEnv();
|
|
116
|
+
const spawnHeight = getGroundY(SANDBOX_SPAWN.x, SANDBOX_SPAWN.z)!;
|
|
117
|
+
const physics = createVoxelPlayerPhysics(SANDBOX_SPAWN.x, spawnHeight, SANDBOX_SPAWN.z);
|
|
118
|
+
|
|
119
|
+
// Simulate what the game loop does for ENTITY_SYNC
|
|
120
|
+
const snapshot = {
|
|
121
|
+
entityId: 1,
|
|
122
|
+
x: physics.body.x,
|
|
123
|
+
y: physics.body.z, // z maps to legacy y
|
|
124
|
+
z: physics.body.z,
|
|
125
|
+
worldY: physics.body.y, // height
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
expect(snapshot.x).toBe(SANDBOX_SPAWN.x);
|
|
129
|
+
expect(snapshot.y).toBe(SANDBOX_SPAWN.z);
|
|
130
|
+
expect(snapshot.z).toBe(SANDBOX_SPAWN.z);
|
|
131
|
+
expect(snapshot.worldY).toBe(spawnHeight);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { generateVoxelChunk, type VoxelChunk, type VoxelTerrainOptions, type TerrainQueryFn } from '@loonylabs/gamedev-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* On-demand voxel chunk cache. Generates chunks deterministically
|
|
5
|
+
* from seed + options and caches them for repeated access.
|
|
6
|
+
*
|
|
7
|
+
* When terrainQueryFn is provided, it takes precedence over options
|
|
8
|
+
* and enables per-column biome-blended terrain generation.
|
|
9
|
+
*/
|
|
10
|
+
export class VoxelChunkCache {
|
|
11
|
+
private chunks = new Map<string, VoxelChunk>();
|
|
12
|
+
|
|
13
|
+
constructor(
|
|
14
|
+
private seed: number,
|
|
15
|
+
private options?: VoxelTerrainOptions,
|
|
16
|
+
private terrainQueryFn?: TerrainQueryFn,
|
|
17
|
+
) {}
|
|
18
|
+
|
|
19
|
+
get(cx: number, cz: number): VoxelChunk {
|
|
20
|
+
const key = `${cx},${cz}`;
|
|
21
|
+
let chunk = this.chunks.get(key);
|
|
22
|
+
if (!chunk) {
|
|
23
|
+
chunk = generateVoxelChunk(cx, cz, this.seed, this.options ?? {}, this.terrainQueryFn);
|
|
24
|
+
this.chunks.set(key, chunk);
|
|
25
|
+
}
|
|
26
|
+
return chunk;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Compatible with getTerrainHeight's getChunk parameter. */
|
|
30
|
+
getChunkFn = (cx: number, cz: number): VoxelChunk | null => this.get(cx, cz);
|
|
31
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createPhysicsBody, createJumpState, type PhysicsBody, type JumpState } from '@loonylabs/gamedev-core';
|
|
2
|
+
|
|
3
|
+
export interface VoxelPlayerPhysics {
|
|
4
|
+
body: PhysicsBody;
|
|
5
|
+
jumpState: JumpState;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Per-player physics state for voxel areas. Keyed by socketId. */
|
|
9
|
+
export type VoxelPhysicsMap = Map<string, VoxelPlayerPhysics>;
|
|
10
|
+
|
|
11
|
+
/** Create physics state for a player spawning at a given 3D position. */
|
|
12
|
+
export function createVoxelPlayerPhysics(x: number, y: number, z: number): VoxelPlayerPhysics {
|
|
13
|
+
return {
|
|
14
|
+
body: createPhysicsBody(x, y, z),
|
|
15
|
+
jumpState: createJumpState(),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Global registry of voxel physics maps per area.
|
|
21
|
+
* The game loop registers its map here so message handlers can access it.
|
|
22
|
+
*/
|
|
23
|
+
export const voxelPhysicsRegistry = new Map<string, VoxelPhysicsMap>();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"skipLibCheck": true
|
|
14
|
+
},
|
|
15
|
+
"include": ["src"],
|
|
16
|
+
"exclude": ["node_modules", "dist"]
|
|
17
|
+
}
|