sandermvanvliet / RoadCaptain

Build and ride custom routes in Zwift
Other
83 stars 4 forks source link

Three Little Sisters : Missed over 50% of turns! #98

Closed iilis closed 2 years ago

iilis commented 2 years ago

Running my homemade version of the Three Little Sisters (Rebel Route), the runner missed over 50% of the turns (probably around 70-80%). I thought it was going to be 100% but then started to pick correctly on a few (on the 7th or 8th turn).

Also, still had a little issue on the Volcano Climb. Did well going through at the bottom. But then during Volcano Climb (ascent), when going inside the Volcano on the flat part (about half way up), the runner thought I was on the Summit, then jumped to Volcano Climb (descent). Then, when I did go around the Summit and started the Volcano Climb (descent), the runner found me again and was okay.

Application details:

Additional info (GitHub doesn't like me attaching JSON files, so just added .txt extension.) RebelRoute-ThreeLittleSisters.json.txt roadcaptain-runner-log-2022-07-13T194248.log Log.txt

iilis commented 2 years ago

Was thinking about this issue... figure the cause of so many missed turns comes down to one of two things:

sandermvanvliet commented 2 years ago

I would suggest to rebuild the route using the latest version and trying that again.

I’m afraid I don’t have a lot of time the next few weeks because I’ve just become a dad so we need a little time to get settled here 👌

iilis commented 2 years ago

Will do; and will let you know the results. Congrats!

sandermvanvliet commented 2 years ago

I've rebuilt the route using my latest development version and the only real difference I see is a on one segment of the route: image but I doubt that this is the problem as you mentioned many more turns being missed. (Ignore the type part, that's for a new feature)

Looking at the logs I also don't see any unexpected turns error messages from RoadCaptain, I'll check to see if there is anything fishy going on there.

In the meantime I'm going to let the route run and see if it manages to follow it.

The 0.6.5.0 release does have changes in how RoadCaptain handles the turns so it may be I broke something there 🤷‍♀️

sandermvanvliet commented 2 years ago

Ok so it immediately loses route lock at the first turn... This is from RoadCaptain, you can see it does receive the turn commands and that it figures out the correct turn direction to send to Zwift as well as actually send it:

[14:25:36 INF] Moved to watopia-bambino-fondo-001-after-after-after-after-after-after (1)
[14:25:47 INF] Received commapnd type 1036
[14:26:40 INF] Moved to watopia-bambino-fondo-001-after-before (2)
[14:26:50 INF] Received commapnd type TurnLeft
[14:26:50 INF] Received commapnd type GoStraight
[14:27:04 INF] Game state changed from OnRouteState to UpcomingTurnState
[14:27:04 DBG] Transitioning from 'OnRouteState' to 'UpcomingTurnState'
[14:27:15 INF] Executing turn "GoStraight" onto watopia-bambino-fondo-002-before-before-before
[14:27:24 DBG] Sent 22 bytes, 0 sent so far of 22 total payload size

however Zwift seems to ignore it 😐

Updated Zwift before testing it so it might have something to do with that or perhaps #91 has some effects already.

sandermvanvliet commented 2 years ago

Interestingly, when I use the Zwift Companion app I don't seem to be able to send any command to the game. U-turn or the left/right/go-straight options don't seem to work at all.

And this is with Zwift Companion 3.37.0 (1258) and Zwift 1.27.0 (101324)

PhilipAmos commented 2 years ago

Apparently, Zwift did enable encryption in this week's update and it has broken other 3rd part apps as well.

It doesn't surprise me that they have also broken their own Companion app.

sandermvanvliet commented 2 years ago

Turn commands are super flaky, sometimes it doesn't work at all, other times you can select 1 turn and not change it, yet another time I can change multiple times before I hit the actual turn.

The encryption part has a backwards compatibility mode so for older clients it still works (for a while, see the comments in #91)

Currently I'm working on seeing how to interact with Zwift in the new way, stand by...

sandermvanvliet commented 2 years ago

Created a topic on the Zwift forums as well: https://forums.zwift.com/t/turn-commands-flaky-when-using-zwift-companion/586977

oldnapalm commented 2 years ago

Currently I'm working on seeing how to interact with Zwift in the new way, stand by...

This might help if you are still looking https://github.com/zoffline/zwift-offline/pull/191

This issue doesn't seem to be related to encryption though.

sandermvanvliet commented 2 years ago

I should've looked around more, just finished most of the reverse engineering for the encrypted stream...

sandermvanvliet commented 2 years ago

Encrypted connections now work: image

sandermvanvliet commented 2 years ago

Your PR actually made me find a bug in the client -> game connection so thanks for that :+1:

sandermvanvliet commented 2 years ago

Found some additional info in the Zwift log file:

[14:30:48] Manual Selection Branch - Direction STRAIGHT at Marker 0 on Road 0 

[14:30:54] Route decision completed!

[14:30:54] Actual Intersection Marker Id: 0, Route Intersection Marker Id: 0, Route:   Big Loop, Current Lap: 0, Route Complete Distance: 4260380.0000, Intersection Index: 0, Check Point Index: 1

[14:30:54] Route Decision State: OFF ROUTE, Script Turning Direction: LEFT (1), Actual Turning Direction: STRAIGHT (3), Script Moving Direction: FORWARD, Actual Moving Direction: FORWARD

[14:30:54] Allow U-turn: YES, Force Follow: NO

[14:30:54] Route Decision: Staying on same road

So Zwift did receive the command that RoadCaptain sent it but it chooses to then ignore it and staying on the same road as the last log entry indicates.

Corresponding RoadCaptain logs:

2022-07-24 14:30:40.446 +02:00 [DBG] Received command type TurnLeft
2022-07-24 14:30:40.457 +02:00 [DBG] Received command type GoStraight
2022-07-24 14:30:40.463 +02:00 [INF] Game state changed from OnRouteState to UpcomingTurnState
2022-07-24 14:30:40.467 +02:00 [DBG] Transitioning from 'OnRouteState' to 'UpcomingTurnState'
2022-07-24 14:30:40.472 +02:00 [INF] Executing turn "GoStraight" onto watopia-bambino-fondo-002-before-before-before
2022-07-24 14:30:40.477 +02:00 [DBG] Sent 27 bytes, 27 sent so far of 27 total payload size
sandermvanvliet commented 2 years ago

Based on the suggestion of @juanplopes here I've implemented the Zwift Konami Code (174f5df3f350fb090af9a44a54125b9b6e510c41) which seems to do the trick and makes go-straight turns work again.

Release 0.6.7.0 is currently building and should be out soon.

juanplopes commented 2 years ago

Zwift Konami Code

😂 🤣

sandermvanvliet commented 2 years ago

@iilis for shits and giggles I’ll run the full route tomorrow just to make sure it all actually works

iilis commented 2 years ago

Great, thanks! I’m curious how you do during the Volcano climb. Still had issues where the runner lost where I was on the ascent (as I noted in my original post).

dashed commented 2 years ago

@sandermvanvliet I'd love to test 0.6.7.0 out. But there is currently no macOS release :(.

sandermvanvliet commented 2 years ago

@dashed it seems the signing process is broken, I'm still investigating why it doesn't work but right now it hangs in a time-out somewhere...

iilis commented 2 years ago

@sandermvanvliet Did you ride the Three Little Sisters route this weekend? How did it go?

drocx commented 2 years ago

A new Zwift Update is available:

sandermvanvliet commented 2 years ago

@iilis sorry, life happened and I haven’t been able to work on RoadCaptain for a bit. Will keep you updated once I get around to it.

sandermvanvliet commented 2 years ago

A new Zwift Update is available:

  • Fixed an issue where some intersection buttons would not respond in Zwift Companion

The fix I’ve applied in 0.6.7.0 is compatible with this so fortunately I don’t have to specifically roll another release.

iilis commented 2 years ago

Seems this issue (missing a lot of the turns) is mostly taken care of with the new version (0.6.7). Still have a routing issue on the Volcano Climb, which I created a New Issue for ( #101 ). Thanks!