kaiusl / KLPlugins.DynLeaderboards

ACC leaderboard plugin for SimHub
https://kaiusl.github.io/KLPlugins.DynLeaderboards/
MIT License
13 stars 1 forks source link

Gaps on track #10

Closed Mtrade closed 1 year ago

Mtrade commented 1 year ago

Hi again,

Using the Gap.ToFocused.OnTrack property to calculate the gap ahead/behind myself, I notice the result will include cars in the pitlane. Would it be possible to exclude cars in the pitlane with this property or am I overlooking another property that will achieve this?

Simhub has a built in quick component (Opponent gap) that will allow to select a gap "Leaderboard Position Relative to Player on Track" that can solve this but the internal gap calculation is not stable like you have corrected nicely in your plugin.

I have tried setting Simhub's gap computation mode to "game" or "Simhub" but the results are the same.

(BTW thanks for the additional valid.lap properties, they work great!)

kaiusl commented 1 year ago

Currently there is no prebuilt way to exclude all the cars in the pits. I believe a javascript extension to filter out the cars in the pits is possible.

But why do you even want to exclude the cars in the pitlane?

Mtrade commented 1 year ago

Excluding pitlane cars is sometimes useful when viewing car(s) ahead and behind while on track, without having opponents and gap data randomly change as you pass cars in the pitlane in a qualy or race setting. This is even more apparent when driving on a track with long pitlanes like Spa for example.

In addition, it's a nice to see actual time data while you are in the pits yourself compared to cars on track if you want to see what gaps you might have on exit or to time your exit to avoid traffic.

kaiusl commented 1 year ago

Ok, I can see how that can be useful. I'm up for adding support for it.

We can add new leaderboard type, which is like RelativeOnTrack but without any cars that are in the pitlane, except the focused car. Would that work?

serek4 commented 1 year ago

It would be nice to have option to hide cars in pit lane only if they lap down (or more).

Mtrade commented 1 year ago

Ok, I can see how that can be useful. I'm up for adding support for it.

We can add new leaderboard type, which is like RelativeOnTrack but without any cars that are in the pitlane, except the focused car. Would that work?

Ok thanks, I guess that would work, I assume there would be a new property created? Or I could use the same property (i.e. gap.tofocused.ontrack) just applied differently to exclude pitlane cars within that leaderboard type?

It would be nice to have option to hide cars in pit lane only if they lap down (or more).

I think if this was added you could then make the result conditional on the other property "RelativeOnTrackLapDiff" == -1.

kaiusl commented 1 year ago

Ok thanks, I guess that would work, I assume there would be a new property created? Or I could use the same property (i.e. gap.tofocused.ontrack) just applied differently to exclude pitlane cars within that leaderboard type?

It would be the same property but you'll need to switch to new leaderboard type.

The properties are effectively always the same (except few ..Dynamic... properties, which change based on the leaderboard type) and then the leaderboard type decides which cars are shown.

It would be nice to have option to hide cars in pit lane only if they lap down (or more).

I think if this was added you could then make the result conditional on the other property "RelativeOnTrackLapDiff" == -1.

I was thinking about this option myself too and I think it's the way to go. In the qualy/practice they would be equivalent and in the race I would definitely like to know about the cars in the pits but on the same lap. However, is there still a reason why hiding all the cars in the pitlane in a race would be useful too? Only thing I can think of is the case of when exiting the pitlane and you want to know where you are about to exit relative to on track traffic, and there are a lot of other cars in the pit at the same time. In the most cases I think I would still care about the cars in the pit too.

Mtrade commented 1 year ago

Ok thanks, I guess that would work, I assume there would be a new property created? Or I could use the same property (i.e. gap.tofocused.ontrack) just applied differently to exclude pitlane cars within that leaderboard type?

It would be the same property but you'll need to switch to new leaderboard type.

The properties are effectively always the same (except few ..Dynamic... properties, which change based on the leaderboard type) and then the leaderboard type decides which cars are shown.

Ok, sounds good!

I was thinking about this option myself too and I think it's the way to go. In the qualy/practice they would be equivalent and in the race I would definitely like to know about the cars in the pits but on the same lap. However, is there still a reason why hiding all the cars in the pitlane in a race would be useful too? Only thing I can think of is the case of when exiting the pitlane and you want to know where you are about to exit relative to on track traffic, and there are a lot of other cars in the pit at the same time. In the most cases I think I would still care about the cars in the pit too.

Yes, I would agree with all of this. It can probably be toggled if someone wanted in a specific case, while they are in the pitlane, to have info on their gap relative to cars only on track by utilizing a condition to switch to "gap to on track cars only" based on if "IsInPitLane" == 1, for example.

Mtrade commented 1 year ago

I was just thinking, if we agree on the following:

The new javascript extension you would write would need to cover both of these specific conditions, right? Otherwise in a race situation I'm not sure how we could neatly write code to account for the gap ahead if there are 2 or more cars in the pits on different lap numbers.

kaiusl commented 1 year ago

.. It can probably be toggled if someone wanted in a specific case, while they are in the pitlane, to have info on their gap relative to cars only on track by utilizing a condition to switch to "gap to on track cars only" based on if "IsInPitLane" == 1, for example.

Not really, we would need to add a new action on the plugin side for this switch, like the leaderboard type switch works, but in that case it would be better to just add both leaderboard types instead.

I was just thinking, if we agree on the following:

  • During practice/qualy have a leaderboard type to filter out all cars in pits (except for focused) from gaps
  • During race, same leaderboard type will filter cars out all cars in pits except those on the same lap

Yes

The new javascript extension you would write would need to cover both of these specific conditions, right? Otherwise in a race situation I'm not sure how we could neatly write code to account for the gap ahead if there are 2 or more cars in the pits on different lap numbers.

Javascript extension wouldn't really work here actually, so it will be an addition to the plugin. But yes we need to cover them separately in code but in the end all the end user should need to do is select the new leaderboard type when they want to only see the cars on the track and it should just work. Plugin will do the filtering and only show the wanted cars.

Mtrade commented 1 year ago

.. It can probably be toggled if someone wanted in a specific case, while they are in the pitlane, to have info on their gap relative to cars only on track by utilizing a condition to switch to "gap to on track cars only" based on if "IsInPitLane" == 1, for example.

Not really, we would need to add a new action on the plugin side for this switch, like the leaderboard type switch works, but in that case it would be better to just add both leaderboard types instead.

Ok, I see.

I was just thinking, if we agree on the following:

  • During practice/qualy have a leaderboard type to filter out all cars in pits (except for focused) from gaps
  • During race, same leaderboard type will filter cars out all cars in pits except those on the same lap

Yes

The new javascript extension you would write would need to cover both of these specific conditions, right? Otherwise in a race situation I'm not sure how we could neatly write code to account for the gap ahead if there are 2 or more cars in the pits on different lap numbers.

Javascript extension wouldn't really work here actually, so it will be an addition to the plugin. But yes we need to cover them separately in code but in the end all the end user should need to do is select the new leaderboard type when they want to only see the cars on the track and it should just work. Plugin will do the filtering and only show the wanted cars.

Yes, sounds good. Thanks

kaiusl commented 1 year ago

I uploaded a new prerelease 1.2.2_beta1 with new leaderboard RelativeOnTrackWoPit.

@Mtrade @serek4 Could you give it a quick try and see if it works as expected? You need to enable it for the existing configurations in the settings under "Leaderboard rotation" section.

Mtrade commented 1 year ago

I did some limited testing in a practice/qualy session and so far it seems to work as intended, filtering out all cars in the pits.

Will continue to test that as well as the behaviour in a race session.

Thanks!

Mtrade commented 1 year ago

Did more testing in various scenarios in all session types and the behaviour is exactly as expected. I.E. all cars filtered out in practice/qualy, and cars not on the same lap in race filtered out. This is a great addition, thanks so much for adding.

Just out of curiosity (rather than starting another thread again), do you have a discord group to discuss anything related to the plugin or is github the best place for this?

And are there any plans to port the plugin to other sims?

Thanks again for all the added functionality.

kaiusl commented 1 year ago

Thank you for testing. I'll post the final update soon.

Just out of curiosity (rather than starting another thread again), do you have a discord group to discuss anything related to the plugin or is github the best place for this?

There is no discord group. Github or Racedepartment's forum are the places for discussion at the moment.

And are there any plans to port the plugin to other sims?

Not really. I don't really play other sims (actually haven't even played ACC since summer) and so most likely there will not be support for other sims.

kaiusl commented 1 year ago

Released in 1.2.2 🎉

Mtrade commented 1 year ago

Thank you for testing. I'll post the final update soon.

Just out of curiosity (rather than starting another thread again), do you have a discord group to discuss anything related to the plugin or is github the best place for this?

There is no discord group. Github or Racedepartment's forum are the places for discussion at the moment.

And are there any plans to port the plugin to other sims?

Not really. I don't really play other sims (actually haven't even played ACC since summer) and so most likely there will not be support for other sims.

Ok then, thank you again!