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

Question Making our own Unreal Engine 5.1 game - need help with plugin

Discussion in 'New users start here - FAQ' started by Jeff Long, Jan 24, 2023.

  1. Jeff Long

    Jeff Long New Member

    Joined:
    Jan 24, 2023
    Messages:
    11
    Balance:
    76Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hi all,

    We're building a 2DOF Model T Ford "not really racing" simulator (port stern NEMA 42 stepper motor (driver's side rear) and starboard stern NEMA 42 stepper motor (passenger side rear) - and we've already written our own game in Unreal Engine 5.1. The stepper motors have encoders for feedback but we haven't purchased the two stepper motor controllers just yet. We're using an Arduino to receive the data from SimTools, probably going to be from a serial port (UART) and let's see, what else - we're using Windows 10. We plan on using a Single Computer setup. That setup seems to be all fine, but we haven't compiled the plugin below (which should just tell the system the game has been patched, but it hasn't because we're using UDP output from the game).

    Right now we're trying to get the game to send telemetry to SimTools. We're noooooobies. So I've got the Dirt 2 plugin example and have modified the parameters for a game that sends UDP values. The part that's got me stuck at the moment is this part:


    With MyOutsim_Internal
    Roll_Output = ((.sngOrientation2 * 180 / 3.14159) - 90)
    Pitch_Output = (.sngOrientation1 * 180 / 3.14159) * -1
    'Heave_Output = (System.Math.Cos(.sngOrientation2) * .sngAcceleration2)
    'Yaw_Output = (.sngOrientation0 * 180 / 3.14159)
    'Sway_Output = ((System.Math.Cos(.sngOrientation0) * .sngAcceleration0) + (System.Math.Sin(.sngOrientation0) * .sngAcceleration1))
    'Surge_Output = ((-System.Math.Sin(.sngOrientation0) * .sngAcceleration0) + (System.Math.Cos(.sngOrientation0) * .sngAcceleration1))
    'Extra1_Output = (((System.Math.Sin(.sngOrientation0) * .sngAcceleration0) + (System.Math.Sin(.sngOrientation0) * .sngAcceleration1)) * -1)
    End With


    For now, I have our game sending JUST Pitch and Roll in that order via Blueprint, which I assume is sending two 32 bit values (4 bytes) that needs to be decoded here (above). They're both in floating point degrees. I have confirmed with Wireshark that the game is outputting data on UDP port 4123. What confuses me is that the roll and pitch calculations above use the .sngOrientation value which is not discussed elsewhere so I don't know what it comes from - I would assume this is values coming in via the ByteArray but I don't see where .sngOrientation comes from ByteArray. Also, the Dirt example does a different calculation than the HTML page example tutorial.

    (how to write a game plugin for simtools - 2 - 0 api documenation.9107)

    I wish there was a tutorial on just how to calculate these values for Simtools. I literally think if I had that I could do all that I need!

    Any advice would be appreciated - especially on these calculations, but on anything else as well - our Arduino to stepper motor setup, our editing/using of the Dirt2 example with UDP output (I assume I DO NOT HAVE TO PATCH our game at all, since it's already sending UDP data), or anything else for that matter.

    Due to time constraints, we're trying to get this thing working in only a few weeks, with several people working nearly full time. It's for fun, not commercial, but deadlines are deadlines!

    If I've failed to do anything properly in terms of this post or thread, I sincerely apologize. I have tried to read up on everything and the FAQ but there's a lot to digest. Cheers!

    Thank you so much!
    Jeff Long
    • Like Like x 1
    Last edited: Jan 24, 2023
  2. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,780
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    146,528Coins
    Ratings:
    +10,819 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  3. Jeff Long

    Jeff Long New Member

    Joined:
    Jan 24, 2023
    Messages:
    11
    Balance:
    76Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    I have looked at that - thank you - he's sending the data as a string. We've already gotten this portion down.

    It's reading the data in the plugin that's throwing us for a loop. We were given give different ways of handling it written by YoBuddy, and neither really explains why. I don't mind in the slightest paying the $29 EU or more for getting other plugins, but I am yet to be convinced that will help us figure this out.

    Thank you though!
    Cheers,
    Jeff

  4. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,780
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    146,528Coins
    Ratings:
    +10,819 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    The method used to create a plugin depends on what data is or is not provided by a game, so the hook method for games that have no telemetry provided, mapped file for games that use them, or UDP, which should apply to your game: https://www.xsimulator.net/communit...lugin-for-simtools-2-0-api-documentation.131/

    I am sure @yobuddy would squeeze in specific advice if you can detail the problem(s) you have creating a UDP plugin.
  5. Jeff Long

    Jeff Long New Member

    Joined:
    Jan 24, 2023
    Messages:
    11
    Balance:
    76Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Thank you. I do know that - what you attached below is what we've been using to get where we are now. Also, I actually did detail the problem I had in creating the UDP plugin in my original post - at the bottom. I just need to understand the few (3 or 4) lines of code that translate what values come over the UDP as Roll and Pitch (primarly) to Roll and Pitch that the plugin needs. The two Visual Basic examples (One in the code, one in the article you post below) use different COS and SIN equations and so on, but don't explain why the translation is occuring, and also, what .sngOrientation0, .sngOrientation1, and .sngOrientation2 comes from - I think it's supposed to come from the UDP data, but it doesn't say so and there's no place in the plugin it's shown.
    That's (seemingly) all I need. I also should confirm that when since my Unreal Engine 5.1 game is outputting via UDP, that I DO NOT NEED to patch the game - it already does what it needs. THANK YOU.

  6. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,224
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,576Coins
    Ratings:
    +5,052 / 17 / -0
    Yes, that is all data from the game.
    All this math stuff will be changed out for what your game sends.
    The examples you mention send data in world coordinates and needs to be translated to local coordinates so we can use them is all.
  7. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,224
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,576Coins
    Ratings:
    +5,052 / 17 / -0
    For simtools v2 anyway, you will still need to do the patching procedure in v2 in order to activate the plugin.
    (Not required for the v3 api)
  8. Jeff Long

    Jeff Long New Member

    Joined:
    Jan 24, 2023
    Messages:
    11
    Balance:
    76Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    @yobuddy - thank you so much. Our game is sending degrees for Roll and Pitch -180 < x < 180, so it sounds like it doesn't need to be translated at all.

    Can you confirm please that .sngOrientation0 is the FIRST parameter of game data, .sngOrientation1 is the SECOND parameter of game data and .sngOrientation2 is the THIRD parameter of game data?

    If I don't need to translate because we are passing values in straight degrees, then I just need to make sure I'm picking up the two 32 bit (DWORD) floating point numbers properly (I assume in .sngOrientation0 and .sngOrientation1.

    THANKS - Getting closer!!!

    Cheers,
    Jeff

  9. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,224
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,576Coins
    Ratings:
    +5,052 / 17 / -0
    You don't need to use sngOrientation, or any vars like that at all.
    I suggest you make a structure for the data in your game like this.

    Structure TelemData
    Private Roll as double
    Private Pitch as double
    Private Yaw as double
    Private Heave as double
    Private Sway as double
    Private Surge as double
    Private TractionLoss as double
    End Structure

    And then make the game sent the structure as bytes.
    Then we will just cast the bytes back to the structure in the plugin.

    SimTools is setup to "wrap around the games", so the games don't need to do anything one way to make them work. Using a structure for output also means you can add to the structure (at the bottom) at any time also, and not break any current apps that use the data.

    Sent you example apps for sending and receiving data in binary structures to your PM buddy.
    Last edited: Jan 25, 2023
  10. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,224
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,576Coins
    Ratings:
    +5,052 / 17 / -0
    I would say let's try to get the game sending the data in a binary structure.
    You can edit, and use the binary receiver app i sent you, to check that your game is sending and decoding the data correctly.
    Buzz me when you get this far, and I will slap together a v3 plugin for you!
    Take care!
    yobuddy

    Also know that your game should only send data when we are on the track, Or you can supply a variable in your outputs for when the game is live/on the track. (we just need to know when SimTools should be running is all.)
    Chat soon!
    • Like Like x 2
  11. DOF_Dex

    DOF_Dex New Member Gold Contributor

    Joined:
    Jan 29, 2024
    Messages:
    17
    Location:
    London
    Balance:
    19Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, 6DOF
    @yobuddy Hi, is it possible to have the name of the binary receiver app? Is this ‘simpleudpreciever’ ? Also is it ok to check out the v3 plug-in you sent to Jeff and anything else that maybe helpful to me. I’m working through the unreal plug-in documentation and the puzzle will make more sense with working examples. Thanks.

    I’m currently looking at a ue5 plugin that exports data to sim racing studio via udp. The developer of the plug-in said it is possible to tweak the udp implementation and data structures used to interface with simtools. Not knowing C++ , are there developers that can help with this?’if not I m looking at maybe an app that can listen to udp. I have seen applications to do this but can you recommend one that can pick out the 6Dof without too much pain! Thank you.
  12. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,224
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,576Coins
    Ratings:
    +5,052 / 17 / -0
  13. David Checa

    David Checa New Member

    Joined:
    Apr 4, 2024
    Messages:
    1
    Balance:
    - 4Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF
    @yobuddy Hi, I am also interested in the binary receiver application. I have migrated tupluging from unreal to ue 5.3 and i have tried with the simpleudpreciever and it is sending the data fine. I have tried with the DirtRally example v3 plugin, and it receives the data but I don't know how to wrap it to display the data correctly. Any example where to see how to modify the dirtrally plugin to correct show what ue4 sends?

    UnrealEditor_TJq5wCoout.jpg UnrealEditor_mjvlP6AbwW.jpg