1 #ifndef BLOBS_CREATURE_GENOME_HPP_
2 #define BLOBS_CREATURE_GENOME_HPP_
4 #include "../math/Distribution.hpp"
5 #include "../math/GaloisLFSR.hpp"
6 #include "../math/glm.hpp"
23 /// the age at which to transition to the next phase
29 /// skin highlight pronounciation
34 PropertySet<T> props[6];
35 PropertySet<T> &Birth() noexcept { return props[0]; }
36 const PropertySet<T> &Birth() const noexcept { return props[0]; }
37 PropertySet<T> &Child() noexcept { return props[1]; }
38 const PropertySet<T> &Child() const noexcept { return props[1]; }
39 PropertySet<T> &Youth() noexcept { return props[2]; }
40 const PropertySet<T> &Youth() const noexcept { return props[2]; }
41 PropertySet<T> &Adult() noexcept { return props[3]; }
42 const PropertySet<T> &Adult() const noexcept { return props[3]; }
43 PropertySet<T> &Elder() noexcept { return props[4]; }
44 const PropertySet<T> &Elder() const noexcept { return props[4]; }
45 PropertySet<T> &Death() noexcept { return props[5]; }
46 const PropertySet<T> &Death() const noexcept { return props[5]; }
48 /// "typical" properties
49 /// every one of these should have at least one
50 /// negative impact to prevent super-beings evolving
51 /// power at the cost of higher solid intake
53 /// more endurance at the cost of higher liquid intake
55 /// more speed at the cost of higher fatigue
57 /// higher mental capacity at the cost of boredom
59 /// how likely to mutate
62 Properties<math::Distribution> properties;
68 // how much contained in the body
69 // relative value to determine average density
70 math::Distribution mass;
71 // how much to circulate
72 math::Distribution intake;
73 // how important for alive-being
74 math::Distribution penalty;
75 // how much off the mass may stay in the body
76 math::Distribution growth;
78 std::vector<Composition> composition;
80 math::Distribution base_hue;
81 math::Distribution base_saturation;
82 math::Distribution base_lightness;
84 void Configure(Creature &) const;
86 static PropertySet<double> Instantiate(
87 const PropertySet<math::Distribution> &p,
88 math::GaloisLFSR &rand
91 p.age.FakeNormal(rand.SNorm()),
92 p.mass.FakeNormal(rand.SNorm()),
93 p.fertility.FakeNormal(rand.SNorm()),
94 glm::clamp(p.highlight.FakeNormal(rand.SNorm()), 0.0, 1.0)
98 static Properties<double> Instantiate(
99 const Properties<math::Distribution> &p,
100 math::GaloisLFSR &rand
103 Instantiate(p.props[0], rand),
104 Instantiate(p.props[1], rand),
105 Instantiate(p.props[2], rand),
106 Instantiate(p.props[3], rand),
107 Instantiate(p.props[4], rand),
108 Instantiate(p.props[5], rand),
109 p.strength.FakeNormal(rand.SNorm()),
110 p.stamina.FakeNormal(rand.SNorm()),
111 p.dexerty.FakeNormal(rand.SNorm()),
112 p.intelligence.FakeNormal(rand.SNorm()),
113 p.mutability.FakeNormal(rand.SNorm())