1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. 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!
  3. 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
  4. 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 v3.0 - API documentation

Discussion in 'Tutorials and Tips by the Developer' started by yobuddy, Apr 6, 2022.

  1. Blastertoad

    Blastertoad Member

    Joined:
    Nov 21, 2023
    Messages:
    59
    Balance:
    367Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor
    Compiling the UDP example ( Dirt Rally ) and using the plugin tester tool I just repeatably get error "selected path is not valid for patching". I have run the game, and confirmed the files listed in source are present in directory.

    Also how do you actualy parse the data? When I sniff packet from Dirt Rally I get non human readable mess.
    Then in source it is seemingly magically parsed to the defined struct via DirectCast.

    The game I am looking to do a simple plugin for just provides 6 comma seperated floats. I get making a matching struct but not how to parse byte array into stuct.
  2. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    Yes, the data comes in a bytes and they get cast into it's structure.

    Sounds like vector36?
    If so we finished that one for you..
    https://simtools.us/plugin/?varname=1021&color=0e97dd

    But as an example, we can get the data like this.
    Dim strArray As String() = Split(strReturnData, ",")
    • Useful Useful x 1
  3. Blastertoad

    Blastertoad Member

    Joined:
    Nov 21, 2023
    Messages:
    59
    Balance:
    367Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor
    @yobuddy
    Looking to build a plugin for test app outputing udp with values in json. In this case is there any benefit to using a struct? Could I not just get recieved upd bytes as json and directly query the json object skipping mapping values to struct? Is there any benefit of the struct in this setup?
  4. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    The struct method is very fast, as you send the data as binary, and then cast the received bytes into the structure for easy var access. But there are a lot of ways that it can be done. 6 comma separated floats works, and so will a json object. It will work just fine.
    Take care!
    • Informative Informative x 1
  5. MatteKarla

    MatteKarla New Member Gold Contributor

    Joined:
    Sep 17, 2023
    Messages:
    25
    Balance:
    20Coins
    Ratings:
    +18 / 0 / -0
    My Motion Simulator:
    2DOF
    What versions of .NET are supported when creating a game plugin?
  6. adog6000

    adog6000 New Member

    Joined:
    Jan 31, 2024
    Messages:
    14
    Balance:
    84Coins
    Ratings:
    +1 / 0 / -0
    When I compile the DirtRally example plugin and try to test it in the plugin tester I get "not a valid game plugin" error popup.
  7. adog6000

    adog6000 New Member

    Joined:
    Jan 31, 2024
    Messages:
    14
    Balance:
    84Coins
    Ratings:
    +1 / 0 / -0
    NM I used the Release configuration and it worked cheers.
  8. adog6000

    adog6000 New Member

    Joined:
    Jan 31, 2024
    Messages:
    14
    Balance:
    84Coins
    Ratings:
    +1 / 0 / -0
    I've got the plugin loading in the tester and I'm assigning values to _MotionOutputs, the tester shows the game as active, but I only see 0 for the motion output values @yobuddy. I've tested the UDP receive code standalone and can confirm that my data object is populating with values which I then assign to _MotionOutputs properties. What am I missing?
    Last edited by a moderator: Feb 9, 2024
  9. adog6000

    adog6000 New Member

    Joined:
    Jan 31, 2024
    Messages:
    14
    Balance:
    84Coins
    Ratings:
    +1 / 0 / -0
    Even if I hardcode values in the plugin like:

    'Motion
    _Motion_Outputs._Yaw = 1.56 'mbsData.rotationY
    _Motion_Outputs._Roll = 2 'mbsData.rotationZ
    _Motion_Outputs._Pitch = 3 'mbsData.rotationX

    The plugin tester still only shows 0.
  10. FaseTechEmployeeAccount1

    FaseTechEmployeeAccount1 New Member

    Joined:
    Jul 30, 2024
    Messages:
    6
    Balance:
    42Coins
    Ratings:
    +3 / 0 / -0
    Hello - I've made my own GamePlugin from the DirtyRally template (I'm using UDP for telemetry data) - When I install the GamePlugin and launch it from SimTools v3, it only runs the game up, but doesn't show in SimTools that it's running.

    What am I missing? Is there a specific code line I need to write, in order to tell SimTools that i'm running a game?

    Also ran the GamePlugin on the Tester and it works as expected. I get the UDP packets from my game into the Tester.
  11. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    How are you launching the game plugin, with a double click of the play button? Maybe you have a wrong process name? It's hard to say without he code to look at.
  12. FaseTechEmployeeAccount1

    FaseTechEmployeeAccount1 New Member

    Joined:
    Jul 30, 2024
    Messages:
    6
    Balance:
    42Coins
    Ratings:
    +3 / 0 / -0
    I figured it out - I was using SimTools on a computer that wasn't setup with an actual motion simulator. Thus not allowing me to run the GamePlugin (Sorry for the inconvenience)
    • Informative Informative x 2
  13. FaseTechEmployeeAccount1

    FaseTechEmployeeAccount1 New Member

    Joined:
    Jul 30, 2024
    Messages:
    6
    Balance:
    42Coins
    Ratings:
    +3 / 0 / -0
    New challenge encountered: So everything works for my GamePlugin except one thing. It installs and can run along with the application/game automatically with SimTools 3. However it doesn't seem SimTools 3 receives data from my game.

    Weird thing is i've tested the GamePlugin on the "Game_PluginTester" app which yobuddy provided. And everything works there. The data gets received and assigned to their destinated motion output variables.

    Check the zip file I send along this comment for the code.

    I'm completely new on the field of writing GamePlugins (And anything related to Motion Sim Software). So forgive me for my low knowledge on the field

    Attached Files:

  14. FaseTechEmployeeAccount1

    FaseTechEmployeeAccount1 New Member

    Joined:
    Jul 30, 2024
    Messages:
    6
    Balance:
    42Coins
    Ratings:
    +3 / 0 / -0
    Upon looking more in-depth of my code. I realize I set the " _Status_Outputs._OutputActive" field to true when I start the game, and never change it to false until I use GameStop.

    Is this field " _Status_Outputs._OutputActive" supposed to be switching between true & false upon receiving UDP packets. Or should it remain on/true at all times when the game i live?
  15. FaseTechEmployeeAccount1

    FaseTechEmployeeAccount1 New Member

    Joined:
    Jul 30, 2024
    Messages:
    6
    Balance:
    42Coins
    Ratings:
    +3 / 0 / -0
    Alright I figured out my issues - It does work. Just didn't realize I needed to adjust Axis Limiting and set them away from zero on min & max values

    [​IMG]
  16. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    Sorry for the late replay, we have a big update going out tomorrow, and we have been busy with the manual and videos for the new GoPro2VideoRide app.

    You want it to be switching, so its false when in the menus, and is only active when on the track in the game.

    Most codemaster games only send UDP packets when your actually on the track and racing, other games have a variable for racing status, so whatever works depending on whats available.
    Hope that helps,
    yobuddy
    • Like Like x 1
    • Informative Informative x 1
  17. FaseTechEmployeeAccount1

    FaseTechEmployeeAccount1 New Member

    Joined:
    Jul 30, 2024
    Messages:
    6
    Balance:
    42Coins
    Ratings:
    +3 / 0 / -0
    Definitely helps. Thanks a lot
    • Like Like x 1