Hi,
yes, you need to be disciplined if you have a meta data fsm, the same applied even on regular c#, without discipline, you can mess up a project amazingly quick
so, I use meta data fsm for characters for example.
all data that many of the fsm within the hierarchy of that character will need will have their "authoritative" source in that meta data fsm. that's of for reading.
for writing, you can go with two options
- directly write to the metadata fsm properties, like health or ammo for example, the downside is that other fsm will not be made aware of this and watching a variable on everyupdate is lame...
- create an event for each or a common one ( "REFRESH" or something), so that if an fsm is willing to change the value of a meta data it must do so using the dedicated event, "PLAYER / METADATA / SET XXX" and pass the value you want to change with the event. The direct benefit is that any fsm can listen to it and instantly use the value, sometime when things get complex and that other fsm are deducing their own values based on a different property, I introduce a next frame event delay when I know that work will be done and that many other values will change because of that, then I proceed with the logic of that fsm.
inside the organ is easier than outside the organ is an interested challenge, many times I use the meta data as a rule between organs for communication, that's expecially useful for prefab instances, for example, I have many different weapons prefabs, but if I have one instance, I expect a metadata fsm on it with power, ammo, damage, etc etc. this way, it becomes very powerful! I don't care what the weapon is, as long as it conforms to the contract that it must have a meta data. same with pickups, anything you trigger should have a metadata with a type, ( pickup, bomb, health pack, what ever) and anything interacting with it first query for it, then its type and then knows what to do with it.
that's for reading, and for writing, I also use dedicated events.
so, again, it's only a matter of being very strict with your convention ( the usual convention vs configuration type of logic), and then things become very powerful, flexible and maintainable, because you expect things to be handled in a very specific and reliable way. that's all there is to it.
Bye,
Jean