popertots d7cbbaa04b feat: implement chunk unloading infrastructure
Chunk unloading system with cleanly abstracted decision layer.

- ChunkMap: replace (bool, i32) timer tuple with () presence marker;
  remove FIFO cycle fields pending_unload/unload_cycle/unload_cursor/
  unload_countdown. loaded_chunks is now HashMap<IVec2, ()>.
- handle_chunk_events: simplify re-entrancy check to contains_key;
  remove parallel Mutex dedup machinery — load detection is now trivial.
- is_standable: single HashMap get; return false for unloaded chunks
  instead of falling back to is_standable_slow (pathfinding correctness).
- remove_chunk_data: bounds-iteration tile cleanup for chunk unload.
- ChunkOwner component + chunk_entity_index: static terrain entities
  (floor tiles, fixtures, trees) tagged at spawn and despawned by
  chunk. Mobile entities (dorfs, pigs, rabbits) not tracked — safe
  by design since they were never indexed.
- unload_chunk: canonical single-chunk unload function; cleans
  loaded_chunks, despawns entities, removes tilemap data, marks render
  chunk dirty via ChunkZKey::from_world, updates connectivity, fires
  rebake. Full docstring with step-by-step state map, working example
  for dynamic unload, and "what it does NOT handle" section.
- dynamic_chunk_unloading_system: no-op stub. Re-enable by writing
  a system that diffs wanted vs loaded chunks and calls unload_chunk.
  Wired out of FixedUpdate during foundation work.
- render chunk fix: ChunkZKey::from_world now pub(crate) so unload
  can derive the correct render chunk key (spans 4x4 world chunks)
  matching what build_quilted_terrain_sprites uses at spawn.
- FloorTilePrefab::spawn: pre-existing bug — return Entity not ().
2026-03-20 10:30:33 +00:00
2024-12-17 19:44:54 +00:00
2025-09-14 19:04:34 +01:00
2024-12-30 22:19:25 +00:00
2026-03-18 23:19:58 +00:00
2026-03-18 23:19:58 +00:00
2024-12-12 18:01:08 +00:00
2026-03-19 20:17:15 +00:00

Dorf

This project is my way of learning Rust by recreating key aspects of Dwarf Fortress in Bevy. The aim is to build a feature-rich, procedurally generated simulation game, combining colony management, world-building, etc.

Project Goals

  • Learn Rust by implementing complex game systems.
  • Explore procedural generation techniques.
  • Develop an engaging simulation game inspired by Dwarf Fortress.

Current Status

Work in progress.

Features

Core Systems

Procedural World Generation

  • Terrain generation

    • Generate heightmaps and elevation
    • Add water bodies and erosion effects
    • Apply biome-specific textures
  • Biome distribution

    • Define biome attributes (temperature, rainfall, etc.)
    • Map biomes to regions based on attributes
    • Add transitional zones between biomes
  • Rivers, caves, and mountain ranges

    • Implement river pathfinding algorithms
    • Procedurally carve cave networks
    • Generate mountain chains with fractal noise

Resource Management

  • Gathering raw materials

    • Implement tree-cutting and stone-mining mechanics
    • Add dynamic replenishment or exhaustion of resources
  • Stockpile mechanics

    • Create system for defining and assigning stockpiles
    • Optimize pathfinding for resource transport
  • Crafting items and tools

    • Develop crafting recipes and progression
    • Add tools with different qualities and effects

Colony Simulation

  • Individual dwarves with unique traits

    • Generate personality traits and preferences
    • Assign skill proficiencies and growth over time
  • Needs and mood systems

    • Model basic needs (hunger, thirst, rest)
    • Implement mood modifiers and stress responses
  • Job assignment and task automation

    • Create task queue and priority system
    • Enable task reassignment dynamically

Gameplay Mechanics

Building and Construction

  • Rooms, workshops, and fortifications

    • Design grid-based construction system
    • Implement structural stability checks
  • Mining and digging mechanics

Combat and Defense

  • Squad management

    • Develop squad formation and control UI
    • Assign weapons and defensive equipment
  • Enemy invasions

    • Generate enemy waves with scaling difficulty
    • Simulate AI pathfinding and strategies
  • Traps and defenses

    • Add trap-building interface
    • Implement trigger mechanisms and consequences

Economy and Trade (Possible)

  • Trading with caravans

    • Generate trading caravans based on world events
    • Add barter or currency-based exchange
  • Currency and wealth system

    • Track wealth and its effects on game dynamics
    • Introduce theft and economic threats

Procedural Storytelling

Historical World-Building

  • Generate civilizations, leaders, and conflicts

    • Assign dynamic histories to regions and NPCs
    • Model geopolitical relationships
  • Persistent world history

    • Save and load historical data across game sessions
    • Link events and characters to history dynamically

Events and Narratives

  • Random and scripted events
    • Add contextual random events (e.g., resource scarcity, rival factions)

User Interface

  • Visual grid-based interface

    • Add visual overlays for resources, paths, and zones
  • Keyboard and mouse input

Roadmap

  1. Build procedural world generation prototype.
  2. Implement basic colony simulation.
  3. Add crafting and resource management mechanics.
  4. Introduce combat and defense systems.
  5. Polish user interface.
  6. Expand procedural storytelling and events.
S
Description
A DF inspired civ-sim RTS sandboxy thing
Readme
1.5 MiB
Languages
Rust 100%