source: cpp/frams/genetics/geneprops.h @ 1039

Last change on this file since 1039 was 1039, checked in by Maciej Komosinski, 5 months ago

Removed Part's "visual thickness" property

File size: 4.6 KB
RevLine 
[759]1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
4
5#ifndef _GENEPROPS_H
6#define _GENEPROPS_H
7
8#include <common/nonstd_math.h>
9#include <frams/model/model.h>
10
[772]11
12
13
14
[1039]15#define F14_MODIFIERS_VISUAL "DdGgBb"
[772]16#define F14_MODIFIERS_RARE "EeWwAaSs" //expdef would need to handle these properly/specifically to ensure reasonable behavior, and hardly any expdef does. Modifying initial energy of a creature as a result of its genes (Ee) is in general not a good idea. Weight (Ww) works only in water, and in water sinking/going up should usually be caused by real "intentional" activity of a creature, not by its inherited weight. For assimilation (Aa), there is a dedicated parameter in CreaturesGroup. Stamina (Ss) is no longer needed as destructive collisions are not supported, and even if they were, some expdef would need to impose reasonable restrictions on the value of this parameter (e.g. similar to normalizeBiol4()) so there is some cost associated with it, and the specific consequences of destructions should be defined as needed.
17#define F14_MODIFIERS "LlRrCcQqFfMmIi" F14_MODIFIERS_RARE F14_MODIFIERS_VISUAL
18
19
20
21
22
[759]23/**
24 * Contains physical, biological and other properties of
25 * stick, except for rotation. The constructor initializes properties of sticks with
26 * default values. In order to change a property of a stick, the executeModifier() method
27 * should be called. Modification of length, curvedness and twist properties
28 * usually affects further sticks, so new sticks should have properties of
29 * parents (prop) modified with the prop.propagateAlong() method.
30 * "Biological" properties (assimilation, stamina, muscle strength and
31 * ingestion) should be normalized after modification with normalizeBiol4().
32 */
33struct GeneProps
34{
35public:
36        double length;            ///<incremented by L, decremented by l. Physical property, length of stick
37        double curvedness;        ///<incremented by C, decremented by c. Curvedness of sticks
38        double weight;            ///<incremented by W, decremented by w. Physical property, weight of stick (in water environment light sticks swim on the surface)
39        double friction;          ///<incremented by F, decremented by f. Physical property, friction of a stick (sticks will slide on the ground or stick to it)
40
41        double muscle_power;      ///<incremented by M, decremented by m. Biological property, muscle strength (muscle speed). Strong muscles act with bigger force, gain higher speed, can resist bigger stress, and use more energy
42        double assimilation;      ///<incremented by A, decremented by a. Biological property, assimilation, photosynthesis (a vertical stick can assimilate twice as much as horizontal one)
43        double stamina;           ///<incremented by S, decremented by s. Biological property, stamina (increases chance of survival during fights)
44        double ingestion;         ///<incremented by I, decremented by i. Biological property, ingestion (ability to gain energy from food)
45
46        double twist;             ///<incremented by Q, decremented by q. Twist of a stick
47        double energy;            ///<incremented by E, decremented by e. Energy of a creature
48
49        double muscle_bend_range; ///<Used only by conv_f1
50        bool muscle_reset_range;  ///<Used only by conv_f1
51
52        double cred;              ///<incremented by D, decremented by d. Part's red color proportion
53        double cgreen;            ///<incremented by B, decremented by b. Part's blue color proportion
54        double cblue;             ///<incremented by G, decremented by g. Part's green color proportion
55
56        static GeneProps standard_values;
57
58        /**
59         * Constructor initializing all properties with default values.
60         */
61        GeneProps();
62
63        /**
64         * Normalizes biological properties (muscle_power,
65         * assimilation, stamina, and ingestion). This method is called in
66         * executeModifier() when any of the biological properties is modified. All values
67         * of those properties sum up to 1.
68         */
69        void normalizeBiol4();
70
71        /**
72         * Checks whether the given character is property modifier. If yes, the property
73         * is modified and properties are normalized when needed.
74         * @param modif character that might be a property modifier
75         * @return 0 if the provided character was property modifier, -1 otherwise
76         */
77        int executeModifier(char modif);
78
79        /**
80         * Adjusts current properties for the next stick. In order to set
81         * new properties to the created stick, the copy of the previous stick should be created,
82         * and propagateAlong() should be used for that copy.
83         * @param use_reset_range true if this method should modify muscle_bend_range (used in f1 conversion).
84         */
85        void propagateAlong(bool use_f1_muscle_reset_range);
86};
87
88#endif // _GENEPROPS_H
Note: See TracBrowser for help on using the repository browser.