this line shows more than meets the eye :-) but lets stay with the business at hand; please change the divider to 100 so it actually does what you meant -- and makes this sketch of a 'long-duration game without a save-manager and/or save-file-exports' actually runnable without tears.
T[r.MAX_POPULATION] * ((c.popularity + c.happiness) / 200)
in decay mode, it might be nice if modifiers actually meant something, but that's kind of less important.
ne = j * 0.02; // Hard decay ignores Food and Health or growth modifiers
as for the total disconnect between population and raid strength - which makes playing this sketch a loosing proposition, consider this pattern:
// OLD Code (Bandit Raid Example) const v = 3 + Math.floor(Math.random() * n.day / 2); // NEW Code (Proposed Fix) // Calculate base difficulty based on day let rawCount = 3 + Math.floor(Math.random() * n.day / 2); // Calculate a hard cap based on population // base of 5 so extremely small colonies still feel some pressure const populationCap = Math.ceil(n.resources[r.POPULATION] * 1.5) + 5; // The actual spawn is the lesser of the two const v = Math.min(rawCount, populationCap);
With this, on Day 100, enemies will be only 1.5x stronger instead of 2.5x).
This allows basic Soldiers to remain relevant for much longer.
// OLD Code const ee = 1 + P * 0.015; // 1.5% per day const fe = 1 + Q * 0.35; // 35% per Tier // NEW Code // Reduce daily scaling to 0.5% and Tier scaling to 15% const ee = 1 + P * 0.005; const fe = 1 + Q * 0.15;
The size of the militia is another issue that makes little sense of a survivalist szenario. Fix:
// OLD Code (Trigger logic in B0) const h = Math.ceil(n.resources[r.POPULATION] * u); // NEW Code // Base militia is at least 5 units, or your percentage, whichever is higher. // This ensures even a tiny colony has a squad to defend it. const h = Math.max(5, Math.ceil(n.resources[r.POPULATION] * u));
Also, please add a logic check that if enemyTotal > playerTotal * 2, the "Defeat" condition doesn't wipe the colony but instead triggers "Hunker Down" where you lose the battle immediately, lose resources, but you lose 0 Population as everyone will hide in the <span class="ng-star-inserted" <this="" simulates="" the="" workers="" hiding="" in="" <="" span="">CRASHED_DROPSHIP</span> while bandits loot the warehouse.
There are some UI items I want to mention as well: The "Red X" in the building control makes controlling buildings on/off really cumbersome. I think that one should be able to switch modes (tabs) in the cards showing the buildings so that one can activate/deactivate them from there. Some of the cards, like, say, the Hut, quickly make no sense at all and one would never want to see them - so they need to be made excludable before filtering comes into play.
I hope this message finds you well and that you don't get distracted away from this model before it can count as a playable simulation! Thanks and keep up the good work!