feat: simpler entities - 3x3 rectangle with hand (10 sub-bodies)

- Entity: 10 sub-bodies (was 16), radius 0.45 (was 0.7)
- Shape: 3x3 body rectangle + 1 hand cell on right side
- Much more compact, world appears larger relative to character
- 13 constraints (grid pattern + hand attachment)
- Spawn height adjusted for smaller body
This commit is contained in:
Emil
2026-06-20 21:42:16 +03:00
parent e96744b958
commit 595edc3006
3 changed files with 181 additions and 198 deletions
+155 -155
View File
@@ -1,28 +1,24 @@
=== Verbatim Headless Run: 30 ticks ===
=== Verbatim Headless Run: 20 ticks ===
World: 250x250
Player start: (125.0, 240.7)
Camera: (85, 228)
Player start: (125.0, 244.0)
Camera: (85, 232)
=== Tick 0 (initial state) ===
28
29
30
31
32
33
34
35
36
37 @
38 @@
39 @ @@
40 @ @ @ @
41 @ @
37
38
39
40
41
42
43 @ @ """""""""""""
44""" @ @ "":::::::::::::"""
45:::""" """::::::::::::::::::""
43 @@@ """""""""""""
44""" @@@@ "":::::::::::::"""
45:::""" @@@ """::::::::::::::::::""
46::::::"" "":::::::::::::::::::::::"""
47::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::"""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@@ -30,10 +26,15 @@ Camera: (85, 228)
50????????????????????????????????????????????????????????????????????????????????
51????????????????????????????????????????????????????????????????????????????????
52????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.0,240.7) bodies=16/16 on_fire=false"
53????????????????????????????????????????????????????????????????????????????????
54????????????????????????????????????????????????????????????????????????????????
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.0,244.0) bodies=10/10 on_fire=false"
Entities: 1
=== Tick 3 ===
=== Tick 2 ===
32
33
34
35
@@ -44,10 +45,10 @@ Entities: 1
40
41
42
43 @ """""""""""""
44""" @@@ "":::::::::::::"""
45:::""" @ @ """::::::::::::::::::""
46::::::"" @@@@@"":::::::::::::::::::::::"""
43 @@@ """""""""""""
44""" @@@@ "":::::::::::::"""
45:::""" @@@ """::::::::::::::::::""
46::::::"" "":::::::::::::::::::::::"""
47::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::"""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
@@ -58,12 +59,42 @@ Entities: 1
54????????????????????????????????????????????????????????????????????????????????
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
57????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.2,245.7) bodies=16/16 on_fire=false"
Player: "Player hp=100.0/100.0 pos=(125.0,244.1) bodies=10/10 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(125.2155, 245.7384))
Alive entities: Player(hp=100, pos=(125.0, 244.11879))
=== Tick 4 ===
32
33
34
35
36
37
38
39
40
41
42
43 @@@ """""""""""""
44""" @@@@ "":::::::::::::"""
45:::""" @@@ """::::::::::::::::::""
46::::::"" "":::::::::::::::::::::::"""
47::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::"""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
50????????????????????????????????????????????????????????????????????????????????
51????????????????????????????????????????????????????????????????????????????????
52????????????????????????????????????????????????????????????????????????????????
53????????????????????????????????????????????????????????????????????????????????
54????????????????????????????????????????????????????????????????????????????????
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.0,244.4) bodies=10/10 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(125.0, 244.38817))
=== Tick 6 ===
32
33
34
35
@@ -74,10 +105,39 @@ Alive entities: Player(hp=100, pos=(125.2155, 245.7384))
40
41
42
43 @@ """""""""""""
44""" @ @@ "":::::::::::::"""
45:::""" @ """::::::::::::::::::""
46::::::"" @@@@@"":::::::::::::::::::::::"""
43 @@@ """""""""""""
44""" @@@@ "":::::::::::::"""
45:::""" @@@ """::::::::::::::::::""
46::::::"" "":::::::::::::::::::::::"""
47::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::"""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
50????????????????????????????????????????????????????????????????????????????????
51????????????????????????????????????????????????????????????????????????????????
52????????????????????????????????????????????????????????????????????????????????
53????????????????????????????????????????????????????????????????????????????????
54????????????????????????????????????????????????????????????????????????????????
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.0,244.8) bodies=10/10 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(125.0, 244.79922))
=== Tick 8 ===
33
34
35
36
37
38
39
40
41
42
43 """""""""""""
44""" @@@ "":::::::::::::"""
45:::""" @@@@ """::::::::::::::::::""
46::::::"" @@@ "":::::::::::::::::::::::"""
47::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::"""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
@@ -89,11 +149,11 @@ Alive entities: Player(hp=100, pos=(125.2155, 245.7384))
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
57????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.1,245.6) bodies=16/16 on_fire=false"
Player: "Player hp=100.0/100.0 pos=(125.0,245.3) bodies=10/10 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(125.12183, 245.58759))
Alive entities: Player(hp=100, pos=(125.0, 245.3436))
=== Tick 9 ===
=== Tick 10 ===
33
34
35
@@ -104,11 +164,11 @@ Alive entities: Player(hp=100, pos=(125.12183, 245.58759))
40
41
42
43" @@ """""""""""""
44:""" @ @ @ "":::::::::::::"""
45::::""" @ """::::::::::::::::::""
46:::::::"" @@@@ "":::::::::::::::::::::::"""
47:::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::""""""""
43 """""""""""""
44""" @@@ "":::::::::::::"""
45:::""" @@@@ """::::::::::::::::::""
46::::::"" @@@ "":::::::::::::::::::::::"""
47::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::"""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
50????????????????????????????????????????????????????????????????????????????????
@@ -119,9 +179,9 @@ Alive entities: Player(hp=100, pos=(125.12183, 245.58759))
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
57????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.0,245.6) bodies=16/16 on_fire=false"
Player: "Player hp=100.0/100.0 pos=(125.0,245.6) bodies=10/10 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(124.960976, 245.61632))
Alive entities: Player(hp=100, pos=(125.0, 245.55))
=== Tick 12 ===
33
@@ -134,11 +194,11 @@ Alive entities: Player(hp=100, pos=(124.960976, 245.61632))
40
41
42
43" @@ """""""""""""
44:""" @@ @ "":::::::::::::"""
45::::""" @ """::::::::::::::::::""
46:::::::"" @@@@ "":::::::::::::::::::::::"""
47:::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::""""""""
43 """""""""""""
44""" @@@ "":::::::::::::"""
45:::""" @@@@ """::::::::::::::::::""
46::::::"" @@@ "":::::::::::::::::::::::"""
47::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::"""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
50????????????????????????????????????????????????????????????????????????????????
@@ -149,11 +209,11 @@ Alive entities: Player(hp=100, pos=(124.960976, 245.61632))
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
57????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(124.9,245.6) bodies=16/16 on_fire=false"
Player: "Player hp=100.0/100.0 pos=(125.0,245.6) bodies=10/10 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(124.91231, 245.6163))
Alive entities: Player(hp=100, pos=(125.0, 245.55))
=== Tick 15 ===
=== Tick 14 ===
33
34
35
@@ -164,10 +224,10 @@ Alive entities: Player(hp=100, pos=(124.91231, 245.6163))
40
41
42
43" @@ """""""""""""
44:""" @ @ @ "":::::::::::::"""
45::::""" @ """::::::::::::::::::""
46:::::::"" @@@@ "":::::::::::::::::::::::"""
43" """""""""""""
44:""" @@@ "":::::::::::::"""
45::::""" @@@@ """::::::::::::::::::""
46:::::::"" @@@ "":::::::::::::::::::::::"""
47:::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
@@ -179,9 +239,39 @@ Alive entities: Player(hp=100, pos=(124.91231, 245.6163))
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
57????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(124.9,245.6) bodies=16/16 on_fire=false"
Player: "Player hp=100.0/100.0 pos=(124.6,245.6) bodies=10/10 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(124.94001, 245.61577))
Alive entities: Player(hp=100, pos=(124.55, 245.55))
=== Tick 16 ===
33
34
35
36
37
38
39
40
41
42
43" """""""""""""
44:""" @@@ "":::::::::::::"""
45::::""" @@@@ """::::::::::::::::::""
46:::::::"" @@@ "":::::::::::::::::::::::"""
47:::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
50????????????????????????????????????????????????????????????????????????????????
51????????????????????????????????????????????????????????????????????????????????
52????????????????????????????????????????????????????????????????????????????????
53????????????????????????????????????????????????????????????????????????????????
54????????????????????????????????????????????????????????????????????????????????
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
57????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(124.6,245.6) bodies=10/10 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(124.55, 245.55))
=== Tick 18 ===
33
@@ -194,10 +284,10 @@ Alive entities: Player(hp=100, pos=(124.94001, 245.61577))
40
41
42
43" @@ """""""""""""
44:""" @ @ @ "":::::::::::::"""
45::::""" @ """::::::::::::::::::""
46:::::::"" @@@@ "":::::::::::::::::::::::"""
43" """""""""""""
44:""" @@@ "":::::::::::::"""
45::::""" @@@@ """::::::::::::::::::""
46:::::::"" @@@ "":::::::::::::::::::::::"""
47:::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
@@ -209,11 +299,11 @@ Alive entities: Player(hp=100, pos=(124.94001, 245.61577))
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
57????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.0,245.6) bodies=16/16 on_fire=false"
Player: "Player hp=100.0/100.0 pos=(124.6,245.6) bodies=10/10 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(124.97533, 245.61575))
Alive entities: Player(hp=100, pos=(124.55, 245.55))
=== Tick 21 ===
=== Tick 20 ===
33
34
35
@@ -224,10 +314,10 @@ Alive entities: Player(hp=100, pos=(124.97533, 245.61575))
40
41
42
43" @@ """""""""""""
44:""" @ @ @ "":::::::::::::"""
45::::""" @ """::::::::::::::::::""
46:::::::"" @@@@ "":::::::::::::::::::::::"""
43" """""""""""""
44:""" @@@ "":::::::::::::"""
45::::""" @@@@ """::::::::::::::::::""
46:::::::"" @@@ "":::::::::::::::::::::::"""
47:::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
@@ -239,97 +329,7 @@ Alive entities: Player(hp=100, pos=(124.97533, 245.61575))
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
57????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.0,245.6) bodies=16/16 on_fire=false"
Player: "Player hp=100.0/100.0 pos=(124.6,245.6) bodies=10/10 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(124.99407, 245.61584))
=== Tick 24 ===
33
34
35
36
37
38
39
40
41
42
43 @@ """""""""""""
44""" @ @ @ "":::::::::::::"""
45:::""" @ """::::::::::::::::::""
46::::::"" @@@@ "":::::::::::::::::::::::"""
47::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::"""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
50????????????????????????????????????????????????????????????????????????????????
51????????????????????????????????????????????????????????????????????????????????
52????????????????????????????????????????????????????????????????????????????????
53????????????????????????????????????????????????????????????????????????????????
54????????????????????????????????????????????????????????????????????????????????
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
57????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.0,245.6) bodies=16/16 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(125.003, 245.61584))
=== Tick 27 ===
33
34
35
36
37
38
39
40
41
42
43 @@ """""""""""""
44""" @ @ @ "":::::::::::::"""
45:::""" @ """::::::::::::::::::""
46::::::"" @@@@ "":::::::::::::::::::::::"""
47::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::"""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
50????????????????????????????????????????????????????????????????????????????????
51????????????????????????????????????????????????????????????????????????????????
52????????????????????????????????????????????????????????????????????????????????
53????????????????????????????????????????????????????????????????????????????????
54????????????????????????????????????????????????????????????????????????????????
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
57????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.0,245.6) bodies=16/16 on_fire=false"
Entities: 1
Alive entities: Player(hp=100, pos=(125.00714, 245.61584))
=== Tick 30 ===
33
34
35
36
37
38
39 g
40 gg
41 g gg
42 g g g g
43 g g @@ """""""""""""
44""" @ @ @ "":::::::::::::"""
45:::""" g g @ """::::::::::::::::::""
46::::::"" g g @@@@ "":::::::::::::::::::::::"""
47::::::::"""""""""""""""""""""""""""""""""""::::::::::::::::::::::::::::"""""""""
48::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
49################################################################################
50????????????????????????????????????????????????????????????????????????????????
51????????????????????????????????????????????????????????????????????????????????
52????????????????????????????????????????????????????????????????????????????????
53????????????????????????????????????????????????????????????????????????????????
54????????????????????????????????????????????????????????????????????????????????
55????????????????????????????????????????????????????????????????????????????????
56????????????????????????????????????????????????????????????????????????????????
57????????????????????????????????????????????????????????????????????????????????
Player: "Player hp=100.0/100.0 pos=(125.0,245.6) bodies=16/16 on_fire=false"
Entities: 2
Alive entities: Player(hp=100, pos=(125.009735, 245.61584)), Goblin(hp=40, pos=(110.0, 242.69376))
Alive entities: Player(hp=100, pos=(124.55, 245.55))
+24 -41
View File
@@ -107,7 +107,7 @@ impl Entity {
self.cvx = 0.0;
self.cvy = 0.0;
let r = 0.7;
let r = 0.45;
let mat = match self.kind {
EntityKind::Player => MaterialId::Flesh,
EntityKind::Goblin => MaterialId::Flesh,
@@ -115,22 +115,16 @@ impl Entity {
};
let layout = [
(0.0, -3.5, mat), // 0: head top
(-0.8, -3.0, mat), // 1: head left
(0.8, -3.0, mat), // 2: head right
(-1.8, -1.8, mat), // 3: left shoulder
(0.0, -1.8, mat), // 4: center torso
(1.8, -1.8, mat), // 5: right shoulder
(-1.0, -0.5, mat), // 6: left torso
(1.0, -0.5, mat), // 7: right torso
(-3.0, -1.0, mat), // 8: left hand
(3.0, -1.0, mat), // 9: right hand
(-1.2, 0.8, mat), // 10: left hip
(1.2, 0.8, mat), // 11: right hip
(-1.2, 2.2, mat), // 12: left leg
(1.2, 2.2, mat), // 13: right leg
(-1.5, 3.5, MaterialId::Bone), // 14: left foot
(1.5, 3.5, MaterialId::Bone), // 15: right foot
(-1.0, -1.0, mat), // 0: top-left
( 0.0, -1.0, mat), // 1: top-center
( 1.0, -1.0, mat), // 2: top-right
(-1.0, 0.0, mat), // 3: mid-left
( 0.0, 0.0, mat), // 4: center
( 1.0, 0.0, mat), // 5: mid-right
(-1.0, 1.0, mat), // 6: bot-left
( 0.0, 1.0, mat), // 7: bot-center
( 1.0, 1.0, mat), // 8: bot-right
( 2.0, 0.0, mat), // 9: hand
];
for &(ox, oy, m) in &layout {
@@ -139,30 +133,19 @@ impl Entity {
}
let mk = |a: usize, b: usize, len: f32| Constraint::new(a, b, len, 1.0);
self.constraints.push(mk(0, 1, 0.9));
self.constraints.push(mk(0, 2, 0.9));
self.constraints.push(mk(1, 2, 1.6));
self.constraints.push(mk(1, 3, 1.3));
self.constraints.push(mk(2, 5, 1.3));
self.constraints.push(mk(3, 4, 1.8));
self.constraints.push(mk(4, 5, 1.8));
self.constraints.push(mk(3, 6, 1.6));
self.constraints.push(mk(5, 7, 1.6));
self.constraints.push(mk(4, 6, 1.3));
self.constraints.push(mk(4, 7, 1.3));
self.constraints.push(mk(6, 7, 2.0));
self.constraints.push(mk(3, 8, 1.5));
self.constraints.push(mk(5, 9, 1.5));
self.constraints.push(mk(6, 10, 1.5));
self.constraints.push(mk(7, 11, 1.5));
self.constraints.push(mk(10, 11, 2.4));
self.constraints.push(mk(10, 12, 1.4));
self.constraints.push(mk(11, 13, 1.4));
self.constraints.push(mk(12, 14, 1.5));
self.constraints.push(mk(13, 15, 1.5));
self.constraints.push(mk(0, 4, 1.7));
self.constraints.push(mk(6, 10, 1.3));
self.constraints.push(mk(7, 11, 1.3));
self.constraints.push(mk(0, 1, 1.0));
self.constraints.push(mk(1, 2, 1.0));
self.constraints.push(mk(3, 4, 1.0));
self.constraints.push(mk(4, 5, 1.0));
self.constraints.push(mk(6, 7, 1.0));
self.constraints.push(mk(7, 8, 1.0));
self.constraints.push(mk(0, 3, 1.0));
self.constraints.push(mk(3, 6, 1.0));
self.constraints.push(mk(1, 4, 1.0));
self.constraints.push(mk(4, 7, 1.0));
self.constraints.push(mk(2, 5, 1.0));
self.constraints.push(mk(5, 8, 1.0));
self.constraints.push(mk(5, 9, 1.0));
}
pub fn sync_bodies_to_center(&mut self) {
+2 -2
View File
@@ -79,7 +79,7 @@ impl Game {
break;
}
}
let cy = (surface_y as f32) - 6.0;
let cy = (surface_y as f32) - 3.0;
self.player.spawn_at(&mut self.entities, cx, cy);
let (px, py) = self.player.center(&self.entities);
@@ -502,7 +502,7 @@ impl Game {
break;
}
}
let spawn_y = surface_y - 6;
let spawn_y = surface_y - 3;
if !self.grid.in_bounds(spawn_x, spawn_y) {
return;