• Plugin Development

    This is under construction and incomplete, it is also changing with Version 11 and not slated to become fully available until Version 12. If you want access feel free to apply, but know that many things may change and become deprecated.


    Requirements

    To test your plugin in the main software you will need to apply with us to get Plugin Developer access. For now e-mail tracker@recursion.tk with your request and Recursion account name. Eventually this process will become more automated.

    Development should be performed on the latest stable version of the Recursion Tracker.

    The minimum required version for plugin support is 0.10.2.2.

    The Recursion Tracker is a 32 bit application which specifically targets the .NET Framework 4.5 on the following operating systems: Windows Vista, Windows 7, Windows 8.0, and Windows 8.1.

    Examples will be based on C# using Visual Studio 2013--Update 4.
    Getting Started
    Create a new class library in Visual Studio by going to File -> New Project -> Visual C# -> Class Library

    Once created you will want to add a reference to the Recursion library.
    Right click on your new project and choose Add -> Reference. Then browse to the Recursion Tracker installation directory and choose RTLibrary.dll.


    Now we should setup the base class we will be using and link the RecursionTracker name space. There are multiple ways to do this, but to stay consistent with other plugin development your plugin should fall under the RecursionTracker.Plugins namespace, and with your own namespace extending it.

    The main program requires your plugin implement the IPlugin interface. To make things easier we have a BasePlugin class which implements the interface and takes care of a few other things as well. Extend the RecursionTracker.Plugins.PluginBase class.

    The PluginBase class implements the IPlugin interface which has a set of required methods. PluginBase creates protected member properties and implements all methods as virtual so they can be overloaded.




    First overwrite the PluginInformation m_information with your own plugin specific information. (string name, string description, string author, string imagePath)

    Next set m_guid with a new GUID unique to your plugin. Visual Studio offers a GUID generator by going to Tools -> Create GUID. Make sure the GUID consists of numbers, letters, and hyphens only. The Recursion Tracker will only allow one plugin per GUID to be loaded at a time.

    Let's go over the IPlugin required methods which are already fully implemented.

    1. LinkHost(Instance information) This is called right after your plugin has been loaded into memory and links the main program instance information to your plugin. The BasePlugin class implements this method fully.
    2. GetInformation() Is a way for the main program of retrieving your plugin's information and displaying it as long as you overwrote m_pluginInformation. The BasePlugin class implements this method fully.
    3. GetGuid() Returns the GUID you specified as long as you overwrote m_guid. The BasePlugin class implements this method fully.

      The following methods should be overloaded specific to your plugin.
    4. Load() This is called right after your plugin is loaded into memory and instance information has been linked.
    5. Shutdown() This is called right when the plugin is being deactivated, such as if the user disabled it or the program is shutting down. You should release any used resources specific to your plugin at this point.
    6. Run() This is called once shortly after Load(). If you have your own frame loop you should instantiate that here.
    7. Frame(frameTime) This is called during the main program's normal frame loop. To optimize resources it is recommended to perform per tick CPU work here.
    8. OnMainFormLoad() This is called whenever the main form is loaded and should be used to load any menu buttons specific to your plugin. When the user minimizes the application the form is actually destroyed, and then recreated when the user double clicks on the task tray.



    There will likely be information you wish to retrieve from the Recursion Tracker application. The Core object provided through m_core is your gateway to object instances managed by the host application.

    Common objects include:

    StatTracker-- Retrieved through GetStatTracker(). The StatTracker processes JSON events from the socket connection and formats them properly into GameEvent objects. The stat tracker also totals information relating to the player being tracked.

    Guinan-- Retrieved through GetGuinan(). Guinan is our listener class which performs event processing and is used to figure out which GameEvent is currently processing or what the state of the game currently is through tracked method groups.

    D3DXInterface-- Retrieved through GetD3D(). The d3d interface is how communication is performed with the game client. You can send MenuComponents through this connection which will automatically serialize the component and send it to the game for display.
    Code:
    namespace RecursionTracker.Plugins.MyPlugin
    {
        public class MyPluginBase : PluginBase {
            private StatTracker m_statTracker;
    
            public MyPluginBase() {
                m_pluginInformation = new PluginInformation("My Plugin",
                "A test plugin for the Recursion Tracker.", "Me", null);
                m_guid = new Guid("27A7E26E-FE91-4F61-91D9-43DF3A0FBF6F");
            }
    
            public override void Load() {
                base.Load();
    
                // m_core will have been set by SetInformation() at this point.
                m_statTracker = m_core.GetStatTracker();
            }
        }
    }



    Getting Game Events
    JSON events enter the Stat Tracker and are converted to GameEvents. The stat tracker class builds the players and their initial stats from either a query or cache. WeaponStats by default are not retrieved due to API overhead. The complete game event is then sent off to Guinan for processing in the order it was received. To get access to the currently processing game event, call Guinan.GetCurrentProcessingEvent().

    Game Event format



    Sound Player
    We use NAudio for our sound library and support both WaveOut and DirectSound implementations. The sound player can be retrieved by Core.GetSoundPlayer()

    The following are common methods which can be used.
    Code:
    PlaySound(byte[] byteArray) 
    PlayCustomSound(string filePath) // Loads a file into a bytearray and calls PlaySound
    StopSound() // Stops the current playing sound.
    Note that all sound player methods are thread safe.




    Guinan
    Guinan uses MethodGroups to determine what to track. Define your own methods and load them into Guinan's TrackedMethods.





    In-Game Menu Creation
    This format will be changing in 0.10.3 and documentation will be constructed after that time.