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

Indie game dev who wants to output telemetry.

Discussion in 'Miscellaneous' started by rrh, Feb 18, 2014.

  1. rrh

    rrh New Member

    Joined:
    Feb 17, 2014
    Messages:
    14
    Location:
    Winnipeg, Manitoba, Canada
    Balance:
    143Coins
    Ratings:
    +22 / 0 / -0
    Hi, I'm a Unity developer. I've been working on something using the Oculus Rift, and I've been thinking that it works great for the visual experience, but if I could add a real sensation of motion that would make it complete. So I've been looking into what I would need to do to make that happen.

    If I understand correctly, if I want to be sure the game will work nicely with this, I should output telemetry data with acceleration and pitch and roll? Is there anywhere that's a good intro to doing this?

    From this, I get what some of my options are:
    http://www.xsimulator.net/community...a-plugin-for-simtools-api-documentation.4612/

    I could export through UDP packets or Memory Mapped Files. But that doesn't fully address what format I should use to present the data. Would I pick my own format arbitrarily and then write my own plugin to interpret it? How can I make sure it's easy to write?
    • Like Like x 3
  2. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,162
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,171Coins
    Ratings:
    +5,036 / 16 / -0
    Hi @rrh :cheers

    I can help you with this!
    These 6 below are required to get a full sim running!
    But the SimTools plugins can have up to 9 DOF's for the engine side of things.
    So you may add 3 more if you like. (maybe turbo boost etc...)

    Roll is how much the car is dipped to the left or right in [°]
    Pitch is the tilt of the car forwards or backwards in [°]
    Yaw is the heading of the car (north, east, south, west) in [°]
    Heave means the acceleration up and down [g]
    Sway means the acceleration of the car in lateral direction [g]
    Surge means the acceleration of the car in longitudinal direction [g]

    Then you can add dash board data also. (up to 20, there is a way to get more if you need it)
    may I suggest, if its a racing game, you add at least,
    Speed
    Rpm
    Gear

    I would have it output a structure with these entries to start with.

    MyGameStructure
    _Roll
    _Pitch
    _Heave
    _Yaw
    _Sway (lateral)
    _Surge (longitudinal)
    _Speed
    _Rpm
    _Gear
    EndStructure

    I would also add both options so it's flexible and you may find people do other cool things with your game.
    I would use a config file for users to turn on UDP output and/or MemMap output.
    'GameName.cfg' or something like that.
    UDP_Output = True
    MemMap_Output = True

    You may also have a option for a packet rate for UDP
    UDP_Output_Rate = 10 (in ms - 10ms is a good default)

    I could help make the plugin for the game also.
    let me know if I can help more! :cheers
    yobuddy
    • Like Like x 3
  3. Albertus

    Albertus New Member

    Joined:
    Mar 9, 2014
    Messages:
    18
    Occupation:
    Manager
    Location:
    Standerton Mpumalanga South Africa
    Balance:
    131Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Good Day

    I am a C# programmer and wonder if the data could be read through C# to be used for other cool simulator addons?

    Thank You

    Albertus Geyser
  4. rrh

    rrh New Member

    Joined:
    Feb 17, 2014
    Messages:
    14
    Location:
    Winnipeg, Manitoba, Canada
    Balance:
    143Coins
    Ratings:
    +22 / 0 / -0
    The initial project I wanted to do this I've had to put on the back-burner, but I'll keep this in mind.

    There are examples of how to send and receive UDP packets through C#, and same thing again for using memory mapped files.

    If there isn't a standardized protocol for how this data in structured within the packets and/or files, you kind of do have to handle it on a game-by-game basis. That's the impression I get from the "how to write a plugin for simtools" tutorial.
  5. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,162
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,171Coins
    Ratings:
    +5,036 / 16 / -0
    @rrh

    that is correct buddy, there is no standardized protocal.
    I sure wish there was!
    yobuddy
  6. rrh

    rrh New Member

    Joined:
    Feb 17, 2014
    Messages:
    14
    Location:
    Winnipeg, Manitoba, Canada
    Balance:
    143Coins
    Ratings:
    +22 / 0 / -0
    Like I said, the project I was initially looking into this for they decided they weren't going to support motion sim. But I'd like to try it out for one of my side projects, to learn how it works.

    I've played a little with UDP in Unity. It looks like memory-mapped files are a little more difficult, so I'll only support UDP to start.

    @yobuddy, for Roll, Pitch, Yaw, Heave, Sway, Surge, is there any common approach for which direction is positive or negative? What I mean is for example does a positive Surge value usually mean it's accelerating forward and negative mean backwards? And does positive Roll mean it's tilted to the right?

    And for Roll and Pitch, should I assume that 0, 0 would mean it's laying flat?

    Also, the Heave Sway and Surge should be relative to the orientation right? What I mean is, if it's Pitch has the nose down 25 degrees, its Surge should be the acceleration along that axis that's pointed down 25 degrees, not along the normal flat axis?

    Also all numbers are 32-bit floating-point values. I'll assume that's fine?
  7. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,398Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    This might help, even though quite a few of our plugin don't follow it, we tried to create a standard,
    http://www.xsimulator.net/co-ordinate-system/
    Yes this is correct.

    Floating point values should be fine.
  8. Ralph Manuel

    Ralph Manuel Member

    Joined:
    Aug 8, 2014
    Messages:
    50
    Balance:
    600Coins
    Ratings:
    +17 / 0 / -0
    My Motion Simulator:
    Arduino
    @rrh

    Hi! I'm also a unity game developer. I am developing a bicycle game. My problem is I don't know how can I start writing the code for telemetry output. If you've solve this, can you guide me, Thanks
  9. value1

    value1 Nerd SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Jan 9, 2011
    Messages:
    2,184
    Location:
    Zug, Switzerland
    Balance:
    14,497Coins
    Ratings:
    +3,319 / 11 / -1
    My Motion Simulator:
    2DOF, DC motor, JRK, Joyrider
    Hi @rrh and @Ralph Manuel

    There's no common definition of the angle or acceleration values. People output what they use in their coordinate system. Sometimes Heave, Sway, Surge are given in world coordinates, sometimes in local coordinates, sometimes in "g" units, sometimes in m/s², and so on. That's why we have SimTools. We collect the available game data in the plugins and convert them to the right values for the simulation platform with the definitions as mentioned by @eaorobbie
    @Ralph Manuel: What language are you coding with? I can give you some sample snippets in C++ and VB.net (if needed in LUA too picard-facepalm.gif LOL)

    BTW: Memory Mapped File (MMF) may sounds difficult but is no big deal either. I can provide you some sample code too. (Not in LUA though :grin)
    • Winner Winner x 2
    • Informative Informative x 1
  10. rrh

    rrh New Member

    Joined:
    Feb 17, 2014
    Messages:
    14
    Location:
    Winnipeg, Manitoba, Canada
    Balance:
    143Coins
    Ratings:
    +22 / 0 / -0
    I've provided Ralph some example code in C# that I used in Unity with a plugin written by YoBuddy, which I link here:
    http://www.xsimulator.net/community/threads/capturing-max-min-with-tuning-center.5623/#post-58471

    I output the motion using UDP not MMF, because of Unity reasons.
    ( Those reasons: Unity uses a Mono framework which supports .NET class libraries up to 2.0, but System.IO.MemoryMappedFiles was introduced in .NET 4.0
    Outputting to UDP was a lot easier for me than figuring out how to work around that.
    http://msdn.microsoft.com/en-us/library/vstudio/system.io.memorymappedfiles
    https://docs.unity3d.com/401/Documentation/ScriptReference/MonoCompatibility.html )
    • Informative Informative x 4
    • Like Like x 1
  11. Ralph Manuel

    Ralph Manuel Member

    Joined:
    Aug 8, 2014
    Messages:
    50
    Balance:
    600Coins
    Ratings:
    +17 / 0 / -0
    My Motion Simulator:
    Arduino
    @value1
    I'm using C# for this.
    rrh gave me some codes in C# I think it will help me a lot.
    I cannot give it a try because I'm busy right now because of exams. Maybe tomorrow or tonight I will be able to check it.

    Thanks @rrh for the codes. I will also use UDP to send data because it is more easier than MMF.

    I'll give it a try and will make you updated. Thanks for guiding me, this is a friendly forum :)