Over the weekend I released Game Toolbox 0.2.0. You can get it here.
- Added ability for planner to handle continuous values (integers and floats, for instance) rather than just discrete values (such as enums). This requires the specification of comparison delegates for each symbol type.
- Added XML<T> generic static class to ease XML serialization/deserialization. Use XML<T>.Initialize() before using it to save or load an object. It uses reflection to determine which classes the XmlSerializer needs to be able to serialize, so the XmlInclude attribute is no longer necessary; properties with polymorphic types can be serialized and deserialized without knowing the actual type of the value at compile time.
- Added Combinations static class and Combination generic classes, which can be useful for combinatorics problems.
- Added FlyweightPool<T> generic class which implements the Flyweight design pattern by attempting to load and retain one instance of T (if it is not abstract) and each non-abstract subclass of T using reflection. Each class to be loaded must have a default constructor, which will be used to create its flyweight instance. If preferred, preloading can optionally be disabled (use the constructor with the “preload” parameter).
- Added PlannerActionPool, a FlyweightPool of planner actions. This contains each non-abstract PlannerAction in the program, and has a helper method to easily get a PlannerActionSet containing all available PlannerActions.
- Added Tuple classes for 2- through 10-tuples.
- Added parameters to PlannerAction functions. Added ability for planner to infer parameter values from the needs of the plan, allowing a GoTo action, for instance, which can set the “Location” symbol to any valid value needed by the planner. Actions which remove a symbol with any value and convert it to something else (such as a generalized EatFood action) are still not possible, however.
- Updated to allow XML serialization of PlannerActionSet. This enables saving and loading of what actions are available to which agents in data.
- Updated GOAP test in test app to show continuous value support (“Money”) and parameterized action support (“GoTo”).
- Fixed problem where planner was unable to detect certain problems where a valid plan did not extist (problem was created by the addition of support for continuous values).
- Fixed a bug in ShuffleRemaining() function in Deck<T>.
- The planner seems to be making suboptimal plans. In the GOAP test in the test app, it eats the ice cream, even though that brings it no closer to the goal state (and an alternative, just eating the steak, does). I think this may be to do with the comparison function for Food types… the lesson here, in that case, is that flag enums are not a very good type to use for planner symbols. In any case if that is the cause I can fix this soon.
- Comparison delegates should probably be per-symbol rather than per-type, in case the same type is used for two different symbols which should nonetheless be compared differently.