unity3d-opencog-game icon indicating copy to clipboard operation
unity3d-opencog-game copied to clipboard

[Doc] High Level Functions now available through Managers

Open Spydrouge opened this issue 11 years ago • 0 comments

  • Purpose: Make concise the vision #26 was used to generate for how to expose the functionality we needed for UnitTests, clean up the program, and re-organize the hierarchy

Example For Possible Extension

  • GameManager
    • EntityManager
      • LoadMethods
        • AtRunTime
        • AtEditTime
      • SaveMethods
      • TeleportMethods
      • DestroyMethods
    • WorldManager
      • LevelMethods
      • BlockMethods
    • ControlMethods
      • PauseGame
      • QuitWithError
      • QuitWithSuccess

Explanation

High level functions, such as 'LoadAgent' and 'CreateBlock' which could be used at many, many different parts of the program, are now accessible through a GameManager singleton who has many children such as EntityManager and WorldManager, which each have different method sets.

For example, EntityManager is split up into partial class functions which nest a LoadMethods class (and can nest a SaveMethods and a MoveMethods and a SetActionMethods and so forth in the future). One can now call GameManager.entities.load.AtRunTime(); from anywhere in the program.

GameManager handles the instantiation and control of all its children. LoadAgent's static Instantiate function is not even available to the outside; its methods are accessible through an interface and its nesting allows it to be protected/policed entirely by EntityManager.

Likewise, even though we plan to replace the voxel engine, WorldManager's VoxelMethods nested class has an AddSelectedVoxel function that takes only a single Pixelland parameter and creates the new block with only five lines of code.

Many of the functions of OcMap and GameStateManager should be subsumed into these existing managers; but it is important that they should be 'light,' non-hacky, and exceptionally well organized. Keep them as clean and polished as possible.

Owed to the limited development at this point, we may currently have no need for the full flexibility of these managers. However they are relatively easy to build on, and have helped us eliminate numerous instances of certain functionality scattered in protected/private functions.

Spydrouge avatar Nov 14 '14 04:11 Spydrouge