Skip to content

fix(Predator): add bulletSpawnDistance for concentric bullet spawn#195

Open
sandbushman wants to merge 1 commit into
abcxff:mainfrom
sandbushman:agent/predator-bullet-spawn-distance
Open

fix(Predator): add bulletSpawnDistance for concentric bullet spawn#195
sandbushman wants to merge 1 commit into
abcxff:mainfrom
sandbushman:agent/predator-bullet-spawn-distance

Conversation

@sandbushman

Copy link
Copy Markdown

Changes

Problem: Predator's 3 barrels have different visual sizes (110, 95, 80), and bullet spawn position was computed from barrel.physicsData.values.size. This caused the small bullet to spawn ahead of the mid bullet, which spawned ahead of the big bullet — all at different distances from tank center. In diep.io all 3 spawn concentrically.

Fix: Added optional bulletSpawnDistance field to BarrelDefinition. When set, it overrides the barrel's visual size for bullet spawn distance calculation. Set to 110 on all 3 Predator barrels so they all spawn at the same radius.

Bonus fix: The barrel.distance field in Bullet.ts was not being multiplied by scaleFactor, inconsistent with Barrel.ts. Fixed.

Files changed

File Change
src/Const/TankDefinitions.ts Added bulletSpawnDistance?: number to BarrelDefinition interface
src/Entity/Tank/Projectile/Bullet.ts Uses (bulletSpawnDistance ?? size) * scaleFactor for spawn position + fix distance scaling
src/Const/TankDefinitions.json Added bulletSpawnDistance: 110 to all 3 Predator barrels

No regression risk: bulletSpawnDistance is optional — defaults to size for all other tanks.

Predator's 3 barrels have different visual sizes (110, 95, 80) which was

causing their bullets to spawn at different distances from tank center

— small bullet ahead, big bullet behind. In diep.io all 3 spawn

concentrically.

Added optional bulletSpawnDistance field to BarrelDefinition. When set,

it overrides barrel visual size for bullet spawn distance calculation.

Set to 110 on all 3 Predator barrels for concentric spawn.

Also fixed: barrel.distance in Bullet.ts was not scaled by scaleFactor,

inconsistent with Barrel.ts where it is.

Signed-off-by: linuxdev
@c86ec23b-fef1-4979-b2fa-b9adc351b8cc

Copy link
Copy Markdown
Collaborator

This is probably not the right way to do this - Bullet spawn logic needs to be reworked eventually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants