//! A village of 100 LLM villagers. //! //! Three layers: //! render/60fps — Bevy draws, bubbles update, bodies walk //! scheduling — wake queue + worker pool (6 in-flight Ollama calls) //! brain — each decision is one chat call with that person's own //! system prompt (persona + memories + perception) mod agent; mod llm; mod persona; mod sim_config; mod world; use bevy::diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin}; use bevy::input::mouse::{MouseMotion, MouseWheel}; use bevy::prelude::*; use bevy::window::PrimaryWindow; use agent::{move_bodies, update_bubbles, Names, Speech, Villager}; use llm::{deliver_talks, start_pool, LlmPool, VillagerEvent}; use world::VillageCamera; fn main() { App::new() .insert_resource(ClearColor(Color::srgb(0.06, 0.07, 0.10))) .add_plugins(DefaultPlugins.set(WindowPlugin { primary_window: Some(Window { title: "Village — 100 LLM villagers".into(), resolution: (1600, 950).into(), ..default() }), ..default() })) .add_plugins(FrameTimeDiagnosticsPlugin::default()) .init_resource::() .init_resource::() .add_message::() .add_systems( Startup, (sim_config::setup, start_pool, world::spawn_village, agent::spawn_villagers).chain(), ) .add_systems( Update, ( llm::schedule_wakes, llm::collect_results, deliver_talks, move_bodies, agent::tick_needs, update_bubbles, log_villager_events, pick_villager, hud, camera_controls, ) .chain(), ) .run(); } // --------------------------------------------------------------------------- // Console: every conversation printed as it happens // --------------------------------------------------------------------------- #[derive(Resource, Default)] pub struct EventLog { pub lines: Vec<(f32, String)>, } fn log_villager_events( time: Res