Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ranking): Add RankingModes constants for GetRanking.rankingMode #79

Merged
merged 3 commits into from
Feb 1, 2025

Conversation

ashquarky
Copy link
Member

Part of PretendoNetwork/nex-protocols-common-go#34

Changes:

Add RankingModes enum for the different GetRanking request modes. This allows downstreams like nex-protocols-common-go to implement things like Friends and Nearby leaderboards.

ranking/get_ranking.go Outdated Show resolved Hide resolved
ranking/get_ranking.go Outdated Show resolved Hide resolved
@ashquarky
Copy link
Member Author

Rebased onto latest and added more of the enums used by Ranking - RankingChangeAttributesParam.ModificationFlag; RankingMode as before; RankingScoreData.OrderBy; RankingOrderParam.OrderCalculation and RankingScoreData.UpdateMode.

Based on the match-making/constants folder.

@ashquarky
Copy link
Member Author

I'm not sure if I should also change the types in the structs that use the enums - this feels a little invasive and likely to break downstreams, so best to use a light touch here.

Copy link
Member

@jonbarrow jonbarrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We know the real names of these values now, via https://github.com/tech-ticks/RTDXTools/blob/232a7797e01369e9c12704f58fdde65dd3ac1c32/Assets/Scripts/Stubs/Generated/Assembly-CSharp/NexPlugin/Ranking.cs

Also maybe we should just add all the ranking constants while we're here?

ranking/constants/ranking_change_attribute_flag.go Outdated Show resolved Hide resolved
Comment on lines 3 to 5
// RankingChangeAttributeFlag is used by RankingChangeAttributesParam.ModificationFlag to set which fields should be
// updated.
type RankingChangeAttributeFlag uint8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this just be named ModificationFlag?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we need to keep the Ranking prefix since it's in the global namespace?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the part after the prefix. Though it being in this package is a good point. @DaniElectra what say you? If we remove the prefixes here we'd want to do it everywhere too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good to me. I don't think the prefix is used anywhere else though?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checked, you're right I can't find anywhere that we use the prefix currently. So it should be dropped here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm drafting this, but am a little concerned about a type named OrderBy (currently RankingOrderBy) in the global namespace. The existing matchmaking ones are more uniquely named (PersistentGatheringType) - I guess with the exception of SelectionMethod?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That shouldn't be an issue, since the import already tells that these are Ranking constants:

import (
	ranking_constants "github.com/PretendoNetwork/nex-protocols-go/v2/ranking/constants"
)

ranking_constants.OrderByAscending

Also, this isn't a global namespace, the declarations are contained within the ranking/constants directory so there wouldn't be any collisions with external names

ranking/constants/ranking_modes.go Outdated Show resolved Hide resolved
ranking/constants/ranking_order.go Outdated Show resolved Hide resolved
ranking/constants/ranking_update_mode.go Outdated Show resolved Hide resolved
ranking/constants/ranking_order_calculation.go Outdated Show resolved Hide resolved
ranking/constants/ranking_modes.go Outdated Show resolved Hide resolved
Based on Jon's old notes and additional research
@ashquarky
Copy link
Member Author

Enums are ready for another look, happy to do a quick commit if we decide to drop the Ranking prefix

Except RankingMode because that one would be stupid
@ashquarky
Copy link
Member Author

Added as an extra commit for revertability in case of OrderBy being a problem

@ashquarky
Copy link
Member Author

In that case I think this is ready to merge

@ashquarky ashquarky merged commit 261c707 into PretendoNetwork:master Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants