Add a "metabolizing" property

Registered by Erik Ogenvik

Move the metabolizing code in Plant.cpp and Character.cpp into a property "metabolizing".

Blueprint information

Erik Ogenvik
Erik Ogenvik
Series goal:
Needs Code Review
Milestone target:
Started by
Erik Ogenvik

Related branches



I imagine that the metabolism "tick" should be triggered in response for various operations(movement, tick ...).
In simplest case only tick operation should trigger it as it is now.
Is it possible to have multiple handlers for the same operation working in sequence for the same entity? /Peter

The Tick functionality isn't implemented as good as it should be, since there sometimes are "generic" ticks and sometimes "specific" ticks and no good definition. So, we can have a specific Tick for metabolizing, which has the string "metabolizing" as its first argument. This is how we do with movement. Any handler can then listen to the Tick operations and ignore those that are directed to a different subsystem (i.e. so a movement handler would ignore all Ticks which aren't marked with "movement").
Multiple handlers can listen to the same operations, but the behaviour isn't as fleshed out as I would want. The order is kinda stochastic. That needs to be improved. But for this use case it works fine as it is.

Since I've already written some working code for this, if you agree, assign me to this task.

There is one obstacle in form of growth code in Plant class - its tied to mass changes which cannot be tracked from outside Plant class. Metabolism is meant to be univerasal and we didn't created growth model for animals yet.
So, I suggest deleting growth code from plant for now and creation of "grows" property in the future or modifying metabolism property to account the actual size increase (model & bbox scaling and stuff).

As we've talked in separate channels, the best approach would be to have the logic in the MetabolizingProperty class, but have its behaviour being controlled by the values in a separate "grows" property.

Through "basic" world ruelset we still use class that is suppose to replace the (i guess) metabolism property (cyphesis/rulesets/basic/world/objects/animals/ should I remove it?
Also there is a question of entity modes. It would be quite easy to change metabolism speed depending on the mode of entity (running, walking, resting). The one problem however is the fact basic tick is equl to 90second during this time many things requring high enery usage may happen.

Yeah, the class (and its directory) can be removed. Cyphesis was initially written in Python and then ported to C++ (long time ago), and that's a remnant.
Regarding modes I'm worrying that that will be a too fine grained simulation, not lending itself good to games. Instead a stamina system would probably help more (there's the seeds of such a system already).


Work Items

Work items:
Creation of MetabolizingProperty class: DONE
Change of Character::TickOperation and registering new property in CorePropertyManager: DONE
Change of rules xml files: INPROGRESS
Replace food property with nourishment: DONE
Tweaking the metablism computational model: INPROGRESS
Removal of obsolete code from Character class: DONE
Creation & registration of all auxiliary properties : INPROGRESS
Replacement of plant metabolsim code: DONE
Writing unit tests: DONE
Writing integration tests: POSTPONED
Delete obsolete animal class from basic rulesets that is : POSTPONED
Make metabolism speed to vary across different entity modes : TODO

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.