From c4914971299d1c59093c24fe3a0f7f392b8d42ea Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Tue, 10 Nov 2026 00:22:45 -0500 Subject: [PATCH 1/4] grenades in heaven exhibit a phase transition --- simulator/conf.toml | 8 ++++---- simulator/src/main.rs | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/simulator/conf.toml b/simulator/conf.toml index 7367e98..84ee812 100644 --- a/simulator/conf.toml +++ b/simulator/conf.toml @@ -1,11 +1,11 @@ -food_amount = 120 +food_amount = 920 red_count = 10 blu_count = 10 [weapon] -kills_user = false -model.type = "lazer" -model.range = 120 +kills_user = true +type = "forwardball" +radius = 90 [red_policy] aggressive = true diff --git a/simulator/src/main.rs b/simulator/src/main.rs index 6d22724..cd2f021 100644 --- a/simulator/src/main.rs +++ b/simulator/src/main.rs @@ -223,6 +223,7 @@ impl WeaponType { #[derive(Deserialize, Clone)] struct Weapon { kills_user: bool, + #[serde(flatten)] model: WeaponType, } From 710050f01ae32ebc8bb2dce3d6ff1e1674589431 Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Tue, 10 Nov 2026 00:26:49 -0500 Subject: [PATCH 2/4] increase resolve --- simulator/src/main.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/simulator/src/main.rs b/simulator/src/main.rs index cd2f021..fb0a185 100644 --- a/simulator/src/main.rs +++ b/simulator/src/main.rs @@ -116,11 +116,10 @@ impl Robot { if let Some(_) = contact(&pose, &*weapon, p_p , p_c, 0.0).unwrap() { peer.kill(); - if self.weapon.kills_user { - self.kill(); // o7 - } } - + } + if self.weapon.kills_user { + self.kill(); // o7 } } From bd22161bbc0e4909ce9ad7333c79ea515e9a71d9 Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Tue, 10 Nov 2026 00:38:42 -0500 Subject: [PATCH 3/4] view dist conf --- simulator/conf.toml | 5 +++-- simulator/src/main.rs | 13 +++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/simulator/conf.toml b/simulator/conf.toml index 84ee812..679c818 100644 --- a/simulator/conf.toml +++ b/simulator/conf.toml @@ -1,4 +1,5 @@ -food_amount = 920 +food_amount = 100 +view_dist = 200 red_count = 10 blu_count = 10 @@ -18,5 +19,5 @@ none= [0.3, 0.01] aggressive = false food = [1,0] kin = [-0.3,0.02] -nonkin = [0.3,-0.02] +nonkin = [-0.3,-0.02] none= [0.3, 0.01] diff --git a/simulator/src/main.rs b/simulator/src/main.rs index fb0a185..a3838ca 100644 --- a/simulator/src/main.rs +++ b/simulator/src/main.rs @@ -29,7 +29,6 @@ use clap::Parser; use serde::Deserialize; -const VIEW_DIST: f32 = 180.0; const BOT_RADIUS: f32 = 16.0; const KILL_RADIUS: f32 = 140.0; @@ -48,6 +47,7 @@ struct Robot { team: Color, policy: Policy, weapon: Weapon, + view_dist: f32, } impl Mortal for Robot { @@ -72,8 +72,8 @@ impl Mortal for Robot { } impl Robot { - fn new(pose: Pose, team: Color, policy: Policy, weapon: Weapon) -> Self { - Self { pose, alive: AtomicBool::new(true), collider: Ball::new(BOT_RADIUS), team, policy, weapon} + fn new(pose: Pose, team: Color, policy: Policy, weapon: Weapon, view_dist: f32) -> Self { + Self { pose, alive: AtomicBool::new(true), collider: Ball::new(BOT_RADIUS), team, policy, weapon, view_dist} } fn move_step(&mut self, forward_right: [f32;2]) { @@ -87,7 +87,7 @@ impl Robot { } fn view_end(&self) -> Vec2 { - self.pose.translation + self.ahead() * VIEW_DIST + self.pose.translation + self.ahead() * self.view_dist } @@ -229,6 +229,7 @@ struct Weapon { #[derive(Deserialize)] struct SimConfig { food_amount: usize, + view_dist: f32, red_count: usize, red_policy: Policy, blu_count: usize, @@ -261,14 +262,14 @@ impl Simulation { for i in 0..config.blu_count { let rand_angle = angle.sample(&mut rng); let pose:Pose = Pose::from_parts(Vec2 { x: 100.0, y: i as f32*50.0 + 250.0}, Rot2::from_angle(rand_angle)); - robots.push(Robot::new(pose, BLUE, config.blu_policy.clone(), config.weapon.clone())); + robots.push(Robot::new(pose, BLUE, config.blu_policy.clone(), config.weapon.clone(), config.view_dist)); } //red robots for i in 0..config.red_count { let rand_angle = angle.sample(&mut rng); let pose:Pose = Pose::from_parts(Vec2 { x: 1200.0, y: i as f32*50.0 + 250.0}, Rot2::from_angle(rand_angle)); - robots.push(Robot::new(pose, RED, config.red_policy.clone(), config.weapon.clone())); + robots.push(Robot::new(pose, RED, config.red_policy.clone(), config.weapon.clone(), config.view_dist)); } let mut food = Vec::new(); From 3af34dfb5e47455f8f3eb6c550c9825b4ff6a97c Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Tue, 10 Nov 2026 00:43:03 -0500 Subject: [PATCH 4/4] forwardball craters --- simulator/src/main.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/simulator/src/main.rs b/simulator/src/main.rs index a3838ca..b499618 100644 --- a/simulator/src/main.rs +++ b/simulator/src/main.rs @@ -30,7 +30,6 @@ use clap::Parser; use serde::Deserialize; const BOT_RADIUS: f32 = 16.0; -const KILL_RADIUS: f32 = 140.0; trait Mortal { fn collider(&self) -> (&Pose, &dyn Shape); @@ -99,8 +98,7 @@ impl Robot { } fn crater(&self) -> (f32, f32, f32, Color) { - let tl = self.pose.translation; - (tl.x, tl.y, KILL_RADIUS, ORANGE) + self.weapon.model.crater(self) } fn draw_weapon(&self) { @@ -217,6 +215,22 @@ impl WeaponType { }, } } + pub fn crater(&self, robot: &Robot) -> (f32, f32, f32, Color) { + match self { + WeaponType::Ball{radius} => { + let tl = robot.pose.translation; + (tl.x, tl.y, *radius, ORANGE) + }, + WeaponType::Lazer{range} => { + let tl = robot.pose.translation; + (tl.x, tl.y, *range, LIGHTGRAY) + }, + WeaponType::ForwardBall{radius} => { + let tl = robot.view_end(); + (tl.x, tl.y, *radius, ORANGE) + }, + } + } } #[derive(Deserialize, Clone)]