1. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  2. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  3. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Tutorial How to write a Game Plugin for SimTools 2.0 - API documentation

Discussion in 'Tutorials and Tips by the Developer' started by yobuddy, Sep 23, 2016.

  1. junhyuk Ahn

    junhyuk Ahn ARACA!!

    Joined:
    May 15, 2014
    Messages:
    13
    Location:
    Seoul, Korea
    Balance:
    704Coins
    Ratings:
    +15 / 1 / -0
    My Motion Simulator:
    2DOF, 3DOF, Arduino, Motion platform
    Hello

    I'm writing a game plugin.
    But it doesn't work. I'm not sure where's wrong.
    I need advice.
    It is written referring to Dirt2 plugin.

    Game Name : HyperStorm
    Steam Link
    https://store.steampowered.com/app/1147840/

    Thanks.



    Code:
    Option Explicit On
    Option Strict On
    
    Imports Game_PluginAPI
    Imports System.IO
    
    Public Class GamePlugin
        Implements IPlugin_Game
        '//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        '///                            SimTools Plugin - Edit the Setting below to provide support for your favorite game!                             ///
        '//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        '////////////////////////////////////////////////
        '/// Per Game Settings - Change for Each Game ///
        '////////////////////////////////////////////////
        Private Const _PluginAuthorsName As String = "ajunhyuk"
        Private Const _GameName As String = "HyperStorm" 'GameName (Must Be Unique!) - the displayed Name.
        Private Const _ProcessName As String = "HyperStorm" 'Process_Name without the (".exe") for this game
        Private Const _Port As String = "20741"  'Your Sending/Recieving UDP Port for this game
        Private Const _RequiresPatchingPath As Boolean = False 'do we need the game exe path for patching? (must be True if _RequiresSecondCheck = True)
        Private Const _RequiresSecondCheck As Boolean = False 'Used when games have the same _ProcessName. (all plugins with the same _ProcessName must use this!)
        Private Const _PluginOptions As String = "" 'Reserved For Future Use - No Change Needed
        '////////////////////////////////////////////////
        '///           Memory Map Variables           ///
        '////////////////////////////////////////////////
        Private Const _Enable_MemoryMap As Boolean = False 'Is a MemoryMap file Required for this game?
        Private Const _MMF_Name As String = "NULL" 'Set if using a Memory Map File - EXAMPLE("$gtr2$")
        '////////////////////////////////////////////////
        '///           MemoryHook Variables           ///
        '////////////////////////////////////////////////  
        Private Const _Enable_MemoryHook As Boolean = False 'Is a Memory Hook Required for this game?
        Private Const _MemHook_Roll As UInteger = 0 'Not Used = 0
        Private Const _MemHook_Pitch As UInteger = 0
        Private Const _MemHook_Heave As UInteger = 0
        Private Const _MemHook_Yaw As UInteger = 0
        Private Const _MemHook_Sway As UInteger = 0
        Private Const _MemHook_Surge As UInteger = 0
        Private Const _MemHook_Extra1 As UInteger = 0
        Private Const _MemHook_Extra2 As UInteger = 0
        Private Const _MemHook_Extra3 As UInteger = 0
        '////////////////////////////////////////////////
        '///    DOFs Used for Output for this Game    ///
        '////////////////////////////////////////////////
        Private Const _DOF_Support_Roll As Boolean = True
        Private Const _DOF_Support_Pitch As Boolean = True
        Private Const _DOF_Support_Heave As Boolean = True
        Private Const _DOF_Support_Yaw As Boolean = True
        Private Const _DOF_Support_Sway As Boolean = True
        Private Const _DOF_Support_Surge As Boolean = True
        Private Const _DOF_Support_Extra1 As String = "" 'Blank = False
        Private Const _DOF_Support_Extra2 As String = "" '"" = Not Used
        Private Const _DOF_Support_Extra3 As String = "" 'ADD THE FORCE NAME HERE
        '/////////////////////////////////////////////////
        '///       GameDash - Dash Board Support       ///
        '/////////////////////////////////////////////////
        Private Const _Enable_DashBoard As Boolean = True  'Enable the DashBoard Output System?
        'EXAMPLES OF DASH OUTPUT (all variables are strings) - 20 DASH OUTPUTS MAX!!!
        'Use the Variables with either Process_PacketRecieved, Process_MemoryHook or Process_MemoryMap.
        'Variable = (*Action, Value) as String - (The *Action variable can be anything)
        'Basic Dash Support should include at the minimum -  SPEED, RPM and GEAR
        'Dash_1_Output = "Speed," & OUTPUT_VALUE_HERE.ToString
        'Dash_2_Output = "Rpm," & OUTPUT_VALUE_HERE.ToString
        'Dash_2_Output = "Gear," & OUTPUT_VALUE_HERE.ToString
        '...
        'Dash_20_Output = "Engine Temp," & OUTPUT_VALUE_HERE.ToString
        '/////////////////////////////////////////////////
        '///           GameVibe Support              ///
        '/////////////////////////////////////////////////
        Private Const _Enable_GameVibe As Boolean = False 'Enable the GameVibe Output System?
        'EXAMPLES OF GameVibe OUTPUT (all variables are strings) - 9 GameVibe OUTPUTS MAX!!!
        'Use the Variables with either Process_PacketRecieved, Process_MemoryHook or Process_MemoryMap.
        'Variable = (*Action, Value) as String - (The *Action" variable can ONLY be: Rpm, Heave, Sway, Surge, FR, FL, RR, RL, Turbo)
        'Basic GameVibe Support should include at the minimum -  Rpm
        'Vibe_1_Output = "Rpm," & OUTPUT_VALUE_HERE.ToString
        'Vibe_2_Output = "Heave," & OUTPUT_VALUE_HERE.ToString
        'Vibe_3_Output = "Sway," & OUTPUT_VALUE_HERE.ToString
        'Vibe_4_Output = "Surge," & OUTPUT_VALUE_HERE.ToString
        '...
        'Vibe_9_Output = "Gear Shift," & OUTPUT_VALUE_HERE.ToString
        '/////////////////////////////////////////////////
    
        'Used by GameManager when the Game Starts.
        Public Sub GameStart() Implements IPlugin_Game.GameStart
        End Sub
    
        'Used by GameManager when the Game Stops.
        Public Sub GameStop() Implements IPlugin_Game.GameEnd
        End Sub
    
        'Used by GameManager to Process a MemoryHook.
        Public Sub Process_MemoryHook() Implements IPlugin_Game.Process_MemoryHook
            'DO SOMETHING HERE AT GAME START!      
        End Sub
    
        'Used by GameManager to Process a MemoryMap.
        Public Sub Process_MemoryMap() Implements IPlugin_Game.Process_MemoryMap
            'DO SOMETHING HERE AT GAME START!
        End Sub
    
        'Used by GameEngine to Process Incoming UDP Packets.
        Public Sub Process_PacketRecieved(Text As String) Implements IPlugin_Game.Process_PacketRecieved
            'Convert string to byte and copy to byte array
            Dim ByteArray() As Byte = System.Text.Encoding.Default.GetBytes(Text)
            'Create Gchandle instance and pin variable required
            Dim MyGC As System.Runtime.InteropServices.GCHandle = System.Runtime.InteropServices.GCHandle.Alloc(MyOutsim_Internal, System.Runtime.InteropServices.GCHandleType.Pinned)
            'get address of variable in pointer variable
            Dim AddofLongValue As IntPtr = MyGC.AddrOfPinnedObject()
            'Copy the memory space to my GCHandle
            System.Runtime.InteropServices.Marshal.Copy(ByteArray, 0, AddofLongValue, ByteArray.Length)
            'Direct Cast myGC to my Outsim Object
            MyOutsim_Internal = DirectCast(MyGC.Target, OutSim)
            'Free GChandle to avoid memory leaks
            MyGC.Free()
    
            'Get Proper Data out of UDP Packet
            With MyOutsim_Internal
                Roll_Output = .roll ' * 3.14159 / 180.0
                Pitch_Output = .pitch ' * 3.14159 / 180.0
                Heave_Output = .heave
                Yaw_Output = .yaw ' * 3.141592 / 180
                Sway_Output = .sway
                Surge_Output = .surge
                Dash_1_Output = "Speed," & .wind.ToString
            End With
        End Sub
    
        'Used by GameManager to Patch a Game.
        Public Function PatchGame(ByVal MyPath As String, ByVal MyIp As String) As Boolean Implements IPlugin_Game.PatchGame
        End Function
    
        'Used by GameManager to UnPatch a Game.
        Public Sub UnPatchGame(MyPath As String) Implements IPlugin_Game.UnPatchGame
        End Sub
    
        'Used by GameManager to UnPatch a Game.
        Private Sub UnPatch(MyPath As String)
        End Sub
    
        'Tells the User where to patch the game
        Public Sub PatchPathInfo() Implements IPlugin_Game.PatchPathInfo
        End Sub
    
        'Used by GameManager to Validate a Path befors Patching.
        Public Function ValidatePatchPath(MyPath As String) As Boolean Implements IPlugin_Game.ValidatePatchPath
            Return True
        End Function
    
    
        '//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        '///                                                 PLACE EXTRA NEEDED CODE/FUNCTIONS HERE                                                     ///
        '//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    #Region "///// - EXTRA CODE/FUNCTIONS USED FOR THIS PLUGIN - /////"
        'Used by GameEngine to Process Incoming UDP Packets.
        Private MyOutsim_Internal As New OutSim
        Private Structure OutSim
            Public pitch As Single
            Public yaw As Single
            Public roll As Single
    
            Public sway As Single
            Public heave As Single
            Public surge As Single
    
            Public wind As Single
        End Structure
    #End Region
    
    
        '//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        '///                                                        DO NOT EDIT BELOW HERE!!!                                                           ///
        '//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    #Region "///// BUILT IN METHODS FOR SIMTOOLS - DO NOT CHANGE /////"
        'Output Dash Vars
        Public Dash_1_Output As String = ""
        Public Dash_2_Output As String = ""
        Public Dash_3_Output As String = ""
        Public Dash_4_Output As String = ""
        Public Dash_5_Output As String = ""
        Public Dash_6_Output As String = ""
        Public Dash_7_Output As String = ""
        Public Dash_8_Output As String = ""
        Public Dash_9_Output As String = ""
        Public Dash_10_Output As String = ""
        Public Dash_11_Output As String = ""
        Public Dash_12_Output As String = ""
        Public Dash_13_Output As String = ""
        Public Dash_14_Output As String = ""
        Public Dash_15_Output As String = ""
        Public Dash_16_Output As String = ""
        Public Dash_17_Output As String = ""
        Public Dash_18_Output As String = ""
        Public Dash_19_Output As String = ""
        Public Dash_20_Output As String = ""
    
        'Output Vars
        Public Roll_Output As Double = 0
        Public Pitch_Output As Double = 0
        Public Heave_Output As Double = 0
        Public Yaw_Output As Double = 0
        Public Sway_Output As Double = 0
        Public Surge_Output As Double = 0
        Public Extra1_Output As Double = 0
        Public Extra2_Output As Double = 0
        Public Extra3_Output As Double = 0
    
        'MemHook Vars
        Public Roll_MemHook As Double = 0
        Public Pitch_MemHook As Double = 0
        Public Heave_MemHook As Double = 0
        Public Yaw_MemHook As Double = 0
        Public Sway_MemHook As Double = 0
        Public Surge_MemHook As Double = 0
        Public Extra1_MemHook As Double = 0
        Public Extra2_MemHook As Double = 0
        Public Extra3_MemHook As Double = 0
    
        'MemMap Vars
        Public Roll_MemMap As Double = 0
        Public Pitch_MemMap As Double = 0
        Public Heave_MemMap As Double = 0
        Public Yaw_MemMap As Double = 0
        Public Sway_MemMap As Double = 0
        Public Surge_MemMap As Double = 0
        Public Extra1_MemMap As Double = 0
        Public Extra2_MemMap As Double = 0
        Public Extra3_MemMap As Double = 0
    
        'GameVibe Vars
        Public Vibe_1_Output As String = ""
        Public Vibe_2_Output As String = ""
        Public Vibe_3_Output As String = ""
        Public Vibe_4_Output As String = ""
        Public Vibe_5_Output As String = ""
        Public Vibe_6_Output As String = ""
        Public Vibe_7_Output As String = ""
        Public Vibe_8_Output As String = ""
        Public Vibe_9_Output As String = ""
    
        Public Function Get_PluginVersion() As String Implements IPlugin_Game.Get_PluginVersion
            Return System.Reflection.Assembly.GetExecutingAssembly.GetName.Version.ToString
        End Function
    
        Public Function GetDOFsUsed() As String Implements IPlugin_Game.GetDOFsUsed
            'Return DOF's Used (Roll,Pitch,Heave,Yaw,Sway,Surge)
            Return (_DOF_Support_Roll.ToString & "," & _DOF_Support_Pitch.ToString & "," & _DOF_Support_Heave.ToString & "," & _DOF_Support_Yaw.ToString & "," & _DOF_Support_Sway.ToString & "," & _DOF_Support_Surge.ToString & "," & _DOF_Support_Extra1.ToString & "," & _DOF_Support_Extra2.ToString & "," & _DOF_Support_Extra3.ToString)
        End Function
    
        Public Sub ResetDOFVars() Implements IPlugin_Game.ResetDOFVars
            Roll_Output = 0
            Pitch_Output = 0
            Heave_Output = 0
            Yaw_Output = 0
            Sway_Output = 0
            Surge_Output = 0
            Extra1_Output = 0
            Extra2_Output = 0
            Extra3_Output = 0
        End Sub
    
        Public Sub ResetMapVars() Implements IPlugin_Game.ResetMapVars
            Roll_MemMap = 0
            Pitch_MemMap = 0
            Heave_MemMap = 0
            Yaw_MemMap = 0
            Sway_MemMap = 0
            Surge_MemMap = 0
            Extra1_MemMap = 0
            Extra2_MemMap = 0
            Extra3_MemMap = 0
        End Sub
    
        Public Sub ResetHookVars() Implements IPlugin_Game.ResetHookVars
            Roll_MemHook = 0
            Pitch_MemHook = 0
            Heave_MemHook = 0
            Yaw_MemHook = 0
            Sway_MemHook = 0
            Surge_MemHook = 0
            Extra1_MemHook = 0
            Extra2_MemHook = 0
            Extra3_MemHook = 0
        End Sub
    
        Public Sub ResetDashVars() Implements IPlugin_Game.ResetDashVars
            Dash_1_Output = ""
            Dash_2_Output = ""
            Dash_3_Output = ""
            Dash_4_Output = ""
            Dash_5_Output = ""
            Dash_6_Output = ""
            Dash_7_Output = ""
            Dash_8_Output = ""
            Dash_9_Output = ""
            Dash_10_Output = ""
            Dash_11_Output = ""
            Dash_12_Output = ""
            Dash_13_Output = ""
            Dash_14_Output = ""
            Dash_15_Output = ""
            Dash_16_Output = ""
            Dash_17_Output = ""
            Dash_18_Output = ""
            Dash_19_Output = ""
            Dash_20_Output = ""
        End Sub
    
        Public Sub ResetVibeVars() Implements IPlugin_Game.ResetVibeVars
            Vibe_1_Output = ""
            Vibe_2_Output = ""
            Vibe_3_Output = ""
            Vibe_4_Output = ""
            Vibe_5_Output = ""
            Vibe_6_Output = ""
            Vibe_7_Output = ""
            Vibe_8_Output = ""
            Vibe_9_Output = ""
        End Sub
    
        Public ReadOnly Property PluginAuthorsName() As String Implements IPlugin_Game.PluginAuthorsName
            Get
                Return _PluginAuthorsName
            End Get
        End Property
    
        Public ReadOnly Property Name() As String Implements IPlugin_Game.GameName
            Get
                Return _GameName
            End Get
        End Property
    
        Public ReadOnly Property ProcessName() As String Implements IPlugin_Game.ProcessName
            Get
                Return _ProcessName
            End Get
        End Property
    
        Public ReadOnly Property Port() As String Implements IPlugin_Game.Port
            Get
                Return _Port
            End Get
        End Property
    
        Public ReadOnly Property Enable_MemoryMap() As Boolean Implements IPlugin_Game.Enable_MemoryMap
            Get
                Return _Enable_MemoryMap
            End Get
        End Property
    
        Public ReadOnly Property Enable_MemoryHook() As Boolean Implements IPlugin_Game.Enable_MemoryHook
            Get
                Return _Enable_MemoryHook
            End Get
        End Property
    
        Public ReadOnly Property RequiresPatchingPath() As Boolean Implements IPlugin_Game.RequiresPatchingPath
            Get
                Return _RequiresPatchingPath
            End Get
        End Property
    
        Public ReadOnly Property RequiresSecondCheck() As Boolean Implements IPlugin_Game.RequiresSecondCheck
            Get
                Return _RequiresSecondCheck
            End Get
        End Property
    
        Public ReadOnly Property Enable_DashBoard() As Boolean Implements IPlugin_Game.Enable_DashBoard
            Get
                Return _Enable_DashBoard
            End Get
        End Property
    
        Public ReadOnly Property Enable_GameVibe() As Boolean Implements IPlugin_Game.Enable_GameVibe
            Get
                Return _Enable_GameVibe
            End Get
        End Property
    
        Public Function Get_RollOutput() As Double Implements IPlugin_Game.Get_RollOutput
            Return Roll_Output
        End Function
    
        Public Function Get_PitchOutput() As Double Implements IPlugin_Game.Get_PitchOutput
            Return Pitch_Output
        End Function
    
        Public Function Get_HeaveOutput() As Double Implements IPlugin_Game.Get_HeaveOutput
            Return Heave_Output
        End Function
    
        Public Function Get_YawOutput() As Double Implements IPlugin_Game.Get_YawOutput
            Return Yaw_Output
        End Function
    
        Public Function Get_SwayOutput() As Double Implements IPlugin_Game.Get_SwayOutput
            Return Sway_Output
        End Function
    
        Public Function Get_SurgeOutput() As Double Implements IPlugin_Game.Get_SurgeOutput
            Return Surge_Output
        End Function
    
        Public Function Get_Extra1Output() As Double Implements IPlugin_Game.Get_Extra1Output
            Return Extra1_Output
        End Function
    
        Public Function Get_Extra2Output() As Double Implements IPlugin_Game.Get_Extra2Output
            Return Extra2_Output
        End Function
    
        Public Function Get_Extra3Output() As Double Implements IPlugin_Game.Get_Extra3Output
            Return Extra3_Output
        End Function
    
        Public Function Get_Dash_1_Output() As String Implements IPlugin_Game.Get_Dash1_Output
            Return Dash_1_Output
        End Function
    
        Public Function Get_Dash_2_Output() As String Implements IPlugin_Game.Get_Dash2_Output
            Return Dash_2_Output
        End Function
    
        Public Function Get_Dash_3_Output() As String Implements IPlugin_Game.Get_Dash3_Output
            Return Dash_3_Output
        End Function
    
        Public Function Get_Dash_4_Output() As String Implements IPlugin_Game.Get_Dash4_Output
            Return Dash_4_Output
        End Function
    
        Public Function Get_Dash_5_Output() As String Implements IPlugin_Game.Get_Dash5_Output
            Return Dash_5_Output
        End Function
    
        Public Function Get_Dash_6_Output() As String Implements IPlugin_Game.Get_Dash6_Output
            Return Dash_6_Output
        End Function
    
        Public Function Get_Dash_7_Output() As String Implements IPlugin_Game.Get_Dash7_Output
            Return Dash_7_Output
        End Function
    
        Public Function Get_Dash_8_Output() As String Implements IPlugin_Game.Get_Dash8_Output
            Return Dash_8_Output
        End Function
    
        Public Function Get_Dash_9_Output() As String Implements IPlugin_Game.Get_Dash9_Output
            Return Dash_9_Output
        End Function
    
        Public Function Get_Dash_10_Output() As String Implements IPlugin_Game.Get_Dash10_Output
            Return Dash_10_Output
        End Function
    
        Public Function Get_Dash_11_Output() As String Implements IPlugin_Game.Get_Dash11_Output
            Return Dash_11_Output
        End Function
    
        Public Function Get_Dash_12_Output() As String Implements IPlugin_Game.Get_Dash12_Output
            Return Dash_12_Output
        End Function
    
        Public Function Get_Dash_13_Output() As String Implements IPlugin_Game.Get_Dash13_Output
            Return Dash_13_Output
        End Function
    
        Public Function Get_Dash_14_Output() As String Implements IPlugin_Game.Get_Dash14_Output
            Return Dash_14_Output
        End Function
    
        Public Function Get_Dash_15_Output() As String Implements IPlugin_Game.Get_Dash15_Output
            Return Dash_15_Output
        End Function
    
        Public Function Get_Dash_16_Output() As String Implements IPlugin_Game.Get_Dash16_Output
            Return Dash_16_Output
        End Function
    
        Public Function Get_Dash_17_Output() As String Implements IPlugin_Game.Get_Dash17_Output
            Return Dash_17_Output
        End Function
    
        Public Function Get_Dash_18_Output() As String Implements IPlugin_Game.Get_Dash18_Output
            Return Dash_18_Output
        End Function
    
        Public Function Get_Dash_19_Output() As String Implements IPlugin_Game.Get_Dash19_Output
            Return Dash_19_Output
        End Function
    
        Public Function Get_Dash_20_Output() As String Implements IPlugin_Game.Get_Dash20_Output
            Return Dash_20_Output
        End Function
    
        Public Function Get_RollMemHook() As Double Implements IPlugin_Game.Get_RollMemHook
            Return Roll_MemHook
        End Function
    
        Public Function Get_PitchMemHook() As Double Implements IPlugin_Game.Get_PitchMemHook
            Return Pitch_MemHook
        End Function
    
        Public Function Get_HeaveMemHook() As Double Implements IPlugin_Game.Get_HeaveMemHook
            Return Heave_MemHook
        End Function
    
        Public Function Get_YawMemHook() As Double Implements IPlugin_Game.Get_YawMemHook
            Return Yaw_MemHook
        End Function
    
        Public Function Get_SwayMemHook() As Double Implements IPlugin_Game.Get_SwayMemHook
            Return Sway_MemHook
        End Function
    
        Public Function Get_SurgeMemHook() As Double Implements IPlugin_Game.Get_SurgeMemHook
            Return Surge_MemHook
        End Function
    
        Public Function Get_Extra1MemHook() As Double Implements IPlugin_Game.Get_Extra1MemHook
            Return Extra1_MemHook
        End Function
    
        Public Function Get_Extra2MemHook() As Double Implements IPlugin_Game.Get_Extra2MemHook
            Return Extra2_MemHook
        End Function
    
        Public Function Get_Extra3MemHook() As Double Implements IPlugin_Game.Get_Extra3MemHook
            Return Extra3_MemHook
        End Function
    
        Public Function Get_RollMemMap() As Double Implements IPlugin_Game.Get_RollMemMap
            Return Roll_MemMap
        End Function
    
        Public Function Get_PitchMemMap() As Double Implements IPlugin_Game.Get_PitchMemMap
            Return Pitch_MemMap
        End Function
    
        Public Function Get_HeaveMemMap() As Double Implements IPlugin_Game.Get_HeaveMemMap
            Return Heave_MemMap
        End Function
    
        Public Function Get_YawMemMap() As Double Implements IPlugin_Game.Get_YawMemMap
            Return Yaw_MemMap
        End Function
    
        Public Function Get_SwayMemMap() As Double Implements IPlugin_Game.Get_SwayMemMap
            Return Sway_MemMap
        End Function
    
        Public Function Get_SurgeMemMap() As Double Implements IPlugin_Game.Get_SurgeMemMap
            Return Surge_MemMap
        End Function
    
        Public Function Get_Extra1MemMap() As Double Implements IPlugin_Game.Get_Extra1MemMap
            Return Extra1_MemMap
        End Function
    
        Public Function Get_Extra2MemMap() As Double Implements IPlugin_Game.Get_Extra2MemMap
            Return Extra2_MemMap
        End Function
    
        Public Function Get_Extra3MemMap() As Double Implements IPlugin_Game.Get_Extra3MemMap
            Return Extra3_MemMap
        End Function
    
        Public Function Get_Vibe1_Output() As String Implements IPlugin_Game.Get_Vibe1_Output
            Return Vibe_1_Output
        End Function
    
        Public Function Get_Vibe2_Output() As String Implements IPlugin_Game.Get_Vibe2_Output
            Return Vibe_2_Output
        End Function
    
        Public Function Get_Vibe3_Output() As String Implements IPlugin_Game.Get_Vibe3_Output
            Return Vibe_3_Output
        End Function
    
        Public Function Get_Vibe4_Output() As String Implements IPlugin_Game.Get_Vibe4_Output
            Return Vibe_4_Output
        End Function
    
        Public Function Get_Vibe5_Output() As String Implements IPlugin_Game.Get_Vibe5_Output
            Return Vibe_5_Output
        End Function
    
        Public Function Get_Vibe6_Output() As String Implements IPlugin_Game.Get_Vibe6_Output
            Return Vibe_6_Output
        End Function
    
        Public Function Get_Vibe7_Output() As String Implements IPlugin_Game.Get_Vibe7_Output
            Return Vibe_7_Output
        End Function
    
        Public Function Get_Vibe8_Output() As String Implements IPlugin_Game.Get_Vibe8_Output
            Return Vibe_8_Output
        End Function
    
        Public Function Get_Vibe9_Output() As String Implements IPlugin_Game.Get_Vibe9_Output
            Return Vibe_9_Output
        End Function
    
        Public ReadOnly Property PluginOptions() As String Implements IPlugin_Game.PluginOptions
            Get
                Return _PluginOptions
            End Get
        End Property
    #End Region
    End Class

    Attached Files:

  2. feniks270392

    feniks270392 New Member

    Joined:
    Jun 6, 2019
    Messages:
    6
    Occupation:
    Risuuan
    Location:
    Saint-Petersburg
    Balance:
    316Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, 6DOF
    Hello, everyone! I done my first plugin, but have some... questions... SimTools have a tuning center for max/min setup. Can i set max/min options from my plugin?
  3. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,744
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    32,501Coins
    Ratings:
    +3,803 / 10 / -0
    You can add a default min max file to the zipped plugin, yes.
    And a banner file also.

    Unzip any plugin and take a look buddy.
    Take care,
    yobuddy
    • Informative Informative x 1
  4. hooshang

    hooshang Active Member

    Joined:
    Jul 6, 2011
    Messages:
    254
    Balance:
    202Coins
    Ratings:
    +148 / 3 / -0
    My Motion Simulator:
    2DOF, DC motor, AC motor, Arduino, 6DOF
    Hello freinds
    I just going to develop a little app using C# Winfotm to test control 6dof rig.i just read lots of posts here and there, but at the first step not sure which way should i use to collect telemetry data.:sos
    Regards
    Last edited: Nov 11, 2019
  5. Sakrem

    Sakrem New Member

    Joined:
    Dec 6, 2019
    Messages:
    1
    Balance:
    18Coins
    Ratings:
    +0 / 0 / -0
    Hello everyone and thanks for reading this.
    I'm making a plugin using UDP but I can't see anything arriving in the virtual axis. I am using a licensed version and I made a console output to make sure that the Process Package is being call. I am filling the output vars but nothing is showing and since whetever else between that method and the virtual axis is not visible to me I don't really know how to proceed.
    Any thoughts? Is there any way to see the raw data going in the Game Engine?

    Thanks everyone!!
  6. Hobbs77

    Hobbs77 Active Member

    Joined:
    Jun 6, 2008
    Messages:
    151
    Location:
    Connecticut, USA
    Balance:
    464Coins
    Ratings:
    +64 / 1 / -0
    My Motion Simulator:
    2DOF, SCN5
    Well, this is the year that I venture forth and try to make a game plugin. :sos I looked over what is written here and have a few questions that hopefully will save me hours down the road. I'm going to "try" to make a plugin for Dirt Rally 2. I have downloaded ex 1 as it's listed for Codemaster's games.
    Question 1. Can the examples listed be edited and reused or do you need to write the program from scratch?
    Question 2. When it's time to compile the plugin, the ex. shows it named to LFS, is that just an ex. name or is it necessary for testing?
    Also if anyone with the talent and time could make a short video showing the process steps from beginning to end would be a big help, especially for those of us that aren't code savvy.
    That's it for now and thanks in advance!
    Last edited: Dec 8, 2019
  7. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    14,982
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    110,520Coins
    Ratings:
    +8,958 / 43 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    • Like Like x 2
  8. Hobbs77

    Hobbs77 Active Member

    Joined:
    Jun 6, 2008
    Messages:
    151
    Location:
    Connecticut, USA
    Balance:
    464Coins
    Ratings:
    +64 / 1 / -0
    My Motion Simulator:
    2DOF, SCN5
    Update.....After spending 16-20 hours Fri-Sat, trying various ways to edit the ex. file...... in the end it always came up as Dirt 2 and not DR2. So what I hoped was going to be a relatively painless, easy way to make a plugin, turns out not to be the case. But I did learn a few things in the process and 1 of those is that I have a lot more to learn! lol..... And also the answers to my original 2 questions.
  9. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,744
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    32,501Coins
    Ratings:
    +3,803 / 10 / -0
    @Hobbs77,
    PM me and we can work on that plugin together buddy.
    I'm sure it's just a few minor things your missing, or a few questions I can get out of the way.
    After a couple of plugins, it gets allot easier for sure.
    Take care,
    yobuddy
    • Winner Winner x 2
  10. Arazok

    Arazok Member

    Joined:
    Mar 26, 2018
    Messages:
    161
    Occupation:
    Computer scientist
    Location:
    Germany
    Balance:
    906Coins
    Ratings:
    +30 / 0 / -0
    My Motion Simulator:
    2DOF
    Hi Simtools guys and especially plugin developer,
    I would like to know the "logic" behind the plugin running automatically or manually.
    Currently if you set
    Const _ProcessName As String = ""
    (empty string) you have a Start/Stop button in the GameManager for this plugin.
    But some users (at least @vthinsel and me) use the PS4 as game engine and data is delivered by UDP.
    Is there an easy solution to get rid of the Play/Stop button but rather plugin starts automatically ?
    Do I need to create a process running on the host (could be a fake process which is doing nothing) which is then checked by the plugin and if the process is there (in the process table) it (automatically) starts the plugin ?
    Would be great if someone can answer the logic behind the "automatic" start of a plugin.

    cheers,
    Arazok
  11. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,744
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    32,501Coins
    Ratings:
    +3,803 / 10 / -0
    Hi @Arazok,
    If you put an exe file name here, for example notepad (Const _ProcessName As String = "notepad")
    Every time notepad launches on the PC, simtools knows to jump into action.
    When notepad closes SimTools knows to stop.

    Unfortunately when you use a console or an outside source for the game, there is no way for simtools to know if the game has started or stopped.
    This is where the Play and Stop button come into play.
    I hope that makes sense buddy.
    Take care,
    yobuddy
    • Like Like x 1
  12. Arazok

    Arazok Member

    Joined:
    Mar 26, 2018
    Messages:
    161
    Occupation:
    Computer scientist
    Location:
    Germany
    Balance:
    906Coins
    Ratings:
    +30 / 0 / -0
    My Motion Simulator:
    2DOF
    great yobuddy, I will check this....
  13. Arazok

    Arazok Member

    Joined:
    Mar 26, 2018
    Messages:
    161
    Occupation:
    Computer scientist
    Location:
    Germany
    Balance:
    906Coins
    Ratings:
    +30 / 0 / -0
    My Motion Simulator:
    2DOF
    Great, works like a charm ! Plugin is automatically started with windows, as "explorer.exe" is the process where the plugin is looking for.
    In my environment it makes sense, as I am using only one plugin (at least for the moment).

    cheers,
    Arazok
    • Like Like x 1
  14. nebriv

    nebriv New Member

    Joined:
    Feb 25, 2020
    Messages:
    9
    Balance:
    57Coins
    Ratings:
    +2 / 0 / -0
    Hey Guys,

    I'm having some trouble with the UDP handler - wondering if anyone can shed some light on it...

    I'm sending the following data:
    Code:
    DATA:{"epochms":"","heading":"9.53","pitch":"1.04","roll":"0","xAccel":"0","yAccel":"0","zAccel":"0","xAngularVelocity":"0","yAngularVelocity":"0","zAngularVelocity":"0"}:DATA
    
    I have the SimTools plugin setup like this:
    Code:
       
    Public Sub Process_PacketRecieved(received_data As String)
            If received_data.StartsWith("DATA:") AndAlso received_data.EndsWith(":DATA") Then
                Console.WriteLine(received_data)
                Dim telemetryData As Newtonsoft.Json.Linq.JObject
                telemetryData = JObject.Parse(received_data.Replace("DATA:", "").Replace(":DATA", ""))
                Yaw_Output = CDbl(telemetryData.GetValue("heading").ToString())
                Pitch_Output = CDbl(telemetryData.GetValue("pitch").ToString())
                Roll_Output = CDbl(telemetryData.GetValue("roll").ToString())
                Console.WriteLine(telemetryData.ToString())
            End If
    End Sub
    
    When I look at the tuning center and output testing in the GameEnginer there appears to be no data coming through.

    I've copied this all out to a separate VB script, compiled it and receive the packets without issue and I'm able to see all the values I'm receiving no problem. The only difference is I'm manually setting up the socket instead of using the Process_PacketReceived method... This leads me to believe that somewhere there is something going on with how the data is getting received through the SimTools plugin API? Is there any other way to debug this within the plugin?

    I've successfully sent and received data in this format:
    Code:
    S:{heading}:{pitch}:{roll}:{xAccel}:{yAccel}:{zAccel}:E
    
    Receiving code (successful - obviously modifying the code sending to this format as well).
    Code:
    Public Sub Process_PacketRecieved(received_data As String) Implements IPlugin_Game.Process_PacketRecieved
            'If received_data.StartsWith("S:") AndAlso received_data.EndsWith(":E") Then
            '    Dim spearator As String() = {":"}
            '    Dim count As Int32 = 10
            '    Dim strlist As String() = received_data.Split(spearator, count, StringSplitOptions.RemoveEmptyEntries)
            '    Yaw_Output = CDbl(strlist(1)) 'Yaw
            '    Pitch_Output = CDbl(strlist(2)) 'Pitch
            '    Roll_Output = CDbl(strlist(3)) 'Roll
            '    Surge_Output = CDbl(strlist(4)) 'X
            '    Sway_Output = CDbl(strlist(5)) 'Y
            '    Heave_Output = CDbl(strlist(6)) 'Z
            'End If
    End Sub
    

    The UDP data size is only about 180 bytes I think, so I shouldn't be hitting any UDP limitations... Anyone have any thoughts or ideas I could try?
  15. Arazok

    Arazok Member

    Joined:
    Mar 26, 2018
    Messages:
    161
    Occupation:
    Computer scientist
    Location:
    Germany
    Balance:
    906Coins
    Ratings:
    +30 / 0 / -0
    My Motion Simulator:
    2DOF
    Hi,
    have you checked and configured the correct port ?

    cheers,
    Dirk
  16. nebriv

    nebriv New Member

    Joined:
    Feb 25, 2020
    Messages:
    9
    Balance:
    57Coins
    Ratings:
    +2 / 0 / -0
    Hey Dirk - yeah I can receive data with no problem at all when I use the old format I started with (colon separated values) but when switched to sending JSON something broke. Again I've setup a separate receiver script and it receives the JSON data just fine... There appears to be an issue somewhere within the plugin and potentially how it's receiving data? But I'm not sure.

    I'm might switch to the C# template provided in this thread earlier and see if that fixes anything... I've also tried encoding the whole telemetry string in base64 thinking maybe it was breaking on the symbols somewhere, but that didn't work.

    Thanks!
  17. Arazok

    Arazok Member

    Joined:
    Mar 26, 2018
    Messages:
    161
    Occupation:
    Computer scientist
    Location:
    Germany
    Balance:
    906Coins
    Ratings:
    +30 / 0 / -0
    My Motion Simulator:
    2DOF
    Sorry, I don`t understand, as JSON or comma-separated should not matter, its just plain data.
    In the case where it works: Are you using also the plugin template ?
    Who sends the data ? The playstation or something else or is the sender of the data written by yourself ?
  18. nebriv

    nebriv New Member

    Joined:
    Feb 25, 2020
    Messages:
    9
    Balance:
    57Coins
    Ratings:
    +2 / 0 / -0
    Yeah that's why I'm confused as well... JSON/CSV/anything... it shouldn't matter. The problem exists either in the way I'm parsing and sending the data (saving the data to the variables) to the SimTools utility (bad format?) or with the receiving of the data (handled within the SimTools plugin API). Ultimately it would be incredibly useful if there was some sort of debug log or console so I could see what data the plugin is getting and setting.

    I am using the VB plugin template (for Dirt2). It successfully works in the colon separated value format so I know the network connectivity is good.

    I am sending the data via a mod I've written (for VTOL VR). I know the JSON data is being sent correctly because I'm able to receive it, and parse the values into Doubles, with the same plugin code just using my own separate socket.
  19. Arazok

    Arazok Member

    Joined:
    Mar 26, 2018
    Messages:
    161
    Occupation:
    Computer scientist
    Location:
    Germany
    Balance:
    906Coins
    Ratings:
    +30 / 0 / -0
    My Motion Simulator:
    2DOF
    Strange, and hard, if we don‘t see the code.
    If you want, send me your example via PN.
    I can take a look, then.
  20. nebriv

    nebriv New Member

    Joined:
    Feb 25, 2020
    Messages:
    9
    Balance:
    57Coins
    Ratings:
    +2 / 0 / -0
    Yeah absolutely! It's all in github actually, links (the second links are direct links to the line in the code pertinent to this issue) below containing the code for the old format. I can push my most recent changes tonight in a different branch, but I've put the meat of it in my first post.

    This is the SimTools Plugin
    https://github.com/nebriv/VTOLVR-SimTools
    https://github.com/nebriv/VTOLVR-SimTools/blob/master/GamePlugin/GamePlugin.vb#L104

    This is the Mod:
    https://github.com/nebriv/vtolvrTelemetry
    https://github.com/nebriv/vtolvrTelemetry/blob/master/vtolvrTelemetry/DataLogger.cs#L153

    I'm definitely not a C# or VB guy so I might be doing something crazy and thats why its not working... I'm just banging my head against the wall :) it's gotta be something simple...