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 2.0 - API documentation

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

  1. KWhale

    KWhale New Member

    Joined:
    Aug 29, 2019
    Messages:
    10
    Balance:
    182Coins
    Ratings:
    +4 / 0 / -0
    My Motion Simulator:
    6DOF
    Yes, you nailed it on the compiler. Thanks! I'm not that familiar with Visual studio, so I was hoping it was something simple like that.

    What I was trying to load was a Unity Plugin from a git repository (called QuPlaySimtools). I downloaded Live for speed and got that running fine in virtual axis output testing. I don't have dirt 2, but I did load the example plugin into the updater, so my game manager has both those games (dirt 2 is not patched). I was anticipating that when I loaded my zipped Quplay solution into the updater that Quplay would appear as an option in the game manager. It's not -- still only dirt 2 and Live for speed. It looks like Quplay was built from the dirt 2 example, so I thought maybe somewhere it might still have dirt 2 in a namespace, and that I was overwriting the previous load. But it appears that the patching subroutine was removed from the Quplay plugin, but if I try to patch dirt 2, the game manager still attempts to patch the game.
  2. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,906Coins
    Ratings:
    +5,027 / 16 / -0
    @KWhale,
    Please post your plugin here buddy and I will take a look man!
    • Friendly Friendly x 1
  3. KWhale

    KWhale New Member

    Joined:
    Aug 29, 2019
    Messages:
    10
    Balance:
    182Coins
    Ratings:
    +4 / 0 / -0
    My Motion Simulator:
    6DOF
    Yobuddy, thanks in advance! You're a gentleman and a scholar.

    Attached Files:

    • Friendly Friendly x 1
  4. KWhale

    KWhale New Member

    Joined:
    Aug 29, 2019
    Messages:
    10
    Balance:
    182Coins
    Ratings:
    +4 / 0 / -0
    My Motion Simulator:
    6DOF
    Yobuddy, did you happen to try to compile the Quplay solution online :https://github.com/ddkclaudio/QuplaySimTools
    If that compiled into a functional plugin, then it would have to be my compile settings. If not, then it's probably a compatibility issue with simtools 2.4, as Claudio said it worked with Simtools 2.0.
  5. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,906Coins
    Ratings:
    +5,027 / 16 / -0
    I think the import code just needed some correcting is all.
    I also turned the file patching off, as the actual patching routine was still for LFS.
    Seems to install ok, pic below.
    Please install this and test it out.
    (BTW, You still have to Patch / activate the plugin, just so you know)

    upload_2019-9-13_13-11-3.png



    Once you have it working you can rename your game as you want and make it your own like this.

    1) Please look for the line (Private Const _DOF_Support_Extra1 As String = "Traction Loss")
    And change "Traction Loss" to whatever your game delivers for extra1
    Same goes for extra 2 and 3.
    If the game does not deliver anything to an extra outputs, set them to blank to turn them off.
    (blank = not used.)

    2) Then to make it work with an exe not named "QuPlay".
    Change _GameName to the name you want displayed in simtools.
    Change _ProcessName to the name of the game name shown in task manager.
    For example, if notepad was the game we wanted to launch with.
    We see that the name in task manager is notepad.exe, so the _ProcessName you would add would be "notepad"
    (But of course use the name of your game not notepad.)

    3) Then be sure to change the _PluginAuthorsName and add you name, game tag whatever.

    4) Now click 'Project' then 'Properties'
    And rename the file like this:
    GameName (without spaces) + _GamePlugin
    So if we were doing Live foe Speed it would be this.
    [​IMG]

    Now compile it and you should be good to go for you game!
    Take care,
    yobuddy

    Attached Files:

    • Informative Informative x 2
  6. KWhale

    KWhale New Member

    Joined:
    Aug 29, 2019
    Messages:
    10
    Balance:
    182Coins
    Ratings:
    +4 / 0 / -0
    My Motion Simulator:
    6DOF



    Thanks so much for that, Yobuddy. And yes, between the tutorial and the plugin, I can see how to configure the code for name change. FWIW, my problem was that I thought I read in the tutorial to zip the entire project and place it in the updater. I tried just placing the .dll plugin into the updater, and that didn't work for some reason, and I'm just used to zipping large folders -- I don't usually zip a single file, and I didn't read the manual closely enough. Fortunately, you left the zipped plugin inside your download, and I was able to see that it was just the .dll that gets zipped. So that fixed that. And I see that you turned off the patchrequired bool.

    Unfortunately, there is no information about patching, and more specifically, what the config file is supposed to look like. The LFS config.txt file appears to have configuration data for Simtools - a port number, ip address, and some other variables, but I don't see where that is read in the GamePlugin.vb file. So I assume that code exists somewhere else in the solution? I'm not quite sure why I need to patch, since I can manually input port and ip addresses. Do I really need to patch or can I leave the patchrequired bool false?

    So far, I'm not getting the game to connect to Simtools (indicators aren't turning blue). I was just trying to get the Quplay Main.Unity project working. The only changes I made were putting in the correct IP -- I'm working with my computer's IPv4 address and port 4123 (in the manager IP). And I also corrected the random function which had been deprecated, but that wouldn't keep the game from connecting to Simtools. I've tried to patch the LFS config.txt file, and it will patch if I put the correct .exe file in the directory, but I didn't expect to see the game connect, and I wasn't wrong. I've been all through the xsimulator archives and can't find anything on writing a config file.

    So I have a supplied plugin for Dirt 2, and a config file for LFS. I really could use a matching pair. Since you wrote the plugins for Dirt 2, would you be able to send me the config.xml file to Dirt2 or the gameplugin.vb file for LFS? Or at least code snippets? Otherwise, I don't know where to go from here.

    Thanks much again!
    Last edited: Sep 14, 2019
  7. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,906Coins
    Ratings:
    +5,027 / 16 / -0
    You can drop the files in the plugin updater zipped or unzipped, it won't matter.
    We zip them up because a plugin should be at least 3 files.
    The main dll, the banner file, and a default min/max file.
    All 3 of these should be zipped up and in the final plugin.

    I set the patching path to false.
    How do you patch your game in order to get telemetry out?
    If you don't edit a file manually, then you won't need this.

    So far, I'm not getting the game to connect to Simtools (indicators aren't turning blue). I was just trying to get the Quplay Main.Unity project working. The only changes I made were putting in the correct IP -- I'm working with my computer's IPv4 address and port 4123 (in the manager IP). And I also corrected the random function which had been deprecated, but that wouldn't keep the game from connecting to Simtools.
    if you on the same PC then 127.0.0.1 is what you want.

    Your making the plugin for your game?
    So you don't need LFS at all?
    If you game has a config file, then you can make the plugin edit it (like it does for LFS).
    If your game does not, then you don't need patching.

    The guy's that wrote Live for Speed created the "config.xml", codemaster games use a file called "hardware_settings_config".

    For instance in your game, if you turn telemetry on, what file does this setting save to?
    If we know that, we can make SimTools automatically edit that file, and we don't need game settings instructions for the users.
    I hope that makes sense buddy.

    Take care,
    yobuddy
  8. KWhale

    KWhale New Member

    Joined:
    Aug 29, 2019
    Messages:
    10
    Balance:
    182Coins
    Ratings:
    +4 / 0 / -0
    My Motion Simulator:
    6DOF

    Okay, so I misunderstood before when you wrote, "(BTW, You still have to Patch / activate the plugin, just so you know)," I'm thinking now, you just meant I needed to click on the 'patch' field to activate it, even though I'm not actually patching the game. Hopefully I understand that correctly.

    and NEVERMIND -- Just wrote a bunch of stuff, but figured it out going through the manual again. Simtools is looking for an executable named Quplay.exe, but I was working in the Unity editor, so...nothing. And before when I tried a compiled game, I think because the scene was named main.unity, it was just creating an executable named main.exe, but now ... Connected!!! Now hopefully, I can get actual telemetry to pass...

    Thanks again for your help!
    • Like Like x 1
    Last edited: Sep 16, 2019
  9. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,906Coins
    Ratings:
    +5,027 / 16 / -0
    Yes, exactly!
    It does not patch any files but it does tell SimTools that the plugin is active.

    Yes, you would want this to be your game.
    Cool man, let me know how it goes!
    Take care,
    yobuddy
  10. KWhale

    KWhale New Member

    Joined:
    Aug 29, 2019
    Messages:
    10
    Balance:
    182Coins
    Ratings:
    +4 / 0 / -0
    My Motion Simulator:
    6DOF
    It took a little while for me to figure out how to see the telemetry received since I didn't have a max/min file, but I eventually got it. Thanks again, Yobuddy! Hopefully getting Simtools talking to my hardware will be a little easier :)
    • Like Like x 2
  11. kparkin

    kparkin Member

    Joined:
    Oct 6, 2018
    Messages:
    90
    Location:
    United Kingdom
    Balance:
    254Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    4DOF
    Is there an easy way to assign surge to 2 separate axis' in order to control a harness tension system?
  12. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,460
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,596Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Yes you can allocate surge to two separate motors and controllers, which will allow you to set surge for each.
  13. kparkin

    kparkin Member

    Joined:
    Oct 6, 2018
    Messages:
    90
    Location:
    United Kingdom
    Balance:
    254Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    4DOF
    Can this only be done by modifying the plugin, or am I missing something.
    I can assign surge to a different axis but don't know how to get that information in the Tuning Center.
  14. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,460
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,596Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    The Tuning Center allows global settings, the Axis Assignment and associated filters allow axis/force specific settings.
  15. kparkin

    kparkin Member

    Joined:
    Oct 6, 2018
    Messages:
    90
    Location:
    United Kingdom
    Balance:
    254Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    4DOF
    I obviously don't understand enough about this.
    What I want to do is assign surge to a separate actuator, for braking, and be able to control how it behaves, independent of what happens to the main surge axis on the rig.
  16. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,460
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,596Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    What is the physical construction of the rig axis layout?
  17. kparkin

    kparkin Member

    Joined:
    Oct 6, 2018
    Messages:
    90
    Location:
    United Kingdom
    Balance:
    254Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    4DOF
    I have actuators at four corners, for surge, roll, sway, heave and pitch. The one I'm after adding surge to, is mounted vertically behind the seat for the harness
  18. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,906Coins
    Ratings:
    +5,027 / 16 / -0
    You can use surge from the (A) axis assignments for the sim.
    And you can use surge from the (B) axis assignments for the belt tensioner, if that's what your looking for buddy?
    Take care,
    yobuddy
    • Like Like x 1
  19. kparkin

    kparkin Member

    Joined:
    Oct 6, 2018
    Messages:
    90
    Location:
    United Kingdom
    Balance:
    254Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    4DOF
    Brilliant, I'll give that a go. I'd forgotten about the changes you had made for v2.4. Thanks.
  20. kparkin

    kparkin Member

    Joined:
    Oct 6, 2018
    Messages:
    90
    Location:
    United Kingdom
    Balance:
    254Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    4DOF
    Works perfectly. Thank you yobuddy.
    • Winner Winner x 1