using System; using System.Collections.Generic; using System.Text; using Brutal.GlfwApi; using Brutal.ImGuiApi; using Brutal.ImGuiApi.Backends; using Brutal.Numerics; using Brutal.OpenGlApi; namespace BrutalVillageSim; public enum TileType { BorealSoil, GraniteVein, StoneWall, WoodFloor, KitchenFloor, LabFloor, HydroponicSoil, QuarryWalkway, Door, ElectricStove, ResearchBench, RiceCrop, CompactedSteel, DiningTable, Stockpile, Bed, PineTree } public enum JobType { Research, Cooking, Growing, Mining, Construct, Eating, Sleeping, Socializing } public sealed class Colonist { public string Name = ""; public string Role = ""; public string Trait = ""; public ImColor8 Color; public float2 Pos; public float2 TargetPos; public float Speed = 2.6f; // Core RimWorld Needs (0.0 .. 1.0) public float Hunger = 0.85f; public float Rest = 0.85f; public float Recreation = 0.85f; public float Comfort = 0.88f; public float Mood = 0.85f; // RimWorld 1..4 Work Priorities (1 = Highest, 4 = Lowest) public int[] Priorities = [1, 2, 2, 2, 2]; public JobType CurrentJob = JobType.Research; public string ActionText = "Surveying crashsite perimeter"; public string SpeechBubble = ""; public float SpeechTimer = 0f; public float WorkProgress = 0f; public int BedIndex; public List Thoughts = new(); } internal static class Program { private const int MapW = 24; private const int MapH = 15; private static readonly TileType[,] Map = new TileType[MapW, MapH]; private static readonly float[,] CropGrowth = new float[MapW, MapH]; private static readonly List Colonists = new(); private static readonly List SocialLog = new(); private static readonly Random Rng = new(42); // Colony Resources & Environment private static int _simpleMeals = 28; private static int _rawRice = 44; private static int _timber = 65; private static int _steel = 52; private static int _researchPoints = 140; private static float _outdoorTempC = 11.4f; private static float _simHours = 8.25f; private static int _simDay = 1; private static float _simSpeed = 1.0f; private static bool _paused = false; private static int _selectedColonist = 0; private static string _activeEventBanner = "Clear Boreal Skies (11°C) -- Rimhaven Crashsite operating nominally on BRUTAL"; private static float _eventBannerTimer = 0f; private static float _socialCooldown = 3.5f; private static void InitMap() { for (int x = 0; x < MapW; x++) { for (int y = 0; y < MapH; y++) { Map[x, y] = TileType.BorealSoil; CropGrowth[x, y] = 0.55f; } } // Boreal Pine Trees along northern & western perimeter int[] treeCoords = [1, 1, 3, 1, 6, 1, 9, 1, 13, 1, 16, 1, 1, 4, 1, 8, 1, 12, 5, 13, 12, 13, 16, 13]; for (int i = 0; i < treeCoords.Length; i += 2) Map[treeCoords[i], treeCoords[i + 1]] = TileType.PineTree; // Eastern Granite & Compacted Steel Quarry Vein (x = 19..23) for (int x = 20; x <= 23; x++) for (int y = 0; y < MapH; y++) Map[x, y] = TileType.GraniteVein; for (int y = 2; y <= 12; y++) { Map[18, y] = TileType.QuarryWalkway; Map[19, y] = TileType.QuarryWalkway; } Map[19, 4] = TileType.CompactedSteel; Map[19, 7] = TileType.CompactedSteel; Map[19, 10] = TileType.CompactedSteel; // Main Colony Compound Outer Walls (x = 2..17, y = 2..12) BuildRoom(2, 2, 9, 7, TileType.LabFloor); // Research & Comms Lab BuildRoom(9, 2, 17, 7, TileType.KitchenFloor); // Kitchen, Stove & Dining Hall BuildRoom(2, 7, 9, 12, TileType.WoodFloor); // Crashlanded Barracks Dormitory BuildRoom(9, 7, 17, 12, TileType.HydroponicSoil); // Hydroponics & Rice Field // Doors connecting rooms and exterior Map[5, 7] = TileType.Door; Map[9, 4] = TileType.Door; Map[9, 9] = TileType.Door; Map[13, 7] = TileType.Door; Map[17, 5] = TileType.Door; Map[17, 9] = TileType.Door; Map[5, 12] = TileType.Door; // Workstations & Furniture Map[4, 3] = TileType.ResearchBench; Map[6, 3] = TileType.ResearchBench; Map[4, 5] = TileType.ResearchBench; Map[11, 3] = TileType.ElectricStove; Map[13, 3] = TileType.ElectricStove; Map[12, 5] = TileType.DiningTable; Map[14, 5] = TileType.DiningTable; Map[15, 3] = TileType.Stockpile; Map[15, 4] = TileType.Stockpile; // 6 Colonist Beds in Barracks Map[3, 8] = TileType.Bed; Map[5, 8] = TileType.Bed; Map[7, 8] = TileType.Bed; Map[3, 10] = TileType.Bed; Map[5, 10] = TileType.Bed; Map[7, 10] = TileType.Bed; // Rice Crop Rows in Hydroponics & Field for (int x = 11; x <= 15; x++) { Map[x, 9] = TileType.RiceCrop; Map[x, 11] = TileType.RiceCrop; CropGrowth[x, 9] = 0.45f + (x - 11) * 0.1f; CropGrowth[x, 11] = 0.65f + (x - 11) * 0.06f; } } private static void BuildRoom(int x0, int y0, int x1, int y1, TileType floor) { for (int x = x0; x <= x1; x++) { for (int y = y0; y <= y1; y++) { bool border = x == x0 || x == x1 || y == y0 || y == y1; Map[x, y] = border ? TileType.StoneWall : floor; } } } private static void InitColonists() { Colonists.Clear(); Colonists.Add(new Colonist { Name = "Maya Lin", Role = "Crashlanded Systems Engineer", Trait = "Fast Learner & Night Owl", Color = new ImColor8(124, 92, 255), Pos = new float2(4.5f, 3.5f), TargetPos = new float2(4.5f, 3.5f), Priorities = [1, 3, 2, 2, 2], BedIndex = 0, Thoughts = [ "+10 New colony optimism", "+8 Calibrated orbital comms array", "+5 Very impressive research lab" ] }); Colonists.Add(new Colonist { Name = "Caleb Vance", Role = "Frontier Surgeon & Cook", Trait = "Iron-Willed & Gourmand", Color = new ImColor8(249, 115, 22), Pos = new float2(11.5f, 3.5f), TargetPos = new float2(11.5f, 3.5f), Priorities = [3, 1, 2, 3, 1], BedIndex = 1, Thoughts = [ "+10 New colony optimism", "+6 Cooked hot batch of simple meals", "-3 Ate without table (yesterday)" ] }); Colonists.Add(new Colonist { Name = "Elena Rostova", Role = "Exobiologist & Botanist", Trait = "Green Thumb & Kind", Color = new ImColor8(52, 211, 153), Pos = new float2(12.5f, 9.5f), TargetPos = new float2(12.5f, 9.5f), Priorities = [2, 2, 1, 3, 2], BedIndex = 2, Thoughts = [ "+10 New colony optimism", "+6 Thriving hydroponic rice harvest", "+4 Crisp boreal forest air" ] }); Colonists.Add(new Colonist { Name = "Jonas Cole", Role = "Deep-Core Quarry Miner", Trait = "Industrious & Tough", Color = new ImColor8(56, 189, 248), Pos = new float2(18.5f, 5.5f), TargetPos = new float2(19.5f, 4.5f), Priorities = [3, 3, 3, 1, 1], BedIndex = 3, Thoughts = [ "+10 New colony optimism", "+7 Struck rich compacted steel vein", "+4 Comfortable barracks bed" ] }); Colonists.Add(new Colonist { Name = "Tessa Kael", Role = "Master Carpenter & Builder", Trait = "Steadfast & Nimble", Color = new ImColor8(244, 114, 182), Pos = new float2(14.5f, 4.5f), TargetPos = new float2(15.5f, 3.5f), Priorities = [2, 2, 2, 2, 1], BedIndex = 4, Thoughts = [ "+10 New colony optimism", "+6 Built insulated granite perimeter wall", "+5 Impressive dining hall" ] }); Colonists.Add(new Colonist { Name = "Marcus Hale", Role = "Colonial Scout & Ranger", Trait = "Sharp-Eyed & Jogger", Color = new ImColor8(250, 204, 21), Pos = new float2(8.5f, 6.5f), TargetPos = new float2(12.5f, 5.5f), Priorities = [2, 2, 1, 1, 2], BedIndex = 5, Thoughts = [ "+10 New colony optimism", "+6 Eastern quarry ridge secure", "+4 Warm synth-thread parka" ] }); AddLog("D1 08:00 -- Drop pods landed in Sector 7 Boreal Basin; 6 survivors established Rimhaven Crashsite."); AddLog("D1 08:05 -- Jonas Cole exposed a rich compacted steel vein along the eastern granite ridge."); AddLog("D1 08:12 -- Caleb Vance fired up the electric stove and stocked 28 simple meals."); } private static void AddLog(string entry) { SocialLog.Insert(0, entry); if (SocialLog.Count > 24) SocialLog.RemoveAt(SocialLog.Count - 1); } private static void AssignNextJob(Colonist c) { if (c.Hunger < 0.34f && _simpleMeals > 0) { c.CurrentJob = JobType.Eating; c.TargetPos = new float2(12.5f + Rng.Next(0, 2) * 2f, 5.5f); c.ActionText = "Eating Simple Meal at dining table"; c.SpeechBubble = "Hot meal at a real table!"; c.SpeechTimer = 3.2f; return; } if (c.Rest < 0.28f || (_simHours >= 22.5f || _simHours < 5.5f) && c.Rest < 0.78f) { c.CurrentJob = JobType.Sleeping; float2[] beds = [ new float2(3.5f, 8.5f), new float2(5.5f, 8.5f), new float2(7.5f, 8.5f), new float2(3.5f, 10.5f), new float2(5.5f, 10.5f), new float2(7.5f, 10.5f) ]; c.TargetPos = beds[c.BedIndex % beds.Length]; c.ActionText = "Sleeping in barracks bunk"; c.SpeechBubble = "Zzz..."; c.SpeechTimer = 2.5f; return; } int bestJob = 0; int bestPrio = 99; for (int j = 0; j < 5; j++) { int p = c.Priorities[j] * 10 + Rng.Next(0, 6); if (p < bestPrio) { bestPrio = p; bestJob = j; } } switch (bestJob) { case 0: c.CurrentJob = JobType.Research; float2[] benches = [new float2(4.5f, 3.5f), new float2(6.5f, 3.5f), new float2(4.5f, 5.5f)]; c.TargetPos = benches[Rng.Next(benches.Length)]; c.ActionText = "Researching Geothermal Power & Microelectronics"; break; case 1: c.CurrentJob = JobType.Cooking; c.TargetPos = new float2(11.5f + Rng.Next(0, 2) * 2f, 3.5f); c.ActionText = "Cooking Simple Meals at electric stove"; break; case 2: c.CurrentJob = JobType.Growing; c.TargetPos = new float2(11.5f + Rng.Next(0, 5), Rng.Next(0, 2) == 0 ? 9.5f : 11.5f); c.ActionText = "Tending & harvesting hydroponic rice"; break; case 3: c.CurrentJob = JobType.Mining; int vy = Rng.Next(0, 3) switch { 0 => 4, 1 => 7, _ => 10 }; c.TargetPos = new float2(19.5f, vy + 0.5f); c.ActionText = "Mining compacted steel at eastern vein"; break; default: c.CurrentJob = JobType.Construct; c.TargetPos = new float2(15.5f, 3.5f + Rng.Next(0, 2)); c.ActionText = "Hauling steel & timber to stockpile zone"; break; } } private static void TriggerStorytellerEvent(int eventId) { string timeTag = $"D{_simDay} {(int)_simHours:D2}:{(int)((_simHours % 1f) * 60):D2}"; switch (eventId) { case 0: _simpleMeals += 12; _steel += 15; _activeEventBanner = "EVENT: Cargo Pods landed near perimeter! (+12 Simple Meals, +15 Steel)"; AddLog($"{timeTag} -- [Cargo Pod Drop] Orbital supply pods dropped +12 Simple Meals and +15 Steel."); foreach (var c in Colonists) { c.Mood = Math.Clamp(c.Mood + 0.06f, 0.1f, 1.0f); c.SpeechBubble = "Cargo pods!"; c.SpeechTimer = 3.5f; } break; case 1: _researchPoints += 20; _activeEventBanner = "EVENT: Brief Solar Flare! Comms calibrated afterward (+20 Research)"; AddLog($"{timeTag} -- [Solar Flare] Magnetic surge swept Sector 7; Maya Lin logged +20 Research pts."); break; case 2: _outdoorTempC = -6.5f; _timber = Math.Max(0, _timber - 5); _activeEventBanner = "EVENT: Boreal Cold Snap (-6.5°C)! Heaters drawing extra power."; AddLog($"{timeTag} -- [Cold Snap] Boreal frost dropped outdoor temp to -6.5°C; barracks heaters active."); foreach (var c in Colonists) { c.Comfort = Math.Clamp(c.Comfort + 0.05f, 0.1f, 1.0f); c.SpeechBubble = "Glad the heaters work!"; c.SpeechTimer = 3.5f; } break; case 3: _steel += 10; _activeEventBanner = "EVENT: Raider Scout repelled at eastern ridge! (+10 salvaged Steel)"; AddLog($"{timeTag} -- [Perimeter Defense] Marcus Hale & Jonas Cole drove off a lone scavenger scout."); for (int x = 11; x <= 15; x++) { CropGrowth[x, 9] = Math.Clamp(CropGrowth[x, 9] + 0.20f, 0f, 1f); CropGrowth[x, 11] = Math.Clamp(CropGrowth[x, 11] + 0.20f, 0f, 1f); } break; } _eventBannerTimer = 10f; } private static void UpdateSimulation(float dt) { if (_paused) return; float scaledDt = dt * _simSpeed; _simHours += scaledDt * 0.35f; if (_simHours >= 24f) { _simHours -= 24f; _simDay++; } // Gentle diurnal temperature curve around 9..14C unless Cold Snap is active if (_eventBannerTimer <= 0f) _outdoorTempC = 10.0f + MathF.Sin((_simHours - 6f) / 24f * MathF.Tau) * 4.5f; if (_eventBannerTimer > 0f) { _eventBannerTimer -= scaledDt; if (_eventBannerTimer <= 0f) _activeEventBanner = $"Clear Boreal Skies ({_outdoorTempC:F1}°C) -- Rimhaven Crashsite operating nominally on BRUTAL"; } // Grow hydroponic rice crops for (int x = 11; x <= 15; x++) { CropGrowth[x, 9] = Math.Clamp(CropGrowth[x, 9] + scaledDt * 0.012f, 0f, 1f); CropGrowth[x, 11] = Math.Clamp(CropGrowth[x, 11] + scaledDt * 0.012f, 0f, 1f); } foreach (var c in Colonists) { c.Hunger = Math.Clamp(c.Hunger - scaledDt * 0.011f, 0.08f, 1.0f); c.Rest = Math.Clamp(c.Rest - scaledDt * 0.008f, 0.08f, 1.0f); c.Recreation = Math.Clamp(c.Recreation - scaledDt * 0.006f, 0.15f, 1.0f); if (c.SpeechTimer > 0f) c.SpeechTimer -= scaledDt; float2 delta = c.TargetPos - c.Pos; float dist = delta.Length(); if (dist > 0.12f) { c.Pos += (delta / dist) * Math.Min(dist, c.Speed * scaledDt); } else { c.WorkProgress += scaledDt * 0.32f; if (c.WorkProgress >= 1.0f) { c.WorkProgress = 0f; switch (c.CurrentJob) { case JobType.Research: _researchPoints += 5; c.Recreation = Math.Clamp(c.Recreation + 0.07f, 0f, 1f); break; case JobType.Cooking: if (_rawRice >= 2) { _rawRice -= 2; _simpleMeals += 3; } else { _simpleMeals += 2; } c.Comfort = Math.Clamp(c.Comfort + 0.06f, 0f, 1f); break; case JobType.Growing: _rawRice += 4; int gx = Math.Clamp((int)c.TargetPos.X, 11, 15); int gy = Math.Clamp((int)c.TargetPos.Y, 9, 11); CropGrowth[gx, gy] = 0.25f; break; case JobType.Mining: _steel += 3; break; case JobType.Construct: _timber += 2; c.Recreation = Math.Clamp(c.Recreation + 0.05f, 0f, 1f); break; case JobType.Eating: _simpleMeals = Math.Max(0, _simpleMeals - 1); c.Hunger = Math.Clamp(c.Hunger + 0.55f, 0f, 1f); c.Comfort = Math.Clamp(c.Comfort + 0.12f, 0f, 1f); break; case JobType.Sleeping: c.Rest = Math.Clamp(c.Rest + 0.55f, 0f, 1f); break; } AssignNextJob(c); } } c.Mood = Math.Clamp((c.Hunger * 0.28f) + (c.Rest * 0.26f) + (c.Recreation * 0.22f) + (c.Comfort * 0.24f), 0.15f, 0.99f); } _socialCooldown -= scaledDt; if (_socialCooldown <= 0f) { _socialCooldown = 5.5f; int a = Rng.Next(Colonists.Count); int b = (a + 1 + Rng.Next(Colonists.Count - 1)) % Colonists.Count; var ca = Colonists[a]; var cb = Colonists[b]; string timeTag = $"D{_simDay} {(int)_simHours:D2}:{(int)((_simHours % 1f) * 60):D2}"; string[] topics = [ $"{timeTag} -- {ca.Name} & {cb.Name} discussed geothermal turbine blueprints over dinner (+4 Mood).", $"{timeTag} -- {ca.Name} helped {cb.Name} haul compacted steel from the eastern vein (+5 Opinion).", $"{timeTag} -- {ca.Name} & {cb.Name} played horseshoes outside the barracks (+5 Recreation).", $"{timeTag} -- {ca.Name} complimented {cb.Name}'s hydroponic rice yield (+4 Mood)." ]; AddLog(topics[Rng.Next(topics.Length)]); ca.SpeechBubble = "Good talk!"; ca.SpeechTimer = 2.4f; } } private static ImColor8 GetTileColor(TileType t, int x, int y) { return t switch { TileType.BorealSoil => ((x + y) % 2 == 0) ? new ImColor8(32, 54, 42) : new ImColor8(28, 48, 38), TileType.GraniteVein => ((x + y) % 2 == 0) ? new ImColor8(71, 85, 105) : new ImColor8(51, 65, 85), TileType.StoneWall => new ImColor8(100, 116, 139), TileType.WoodFloor => new ImColor8(92, 64, 51), TileType.KitchenFloor => new ImColor8(78, 68, 56), TileType.LabFloor => new ImColor8(35, 52, 78), TileType.HydroponicSoil => new ImColor8(24, 72, 54), TileType.QuarryWalkway => new ImColor8(82, 74, 62), TileType.Door => new ImColor8(180, 130, 70), TileType.ElectricStove => new ImColor8(220, 68, 45), TileType.ResearchBench => new ImColor8(56, 189, 248), TileType.RiceCrop => new ImColor8(16, 165, 114), TileType.CompactedSteel => new ImColor8(245, 158, 11), TileType.DiningTable => new ImColor8(146, 100, 56), TileType.Stockpile => new ImColor8(113, 113, 60), TileType.Bed => new ImColor8(124, 92, 205), TileType.PineTree => new ImColor8(22, 101, 52), _ => new ImColor8(40, 40, 40) }; } private static unsafe void Main() { InitMap(); InitColonists(); if (!Glfw.Init()) throw new Exception("Failed to initialize GLFW"); Glfw.WindowHint(GlfwWindowHint.ContextVersionMajor, 4); Glfw.WindowHint(GlfwWindowHint.ContextVersionMinor, 1); using var window = Glfw.CreateWindow(new GlfwWindow.CreateInfo { Title = "Rimhaven Crashsite -- BRUTAL Framework C# Colony Simulator (Ahwoo.BRUTAL .NET 10)", Size = new int2(1016, 728), }); window.Position = new int2(4, 4); window.MakeContextCurrent(); Glfw.SwapInterval(1); if (!Glad.Initialize(Glfw.PInvoke.GetProcAddress)) throw new Exception("Failed to initialize OpenGL via Brutal.OpenGl.Glad"); ImGui.CreateContext(); ImGui.StyleColorsDark(); using var glfwBackend = new GlfwBackend(window, GlfwBackend.ClientApi.OpenGL); using var glBackend = new OpenGlBackend(); double lastTime = Glfw.Time; while (!window.ShouldClose) { Glfw.PollEvents(); double now = Glfw.Time; float dt = Math.Clamp((float)(now - lastTime), 0.001f, 0.1f); lastTime = now; UpdateSimulation(dt); glfwBackend.NewFrame(); glBackend.NewFrame(); ImGui.NewFrame(); // 1. TOP HUD BAR: COLONY TELEMETRY & CONTROLS ImGui.SetNextWindowPos(new float2(6, 6), ImGuiCond.Always); ImGui.SetNextWindowSize(new float2(1004, 92), ImGuiCond.Always); ImGui.Begin("Rimhaven Crashsite -- RimWorld-Style Frontier Colony Sim on Ahwoo.BRUTAL (C# / .NET 10)"u8, ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove); string topBar = $"Day {_simDay} ({(int)_simHours:D2}:{(int)((_simHours % 1f) * 60):D2}) | Temp: {_outdoorTempC:F1}C | Meals: {_simpleMeals} | Rice: {_rawRice} | Timber: {_timber} | Steel: {_steel} | Research: {_researchPoints}"; ImGui.TextColored(new float4(0.98f, 0.82f, 0.32f, 1f), Encoding.UTF8.GetBytes(topBar)); ImGui.SameLine(); if (ImGui.SmallButton(_paused ? (ReadOnlySpan)"Play"u8 : "Pause"u8)) _paused = !_paused; ImGui.SameLine(); if (ImGui.SmallButton("1x"u8)) { _paused = false; _simSpeed = 1.0f; } ImGui.SameLine(); if (ImGui.SmallButton("3x"u8)) { _paused = false; _simSpeed = 3.0f; } ImGui.SameLine(); if (ImGui.SmallButton("Cargo Pods"u8)) TriggerStorytellerEvent(0); ImGui.SameLine(); if (ImGui.SmallButton("Cold Snap"u8)) TriggerStorytellerEvent(2); // Colonist Quick-Select Roster Bar for (int i = 0; i < Colonists.Count; i++) { if (i > 0) ImGui.SameLine(); var c = Colonists[i]; string label = i == _selectedColonist ? $"* {c.Name} ({(int)(c.Mood * 100)}%) *" : $"{c.Name} ({(int)(c.Mood * 100)}%)"; if (ImGui.Button(Encoding.UTF8.GetBytes(label), new float2(156, 28))) _selectedColonist = i; } ImGui.End(); // 2. LEFT PANEL: 2D TILEMAP & PAWN RENDERER (ImGui DrawList) ImGui.SetNextWindowPos(new float2(6, 102), ImGuiCond.Always); ImGui.SetNextWindowSize(new float2(644, 445), ImGuiCond.Always); ImGui.Begin("Rimhaven Sector 7 Map (Click Colonist to Inspect | Built on Ahwoo.BRUTAL)"u8, ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove); var drawList = ImGui.GetWindowDrawList(); float2 origin = new float2(16, 132); const float tileSize = 25.5f; for (int x = 0; x < MapW; x++) { for (int y = 0; y < MapH; y++) { float2 pMin = origin + new float2(x * tileSize, y * tileSize); float2 pMax = pMin + new float2(tileSize - 1f, tileSize - 1f); TileType t = Map[x, y]; drawList.AddRectFilled(pMin, pMax, GetTileColor(t, x, y), 2f); if (t == TileType.RiceCrop) { float g = CropGrowth[x, y]; float barW = (tileSize - 4f) * g; drawList.AddCircleFilled(pMin + new float2(tileSize * 0.5f, tileSize * 0.45f), 4f + g * 4f, new ImColor8(110, 231, 183)); drawList.AddRectFilled(new float2(pMin.X + 2f, pMax.Y - 4f), new float2(pMin.X + 2f + barW, pMax.Y - 1.5f), new ImColor8(52, 211, 153)); } else if (t == TileType.ElectricStove) { drawList.AddCircleFilled(pMin + new float2(tileSize * 0.5f, tileSize * 0.5f), 6f, new ImColor8(253, 224, 71)); } else if (t == TileType.ResearchBench) { drawList.AddRectFilled(pMin + new float2(4f, 5f), pMax - new float2(4f, 5f), new ImColor8(125, 211, 252), 2f); } else if (t == TileType.CompactedSteel) { drawList.AddCircle(pMin + new float2(tileSize * 0.5f, tileSize * 0.5f), 7f, new ImColor8(254, 240, 138), 8, 2f); } else if (t == TileType.PineTree) { drawList.AddCircleFilled(pMin + new float2(tileSize * 0.5f, tileSize * 0.5f), 6.5f, new ImColor8(74, 222, 128)); } } } // Room Labels on Map drawList.AddText(origin + new float2(3.1f * tileSize, 2.2f * tileSize), new ImColor8(191, 219, 254), "RESEARCH & COMMS LAB"u8); drawList.AddText(origin + new float2(10.2f * tileSize, 2.2f * tileSize), new ImColor8(254, 215, 170), "KITCHEN & DINING HALL"u8); drawList.AddText(origin + new float2(3.2f * tileSize, 7.2f * tileSize), new ImColor8(221, 214, 254), "BARRACKS DORMITORY"u8); drawList.AddText(origin + new float2(10.2f * tileSize, 7.2f * tileSize), new ImColor8(167, 243, 208), "HYDROPONICS & RICE FIELD"u8); drawList.AddText(origin + new float2(18.0f * tileSize, 3.2f * tileSize), new ImColor8(254, 240, 138), "STEEL VEIN"u8); // Draw Colonist Pawns & Task Lines for (int i = 0; i < Colonists.Count; i++) { var c = Colonists[i]; float2 center = origin + c.Pos * tileSize; float2 targetPx = origin + c.TargetPos * tileSize; drawList.AddLine(center, targetPx, new ImColor8(255, 255, 255, 65), 1.2f); if (i == _selectedColonist) drawList.AddCircle(center, 11.5f, new ImColor8(250, 204, 21), 16, 2.2f); drawList.AddCircleFilled(center, 8.5f, c.Color, 16); drawList.AddCircle(center, 8.5f, new ImColor8(15, 23, 42), 16, 1.5f); // Work progress mini-bar above pawn float progW = 20f * c.WorkProgress; drawList.AddRectFilled(center + new float2(-10f, -14f), center + new float2(10f, -10f), new ImColor8(15, 23, 42, 200)); drawList.AddRectFilled(center + new float2(-10f, -14f), center + new float2(-10f + progW, -10f), new ImColor8(56, 189, 248)); // Pawn Name label drawList.AddText(center + new float2(-24f, 9f), new ImColor8(248, 250, 252), Encoding.UTF8.GetBytes(c.Name)); // Speech bubble if (c.SpeechTimer > 0f && !string.IsNullOrEmpty(c.SpeechBubble)) { drawList.AddRectFilled(center + new float2(-45f, -30f), center + new float2(95f, -15f), new ImColor8(15, 23, 42, 230), 4f); drawList.AddText(center + new float2(-41f, -29f), new ImColor8(253, 224, 71), Encoding.UTF8.GetBytes(c.SpeechBubble)); } } ImGui.End(); // 3. RIGHT PANEL: SELECTED COLONIST INSPECTOR & WORK PRIORITIES ImGui.SetNextWindowPos(new float2(654, 102), ImGuiCond.Always); ImGui.SetNextWindowSize(new float2(356, 445), ImGuiCond.Always); ImGui.Begin("Colonist Needs, Thoughts & RimWorld Work Matrix"u8, ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove); var sel = Colonists[_selectedColonist]; ImGui.TextColored(new float4(0.45f, 0.85f, 1.0f, 1f), Encoding.UTF8.GetBytes($"{sel.Name} -- {sel.Role}")); ImGui.TextColored(new float4(0.75f, 0.82f, 0.92f, 1f), Encoding.UTF8.GetBytes($"Trait: {sel.Trait}")); ImGui.TextColored(new float4(0.98f, 0.82f, 0.32f, 1f), Encoding.UTF8.GetBytes($"Activity: {sel.ActionText}")); ImGui.SeparatorText("Colonist Needs & Survival"u8); ImGui.ProgressBar(sel.Mood, new float2(330, 16), Encoding.UTF8.GetBytes($"Overall Mood: {(int)(sel.Mood * 100)}%")); ImGui.ProgressBar(sel.Hunger, new float2(330, 15), Encoding.UTF8.GetBytes($"Food (Simple Meals): {(int)(sel.Hunger * 100)}%")); ImGui.ProgressBar(sel.Rest, new float2(330, 15), Encoding.UTF8.GetBytes($"Rest & Alertness: {(int)(sel.Rest * 100)}%")); ImGui.ProgressBar(sel.Recreation, new float2(330, 15), Encoding.UTF8.GetBytes($"Recreation: {(int)(sel.Recreation * 100)}%")); ImGui.ProgressBar(sel.Comfort, new float2(330, 15), Encoding.UTF8.GetBytes($"Thermal Comfort: {(int)(sel.Comfort * 100)}%")); ImGui.SeparatorText("Active Thought Modifiers"u8); foreach (var th in sel.Thoughts) ImGui.BulletText(Encoding.UTF8.GetBytes(th)); ImGui.SeparatorText("Work Priorities (Click 1-4: 1=Highest)"u8); string[] jobNames = ["Research", "Cooking", "Growing", "Mining", "Construct"]; for (int j = 0; j < 5; j++) { if (j > 0) ImGui.SameLine(); if (ImGui.Button(Encoding.UTF8.GetBytes($"{jobNames[j]}:{sel.Priorities[j]}##p{j}"), new float2(64, 24))) sel.Priorities[j] = (sel.Priorities[j] % 4) + 1; } if (ImGui.Button("Reassign Colonist Job Now"u8, new float2(330, 26))) AssignNextJob(sel); ImGui.End(); // 4. BOTTOM PANEL: STORYTELLER & SOCIAL LOG + BRUTAL ATTRIBUTION ImGui.SetNextWindowPos(new float2(6, 551), ImGuiCond.Always); ImGui.SetNextWindowSize(new float2(1004, 171), ImGuiCond.Always); ImGui.Begin("Storyteller Log & BRUTAL Framework Telemetry (Copyright (c) 2024 Ahwoo Limited / RocketWerkz)"u8, ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove); ImGui.TextColored(new float4(0.35f, 0.92f, 0.68f, 1f), Encoding.UTF8.GetBytes(_activeEventBanner)); ImGui.SameLine(); if (ImGui.SmallButton("Solar Flare"u8)) TriggerStorytellerEvent(1); ImGui.SameLine(); if (ImGui.SmallButton("Raider Scout"u8)) TriggerStorytellerEvent(3); for (int i = 0; i < Math.Min(6, SocialLog.Count); i++) ImGui.BulletText(Encoding.UTF8.GetBytes(SocialLog[i])); ImGui.End(); ImGui.Render(); OpenGl.ClearColor(new float4(0.05f, 0.07f, 0.11f, 1.0f)); OpenGl.Clear(GlClearBit.Color); glBackend.RenderDrawData(ImGui.GetDrawData()); window.SwapBuffers(); } } }