+3
Under Review

Machine scope for variables

Lazlo Bonin (Lead Developer) 5 months ago • updated by eagleeyez 4 months ago 2

In some design patterns, it might make sense to have a machine-level scope for variables.

These variables would be shared across graphs in the same machine (e.g. super units, super states, etc.), but not across machines on the same game object.

Machine variables would therefore be "wider" in scope than graph variables, but "narrower" than object variables.

My current stance on this idea is that despite its apparent usefulness, 

  1. Most (all?) designs can be rethought to avoid the need for machine variables
  2. Adding a new scope would add to the already complex scope system
  3. It requires significant implementation and documentation time

Example use cases:

All I wanted was to be able to make a state macro that would carry out its code after being put onto any object ( Reusable) I do that now with set directly to scene variables, so the macro creates its own variables. Would be nice if a state machine was really just one graph and then other states could use those vars in the macro. Meaning saving a macro would mean incapsulating just those vars for the whole graph in that macro (very reusable)