Title demo: the knights come from a forest above ground; lighter meadow, darker trees, no lava above ground

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 23:09:49 +01:00
1 parent d54de78f37
commit 7da61d3d50
4 files changed
+88 -7

No files matched your search

+58 -5
View File
@@ -2,7 +2,8 @@
// the knights fight on a tongue of rock between a lava river (north) and an underground river
// (south). The dungeon side has a wall with a wooden, an iron and a magic door, rooms behind it
// (treasury, forge, library, lair, ...), a rune forge tower, a magic tower and a mana spring; all
// seven traps lie on the knights' way; the knights have their towers and the hero gate. Both sides
// seven traps lie on the knights' way; the knights have their towers, and their gate stands above
// ground in a sunny forest east of a cliff, from where they march in through two cave mouths. Both sides
// get balanced reinforcements, destroyed towers, doors and traps come back after a while, and now
// and then the dungeon casts a spell. Nothing here is ever saved.
@@ -31,6 +32,7 @@ pub struct Demo {
}
const WALL_X: i32 = RIVER_X - 8; // the dungeon's wall with its three doors
const SURF_X: i32 = 55; // from here east the land lies above ground (the knights come from there)
const CREATURES: [(EK, u32); 12] = [(EK::Kobold, 4), (EK::Spider, 3), (EK::Mage, 2), (EK::Ogre, 2), (EK::Jailer, 1), (EK::Priestess, 1), (EK::Bat, 2), (EK::Gargoyle, 1), (EK::Owl, 1), (EK::Wyrm, 1), (EK::Cogling, 1), (EK::Revenant, 1)];
const KNIGHTS: [(EK, u32); 8] = [(EK::Knight, 5), (EK::Archer, 3), (EK::Priest, 2), (EK::Dwarf, 2), (EK::Paladin, 1), (EK::Giant, 1), (EK::Fairy, 1), (EK::BattleMage, 1)];
@@ -183,8 +185,58 @@ impl Game {
let spring = idx(WALL_X - 3, BRIDGE_Y + 1);
g.map.t[spring].kind = Kind::ManaSpring;
g.map.t[spring].owner = Owner::Player;
// the hero gate on the knights' side
let (gx, gy) = (RIVER_X + 11, BRIDGE_Y);
// above ground in the east: grass, a forest at the edges, a cliff with two cave mouths
let mouth = |y: i32| (BRIDGE_Y - 4..=BRIDGE_Y - 1).contains(&y) || (BRIDGE_Y + 2..=BRIDGE_Y + 6).contains(&y);
for y in 1..H as i32 - 1 {
for x in SURF_X - 1..W as i32 - 1 {
let i = idx(x, y);
let border = y < 2 || y >= H as i32 - 2 || x >= W as i32 - 2;
if x < SURF_X + 1 {
// the cliff (or a cave mouth: knight ground)
if !border {
let t = &mut g.map.t[i];
t.kind = if mouth(y) { Kind::Floor } else { Kind::Rock };
t.owner = if mouth(y) { Owner::Hero } else { Owner::None };
t.reinforced = false;
t.gold = 0;
}
continue;
}
g.map.set_sky(i, true);
if border {
continue;
}
let t = &mut g.map.t[i];
t.owner = Owner::None;
t.gold = 0;
t.reinforced = false;
if t.kind == Kind::Rock && rng.f() < 0.6 {
continue; // a few rocks stay as outcrops
}
// trees along the north and south edges and in the far east; the march route stays open
let dy = (y - (BRIDGE_Y + 1)).abs();
let h = ((x * 73 + y * 151) as u32).wrapping_mul(2654435761) >> 24;
let wood = dy > 9 || x > W as i32 - 7;
t.kind = if wood && h % 3 != 0 { Kind::Tree } else { Kind::Floor };
t.hp = if t.kind == Kind::Tree { crate::wood::TREE_HP } else { 0.0 };
}
}
// the knight cave runs on to the cave mouths
for y in BRIDGE_Y - 4..=BRIDGE_Y + 6 {
if !mouth(y) {
continue;
}
let mut x = SURF_X - 1;
while x > RIVER_X + 3 && !g.map.t[idx(x, y)].walkable() {
let t = &mut g.map.t[idx(x, y)];
t.kind = Kind::Floor;
t.owner = Owner::Hero;
t.reinforced = false;
x -= 1;
}
}
// the hero gate on the knights' side, in the forest
let (gx, gy) = (SURF_X + 6, BRIDGE_Y);
for y in gy..gy + 3 {
for x in gx..gx + 3 {
let t = &mut g.map.t[idx(x, y)];
@@ -220,8 +272,9 @@ impl Game {
g.demo_spawn(true);
g.demo_spawn(false);
}
let mut cam = Cam::new(RIVER_X as f32 + 0.5, BRIDGE_Y as f32 + 1.5);
cam.zoom = 16.0;
// the camera between the battle on the tongue and the forest the knights come from
let mut cam = Cam::new(RIVER_X as f32 + 11.5, BRIDGE_Y as f32 + 1.5);
cam.zoom = 21.0;
(g, cam)
}