From bb3aabcf3e57b92d74f2bf15c1eae1b6696dc8fa Mon Sep 17 00:00:00 2001 From: Michael Mainguy Date: Tue, 28 Oct 2025 16:58:13 -0500 Subject: [PATCH] Refine gameplay balance and rendering performance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adjust difficulty parameters to improve game progression, optimize rendering with proper layer assignments, increase projectile velocity for better responsiveness, and clean up visual effects rendering. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/level1.ts | 22 +++++++++++----------- src/scoreboard.ts | 1 + src/ship.ts | 4 +++- src/starfield.ts | 18 +++++++++++------- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/level1.ts b/src/level1.ts index 6131162..00ebb26 100644 --- a/src/level1.ts +++ b/src/level1.ts @@ -73,25 +73,25 @@ export class Level1 implements Level { case 'recruit': return { rockCount: 5, - forceMultiplier: 1, + forceMultiplier: .5, rockSizeMin: 10, - rockSizeMax: 20, - distanceMin: 150, - distanceMax: 200 + rockSizeMax: 15, + distanceMin: 80, + distanceMax: 100 }; case 'pilot': return { rockCount: 10, - forceMultiplier: 1.6, - rockSizeMin: 3, - rockSizeMax: 8, - distanceMin: 120, - distanceMax: 220 + forceMultiplier: 1, + rockSizeMin: 8, + rockSizeMax: 12, + distanceMin: 80, + distanceMax: 150 }; case 'captain': return { rockCount: 20, - forceMultiplier: 2.0, + forceMultiplier: 1.2, rockSizeMin: 2, rockSizeMax: 7, distanceMin: 100, @@ -100,7 +100,7 @@ export class Level1 implements Level { case 'commander': return { rockCount: 50, - forceMultiplier: 2.5, + forceMultiplier: 1.3, rockSizeMin: 2, rockSizeMax: 8, distanceMin: 90, diff --git a/src/scoreboard.ts b/src/scoreboard.ts index a403618..9ff5823 100644 --- a/src/scoreboard.ts +++ b/src/scoreboard.ts @@ -38,6 +38,7 @@ export class Scoreboard { const parent = scene.getMeshById('RightUpperDisplay'); const scoreboard = MeshBuilder.CreatePlane("scoreboard", {width: 1, height: 1}, scene); + scoreboard.renderingGroupId = 3; const material = new StandardMaterial("scoreboard", scene); scoreboard.parent =parent; diff --git a/src/ship.ts b/src/ship.ts index d8c6ad3..85eb1a3 100644 --- a/src/ship.ts +++ b/src/ship.ts @@ -112,7 +112,7 @@ export class Ship { ammoAggregate.body.setMotionType(PhysicsMotionType.DYNAMIC); - ammoAggregate.body.setLinearVelocity(this._ship.forward.scale(10000)) + ammoAggregate.body.setLinearVelocity(this._ship.forward.scale(100000)) //.add(this._ship.physicsBody.getLinearVelocity())); window.setTimeout(() => { @@ -201,10 +201,12 @@ export class Ship { shipMesh.rotation.y = Math.PI; shipMesh.position.y = 1; shipMesh.position.z = -1; + shipMesh.renderingGroupId = 3; const light = new PointLight("ship.light", new Vector3(0, 1, .9), DefaultScene.MainScene); light.intensity = 4; light.includedOnlyMeshes = [shipMesh]; for (const mesh of shipMesh.getChildMeshes()) { + mesh.renderingGroupId = 3; if (mesh.material.id.indexOf('glass') === -1) { light.includedOnlyMeshes.push(mesh); } diff --git a/src/starfield.ts b/src/starfield.ts index d8a00fc..6c48d19 100644 --- a/src/starfield.ts +++ b/src/starfield.ts @@ -42,6 +42,9 @@ export class RockFactory { console.log("Pre-creating explosion particle systems..."); for (let i = 0; i < this._poolSize; i++) { const set = await ParticleHelper.CreateAsync("explosion", DefaultScene.MainScene); + set.systems.forEach((system) => { + system.renderingGroupId =1; + }) this._explosionPool.push(set); } console.log(`Created ${this._poolSize} explosion particle systems in pool`); @@ -70,8 +73,8 @@ export class RockFactory { //material.albedoColor = new Color3(1, 1, 1); //material.emissiveColor = new Color3(1, 1, 1); this._rockMesh.material = this._rockMaterial; - //importMesh.meshes[1].dispose(false, true); - //importMesh.meshes[0].dispose(); + importMesh.meshes[1].dispose(false, true); + importMesh.meshes[0].dispose(); } } } @@ -114,7 +117,7 @@ export class RockFactory { body.setLinearDamping(0); body.setMotionType(PhysicsMotionType.DYNAMIC); body.setCollisionCallbackEnabled(true); - + let scaling = Vector3.One(); body.getCollisionObservable().add((eventData) => { if (eventData.type == 'COLLISION_STARTED') { if ( eventData.collidedAgainst.transformNode.id == 'ammo') { @@ -124,7 +127,8 @@ export class RockFactory { eventData.collider.shape.dispose(); eventData.collider.transformNode.dispose(); eventData.collider.dispose(); - + scaling = eventData.collider.transformNode.scaling.clone(); + console.log(scaling); eventData.collidedAgainst.shape.dispose(); eventData.collidedAgainst.transformNode.dispose(); eventData.collidedAgainst.dispose(); @@ -137,7 +141,7 @@ export class RockFactory { ParticleHelper.CreateAsync("explosion", DefaultScene.MainScene).then((set) => { const point = MeshBuilder.CreateSphere("point", {diameter: 0.1}, DefaultScene.MainScene); point.position = position.clone(); - //point.isVisible = false; + point.isVisible = false; set.start(point); @@ -150,8 +154,8 @@ export class RockFactory { // Use pooled explosion const point = MeshBuilder.CreateSphere("point", {diameter: 10}, DefaultScene.MainScene); point.position = position.clone(); - //point.isVisible = false; - + point.isVisible = false; + point.scaling = scaling.multiplyByFloats(.2,.3,.2); console.log("Using pooled explosion with", explosion.systems.length, "systems at", position); // Set emitter and start each system individually