Fix tile outlines drawn over units (miniquad only depth-tests with depth writes); Soul Core starts with a treasury ring

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-03 08:19:49 +01:00
1 parent 5158075d7b
commit 3e3084c35d
3 files changed
+28 -5

No files matched your search

+2 -1
View File
@@ -56,7 +56,8 @@ An original dungeon management game (genre: dungeon building & defence) that run
## Game content ## Game content
- **Digging**: mark earth/gold → Pit Imps dig, bring gold home and claim ground - **Digging**: mark earth/gold → Pit Imps dig, bring gold home and claim ground
- **Rooms**: treasury, lair, mushroom garden, training hall, library - **Rooms**: treasury, lair, mushroom garden, training hall, library (+ torture chamber, temple)
- The Soul Core starts surrounded by a **one tile wide ring of treasury** (16 tiles)
- Claim the **portal** → creatures: kobold, cave spider, shadow mage, stone ogre (depending on rooms) - Claim the **portal** → creatures: kobold, cave spider, shadow mage, stone ogre (depending on rooms)
- **Needs**: sleep, food, wages (payday); unhappy creatures leave - **Needs**: sleep, food, wages (payday); unhappy creatures leave
- **Hand**: pick up / drop own units (max. 8) - **Hand**: pick up / drop own units (max. 8)
+19
View File
@@ -386,6 +386,16 @@ impl Game {
hint_t: [-1000.0; 16], hint_t: [-1000.0; 16],
}; };
let (cx, cy) = g.map.core; let (cx, cy) = g.map.core;
// the soul core starts surrounded by a one tile wide ring of treasury
for y in cy - 1..=cy + 3 {
for x in cx - 1..=cx + 3 {
let t = &mut g.map.t[idx(x, y)];
if t.kind == Kind::Floor {
t.kind = Kind::Treasury;
t.owner = Owner::Player;
}
}
}
for k in 0..4 { for k in 0..4 {
g.spawn(EK::Worker, false, cx as f32 - 0.5, cy as f32 + k as f32 * 0.7 + 0.3, 1); g.spawn(EK::Worker, false, cx as f32 - 0.5, cy as f32 + k as f32 * 0.7 + 0.3, 1);
} }
@@ -3115,4 +3125,13 @@ mod tests {
g.plan_entries(); g.plan_entries();
assert_eq!(g.planned_entries.len(), 2); assert_eq!(g.planned_entries.len(), 2);
} }
#[test]
fn core_starts_with_treasury_ring() {
let g = Game::new(21, 64, 64);
let (cx, cy) = g.map.core;
let ring = (cy - 1..=cy + 3).flat_map(|y| (cx - 1..=cx + 3).map(move |x| (x, y))).filter(|&(x, y)| g.map.t[idx(x, y)].kind == Kind::Treasury).count();
assert_eq!(ring, 16);
assert_eq!(g.counts[0], 16);
}
} }
+7 -4
View File
@@ -262,7 +262,9 @@ void main() {
MaterialParams { MaterialParams {
pipeline_params: PipelineParams { pipeline_params: PipelineParams {
depth_test: Comparison::LessOrEqual, depth_test: Comparison::LessOrEqual,
depth_write: false, // miniquad only enables the depth *test* together with depth writes, so this
// material writes depth too; large translucent glows are therefore drawn last
depth_write: true,
color_blend: Some(BlendState::new(Equation::Add, BlendFactor::Value(BlendValue::SourceAlpha), BlendFactor::OneMinusValue(BlendValue::SourceAlpha))), color_blend: Some(BlendState::new(Equation::Add, BlendFactor::Value(BlendValue::SourceAlpha), BlendFactor::OneMinusValue(BlendValue::SourceAlpha))),
..Default::default() ..Default::default()
}, },
@@ -906,15 +908,16 @@ impl R3d {
draw_sphere(vec3(x, 0.8, z), 0.05 * fl, None, Color::new(1.0, 0.95, 0.6, 1.0)); draw_sphere(vec3(x, 0.8, z), 0.05 * fl, None, Color::new(1.0, 0.95, 0.6, 1.0));
} }
draw_shadows(g); draw_shadows(g);
draw_landmarks_glow(g, t);
draw_towers_glow(g, t);
if let Some(f) = g.flag { if let Some(f) = g.flag {
draw_flag(f, t); draw_flag(f, t);
} }
draw_overlay(&g.map, ov, self.wall_sub);
// translucent glows and effects last (they write depth, see glow_material)
draw_landmarks_glow(g, t);
draw_towers_glow(g, t);
for f in &g.fx { for f in &g.fx {
draw_fx(f, t); draw_fx(f, t);
} }
draw_overlay(&g.map, ov, self.wall_sub);
gl_use_default_material(); gl_use_default_material();
set_default_camera(); set_default_camera();