Announcement

Collapse
No announcement yet.

Replishot: Use Optishot with TGC 2019

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Replishot: Use Optishot with TGC 2019

    I have recently been working on custom software, Replishot, to capture data from the Optishot, process it and use it in TGC 2019. I've recently published my first pass of my program on github here. If you click on releases on the right there is an .exe you can download (Windows only). The page also has a readme that gives basic information on how to use the program.

    Essentially the program captures Optishot data, processes it, and then turns it into mouse movements which TGC 2019 will recognize as a valid swing. The swing will change based on how hard you hit the ball as well as club angle, etc. The program works with the "video game" version of TGC 2019, not the "simulator" version.

    It is very much a work in progress. I would appreciate feedback on improvements people would like to see. I am still working on getting more accurate ball flight based on what the Optishot sensors report, so if you're an avid golfer and the shots don't seem quite right... well, I wouldn't be terrible surprised at this point .

  • #31
    Omg. This is a game changer. I'm a developer if you are looking for another contributor. In the meantime I guess I better go buy TCG and try it out. Thanks!

    Comment


    • Zaren
      Zaren commented
      Editing a comment
      Thanks, I hope it works well for you, please let me know your thoughts. I don't do SW full time, so feel free to read over the code, shake your head, and sigh a lot! I don't know that there's much of a roadmap left. Feel free to send me a PM if you want to chat about some of the remaining items on my list.

  • #32
    Replishot v 1.5 has released! You can find it here. The main addition is an arcade mode, which allows you to add a multiplier to the total distance of your shot. This can be used to play TGC in career mode, or to even the playing field between friends! The readme has information on this new feature, but essential when arcade mode is on additional boxes will appear on the GUI. The + and - can be used to change the multiplier, and the current multiplier value is also displayed.

    There were also some updates/improvements to the regular shot algorithm, hopefully producing more accurate shot distances.

    Give it a whirl and let me know your thoughts!

    Comment


    • Chuck
      Chuck commented
      Editing a comment
      Nice. I played Optishot for years and while I love their software, it was really beginning to show its age. I'm so glad you could bring tgc2019 into this unit's repertoire.

  • #33
    Hi Zaren,

    Great update! The club selection is working perfectly with this update (Tesseract). Did you update this, or I'm a just having good luck with it now? Before this update, Tessearct would require a much longer time to change clubs in Replishot to match what is shown in TGC, or simply not change at all.

    The arcade mode is great too - allows for a quick distance adjustment.

    My one critique is that the club speed (Replishot mph) to shot power (TGC) seems to be inconsistent. Basically, I can't seem to reach the desired power level (0-100% in TGC) after switching clubs. If I swing a PW at my max 70-75mph, I'll get a read out of something like 70% power in TGC. If I then switch to my driver and swing at my max 95-100mph, I'll get the proper 100% power in TGC. Is there a way for me to adjust this manually in code? Or possibly add a specific arcade mode for each club, so I can fine tune them in the driving range? Maybe my swing speeds are off, but I play enough golf to realize that something is off.

    Thanks for all your hard work!
    Dave

    Comment


    • Zaren
      Zaren commented
      Editing a comment
      Hey Dave,
      First, I actually removed Tesseract entirely and wrote my own code to read the screen and do the club capture. Glad it's working great for you! The code does run MUCH faster, but runs on a very different concept. Tesseract is a very advanced image to text program that would spit out the text it thought it read from part of the screen, and then I'd look for club names in the text. In the new updated I now pull a portion of the screen and check it against a data set to find the closest match, and pick that club. The caveat to the new approach is that it only works in 1920x1080, and probably only with a single monitor (or else it might capture the wrong part of the screen). Probably the "best" long term work around for other resolutions would be to just build a database for each resolution that is supported. It doesn't take too long to get the data, etc.

      Also glad you're enjoying arcade mode!

      As for yardage, I'd say that personally I am very much a "by feel" golfer, which is probably just me saying my shot distances are very inconsistent, but in a nice sounding way. Because of that it can be hard for me to feel like I reliably know how far a shot should go that I take. To try to offset this I've used several tables I've found online that coordinate club head speed with shot distance for various clubs and tried to make an algorithm that fits this. I haven't gone through and tested every club, so there is a chance that discrepancies exist. Just a quick look at my chart I've been using and I'd guess that a club head speed of 70-75 with a PW should result in a power around 70-75%. The chart I used says a PW at 70 MPH should go 85 yards, and at 80 MPH it should go 97. I just pulled up TGC and Replishot and typed in a "75 MPH" straight shot, and it carried about 87 yards into a headwind, so it seems like Replishot produced the show I was expecting.

      Here's the chart I used: https://swingmangolf.com/wp-content/...peed-chart.png

      I can find the same chart other places, like here: https://www.golfwrx.com/wp-content/u...SpeedChart.jpg

      But as I was just poking around I also found a stat that the average pro swings a PW 83 MPH and hits it 136 yards, which is super different than my chart. Sigh, so much for consolidated information. I can look more into this and see if I can find numbers to update my chart with. Would you have been expecting a carry distance more in the range of 110-120 yds? Thanks for the feedback!

  • #34
    Hi Zaren,

    Thanks for the quick response. I was right, you did fix the club selection - great job! It works flawlessly for me! This now makes TGC playable for me.

    So, yes, each club has a unique max swing speed, which is mainly based on the length of the club. So a lob wedge swung at 71 MPH and driver swung at 105 MPH should both equal 100% power. Your thought of a PW swinging at 74 MPH equals 75% power is incorrect to the golf world - 74 MPH is the max speed, so this would equal 100% power, but only with this club.

    I'm not a pro by any means, but if I really rip it, I could get to these swing speeds at my maximum effort. I also included a PGA tour avg chart image.

    Driver - 105 MPH = 100% TGC power- 260-270 yards
    3-wood - 100 MPH = 100% TGC power- 230-240 yards
    5-wood - 96 MPH = 100% TGC power- 180-190 yards
    5-hybrid - 92 MPH = 100% TGC power- 175 yards
    3 iron - 91 MPH = 100% TGC power- 175 yards
    4 iron - 88 MPH = 100% TGC power- 170 yards
    5 iron - 85 MPH = 100% TGC power- 165 yards
    6 iron - 81 MPH = 100% TGC power- 158 yards
    7 iron - 79 MPH = 100% TGC power- 152 yards
    8 iron - 77 MPH = 100% TGC power- 132 yards
    9 iron - 75 MPH = 100% TGC power- 143 yards
    PW - 74 MPH = 100% TGC power- 125 yards
    Gap - 73 MPH = 100% TGC power- 110 yards
    SW - 72 MPH = 100% TGC power- 100 yards
    Lob - 71 MPH = 100% TGC power- 90 yards

    The distance(yards) refers to my own real life max distance at max swing speed, with carry (ball roll), which may not correspond with TGC distances. The Optishot software has the math down pretty well if you need more reference.

    Since other people will be able to swing faster than me, maybe you should use a slightly higher swing speed to achieve max power in TGC, this will also leave room for improvement.

    Hope this helps!
    Dave

    Comment


    • Zaren
      Zaren commented
      Editing a comment
      Yeah, that chart is quite different than the ones I found online. I'll have to do a little thinking on how to turn this into a range since this new chart is just a single speed and carry, but I'll work on getting an update out for this. Random question, were the distances good before this update? I thought I had "fixed" them some with that table I found, but if it was good before I can just revert that part of the code.

  • #35
    Hi Zaren,

    After practicing a bit more, I found something else that can be improved. Sorry, one thing at a time, but I thought I would mention it.

    Generally in real world golf, an inside/outside swing path will generate a draw/hook, while an outside/inside swing path will generate a fade/slice. It's a bit counter intuitive, but it has to do with the spin that is placed on the ball. Could it be possible to push this info into TGC?

    Currently I can't seem to apply these shot types. What seems to happen now is that it only changes the direction on the ball (in the wrong way).

    Thanks for looking into this stuff! I'm just trying to push it further towards a great simulator.

    Cheers,
    Dave

    Comment


    • Zaren
      Zaren commented
      Editing a comment
      Those are in there, at least sort of. I use the path and the club angle to alter the slope of the drawn line in TGC (which effects the side to side launch angle) and to apply a curve. If you take a very curved shot you should see the shot shape changed. The program should hold down the shift key and an arrow key to change the line. You can watch the line shift in the driving range. I tried to be more true to the new flight laws and let the face angle dominate controlling the direction the ball travels, and the path should set how much the "spin" or curve is adjusted. From my initial testing months ago it looked like Optishot used the old flight laws, where path sets the side to side launch angle, and the club head angle sets the spin/curve, so I didn't try to mimic the Optishot but instead tried to take my own stab at it. It sounds like my algorithm may be a little too subtle right now, but I know I've had shots noticeably hook and slice.

  • #36
    Hi Zaren,

    Yes, I believe the power level/distance were more accurate in the previous update.

    I like the sound of your flight laws, but they may be too subtle. I believe they felt more true in a previous version (if there was a previous version of this flight law that you made).

    Hope this helps.

    Thanks,
    Dave

    Comment


    • Zaren
      Zaren commented
      Editing a comment
      Alright, I went back to the power levels from the previous version and released a new version 1.5.1.

      As for the side angle/curve, I looked and it doesn't look like I've changed that code. The only change I made was a cap on how diagonal the line could be drawn in TGC as drawing it at too steep an angle would greatly reduce the power of the shot, or cause the shot to not be taken. That only effected really extreme values, so I don't think you're seeing the effects of those changes. I will say that in TGC when there's a curve on the ball it get's much more noticeable the further the ball travels, so possibly the issues causing carry distance to be undercalculated also cause ball flight paths to be too short to notice the effects of a fade/slice.

      Anyway, 1.5.1 should have the same shot algorithm you know and love, but with the added arcade mode and more maintainable code (which probably doesn't actually matter to you ).

  • #37
    Alright, Replishot V1.5.1 is here! I reverted the carry equations, as the new equation fit a data table I found, but after some discussions (thanks Dave!) on the form the data table appears to be incorrect (or very poorly labeled).

    Comment


    • #38
      Thanks for this Zaren! It's looking good!

      Overall it's great, but there still seems to be something off with the club path. If you have a slightly open face with a heavy inside outside path, the ball should still draw left. In this scenario, TGC sees an open face and seems to make it slice every time. I'd like to see TGC using more info from the club path. I'm not sure if this is adjustable, but food for thought. I believe you were tinkering with this already.

      Thanks again!
      Dave

      Comment


      • Zaren
        Zaren commented
        Editing a comment
        Two questions. Might I ask what your setup is? Are you running TGC2019 locally on the computer, or over remote control? I ask because to set a curved path on the ball you have to hold the shift key, and in my previous testing (with Steam remote play) the shift key doesn't pass through, but running TGC2019 locally everything works as expected.

        If we need to (and if you're willing) I could PM you a link to a debug version of Replishot. The debug version has the ability to write the USB sensor data out to a file, and then you can copy and paste the data from the file back in and rerun shots, so I could test out/fine tune specific aspects that aren't working properly.

        Thanks for all the feedback!

    • #39
      Hi Zaren,

      I'm running it locally on my windows 10 laptop (it's decently spec'd), and using my TV (1920x1080) as the only monitor (disabled laptop screen). I'm using a bluetooth mac keyboard, but I don't think this would affect the shift key.

      Yeah, please send me the debugged version, and I'll do my best to help out.

      Thanks!
      Dave (official tester haha)

      Comment


      • #40
        Version 1.5.2 is out! Fixed some shot shape issues per community feedback (thanks!).

        Made an update when in "Driving Range Mode" to press keys for a longer period to ensure they don't get missed. (Background: When in the TGC Driving range if you put curve on a shot it remains from shot to shot. To quickly reset to a straight shot you can switch to a different club and back (quick press of z then x). Sometimes one of those key presses got lost resulting in a shot being taken with the wrong club. Slowing it down seems to help.)

        Comment


        • #41
          Hey Zaren I am having issues with the lockstep feature. Fully suspect this is due to connection a projector as "second screen". Anything I can do to use my projector while still having the lockstep function work?

          Comment


          • NateShenner
            NateShenner commented
            Editing a comment
            I tested without second screen and same issues. I am also seeing same behaviour as above poster where dropdown on Replishot won't display and can only change clubs with up/down arrows.

          • Zaren
            Zaren commented
            Editing a comment
            Hey Nate, I assume you're on the latest version (1.5.2), otherwise you might not have the fix for the dropdown menu (or perhaps what I thought was the fix...). As for using 2 screens, if you mirror your display I think it should be fine, though I don't have 2 screens on my dev computer, so I haven't verified that. Also, the club reading is only working at 1920x1080 (which is also why 2 screens can break things, then you'd be at 3840x1080). The code is capturing the specific region of the screen where the club text appears, and the text moves around at other resolutions. I've been trying to find a good way to support multiple resolutions, but haven't found a good method other than building a complete data set per resolution, etc. If you tell me what resolution you're using I can try to build out a data set for it. Anyway, there are a lot of hard problems to solve to be able to arbitrarily read the correct portion of the screen for the club name at various resolutions.

          • NateShenner
            NateShenner commented
            Editing a comment
            Thanks man. I will look into version and resolution tomorrow. Appreciate it

        • #42
          Zaren First off thanks for this -- what a great way to enable optishot users to live with the big boys!

          I'm wondering if there's a dev version that maybe I can help debug an issue i'm running into. I'm having issues with the lockstop..

          1. I've isolated my display down to only the projector at 1920x1080 based on your other comments

          2. I can get the club to change when I use the sensors
          2b) The clubs aren't exactly matching .. so maybe this is an issue on my end with Optishot and TGC not have the same clubs, although I'm pretty positive they match - i will double check this

          3. I can't get TGC to change when i select a different club in Replishot .. and Replishot never changes when I "Z" "X" in TGC to change clubs. It seems weird to me that the sensors can change it but the interface in replishot itself doesn't, unless it's using different mechanisms?

          It sure seems like it's not reading it .. even though the resolution is what it needs to be, but i'd be more than happy to debug this on my own to help get it working.

          Thanks again!
          Last edited by ShaunGuido; 10-06-2022, 02:51 PM. Reason: added some more info

          Comment


          • #43
            found my issue .. even though the desktop was running the right resolution, TGC was running lower - doh.

            Comment


            • Zaren
              Zaren commented
              Editing a comment
              Oh yeah, that will do it! TGC doesn't change the desktop resolution either, so even if I tried to do a resolution check on the desktop it'd still report 1920x1080, and the game just scales it's render resolution to the desktop resolution. It all makes club recognition... rough.

          • #44
            Is there anything that can be done for putting? Gimmie range etc? Or is that not an option in the steam version? I’ve had to use arcade mode on 1.4 to get proper distance and putting is impossible.

            Comment


            • #45
              Zaren I find I need the arcade booster to get any real distance accuracy but per my point above it makes putting laughable — I’m wondering how possible it would be to set something in config for the +/- arcade for each club? So you could turn it off for putting .. boost 7 iron and lower 3w for example? vs having to change it all pre-shot

              Comment


              • Zaren
                Zaren commented
                Editing a comment
                That's a good point, arcade mode really shouldn't ever be applied to the putter. I can definitely make that change. It could be saved per club in the config file, that would be a much harder approach, but doable. I think I'd remove it from putting first and see how that goes.

              • Zaren
                Zaren commented
                Editing a comment
                Turns out on the latest release I accidentally removed arcade mode all together. It's added back in, and will NOT affect putting. Currently all other clubs will use the same multiplier. I will possibly add per-club multipliers down the road, but am still brainstorming ways to handle that.
            Working...
            X