- c.GetProperties().birth_mass = properties.birth_mass.FakeNormal(random.SNorm());
- c.GetProperties().fertile_mass = properties.fertile_mass.FakeNormal(random.SNorm());
- c.GetProperties().max_mass = properties.max_mass.FakeNormal(random.SNorm());
- c.GetProperties().fertile_age = properties.fertile_age.FakeNormal(random.SNorm());
- c.GetProperties().infertile_age = properties.infertile_age.FakeNormal(random.SNorm());
- c.GetProperties().death_age = properties.death_age.FakeNormal(random.SNorm());
- c.GetProperties().fertility = properties.fertility.FakeNormal(random.SNorm());
-
- double mass = 0.0;
- double volume = 0.0;
- for (const auto &comp : composition) {
- double comp_mass = comp.mass.FakeNormal(random.SNorm());
- double intake = comp.intake.FakeNormal(random.SNorm());
- double penalty = comp.penalty.FakeNormal(random.SNorm());
-
- mass += comp_mass;
- volume += comp_mass / c.GetSimulation().Resources()[comp.resource].density;
-
- std::unique_ptr<Need> need;
- if (c.GetSimulation().Resources()[comp.resource].state == world::Resource::SOLID) {
- need.reset(new IngestNeed(comp.resource, intake, penalty));
- need->gain = intake * 0.05;
- } else if (c.GetSimulation().Resources()[comp.resource].state == world::Resource::LIQUID) {
- need.reset(new IngestNeed(comp.resource, intake, penalty));
- need->gain = intake * 0.1;
- } else {
- need.reset(new InhaleNeed(comp.resource, intake, penalty));
- need->gain = intake * 0.5;
- }
- need->name = c.GetSimulation().Resources()[comp.resource].label;
- need->growth = comp.growth.FakeNormal(random.SNorm());
- need->inconvenient = 0.5;
- need->critical = 0.95;
- c.AddNeed(std::move(need));
- }
-
- c.Mass(c.GetProperties().birth_mass);
- c.Density(mass / volume);
- c.GetSteering().MaxAcceleration(1.4);
- c.GetSteering().MaxSpeed(4.4);
+ c.GetProperties() = Instantiate(properties, random);
+
+ // TODO: derive stats from properties
+ c.GetStats().Damage().gain = (-1.0 / 100.0);
+ c.GetStats().Breath().gain = (1.0 / 5.0);
+ c.GetStats().Thirst().gain = (1.0 / 60.0);
+ c.GetStats().Hunger().gain = (1.0 / 200.0);
+ c.GetStats().Exhaustion().gain = (-1.0 / 100.0);
+ c.GetStats().Fatigue().gain = (-1.0 / 100.0);
+ c.GetStats().Boredom().gain = (1.0 / 300.0);
+
+ glm::dvec3 base_color(
+ std::fmod(base_hue.FakeNormal(random.SNorm()) + 1.0, 1.0),
+ glm::clamp(base_saturation.FakeNormal(random.SNorm()), 0.0, 1.0),
+ glm::clamp(base_lightness.FakeNormal(random.SNorm()), 0.0, 1.0)
+ );
+ glm::dvec3 highlight_color(
+ std::fmod(base_color.x + 0.5, 1.0),
+ 1.0 - base_color.y,
+ 1.0 - base_color.z
+ );
+ c.BaseColor(hsl2rgb(base_color));
+ c.HighlightColor(hsl2rgb(highlight_color));
+ c.SetBackgroundTask(std::unique_ptr<Goal>(new BlobBackgroundTask(c)));