-
Notifications
You must be signed in to change notification settings - Fork 81
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
Feature/role preference options #1142
Feature/role preference options #1142
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice contribution thank you. I also like the way you named your variables. I'm hesitating a bit because of the convars though
|
||
--- | ||
-- @realm server | ||
ttt2_roles_trickle_down_odds = CreateConVar("ttt2_roles_trickle_down_odds", "3", {FCVAR_NOTIFY, FCVAR_ARCHIVE}, "The 1/N odds of a player receiving a role and not being passed up."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also not 100% sure we need this. If you add this, you have to explain in detail in the UI how changing this convar affects the selection. Because I think it is hard to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I don't even like having the math.random call in there -- I think the shuffle is doing all the work the RNG really needs to do to consider things.
Should we just only focus on conditions that prevent the role from being selected and pass true by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's hard to make a call on as I never worked on the roleselection. Maybe @saibotk has more insight into this. Or @ZenBre4ker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The system is broken in a way anyway. As @saibotk mentioned in another PR, I wouldnt give so many options. I would either always allow or forbid avoiding roles alltogether. I dont like that system anyway, so I would suggest to remove role avoiding alltogether.
About the random call, I believe they tried to make it more random as in the past often the same players in a row got the same role over and over again.
And the trickle system I need to take a look again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel the same way, all this role avoidance stuff is rarely used by players and should rather be something a server owner decides upon. This just adds unnecessary complexity and confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah checked again, I would just set the tricklerate as before to 3 and check if it is 2, so 1/3 chance, that role gets assigned without the other conditions.
I also have to run the TTT2LanguageParser on this one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You definitely revived the dead code 😄
But I believe, that you implemented SelectBaseRolePlayers wrongly. Removing the random aspect and the while loop means, that this pass could be false for many players.
I am unsure about the consequences, but it does not have the same behaviour as before, if I am not wrong.
Also in my opinion please dont insert two more convars. The trickle rate is just there to randomize the other states.
for j = 1, #plysSecondPass do | ||
local ply = plysSecondPass[j] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should stay as "i". I dont see where this would be a problem.
|
||
--- | ||
-- @realm server | ||
ttt2_roles_trickle_down_odds = CreateConVar("ttt2_roles_trickle_down_odds", "3", {FCVAR_NOTIFY, FCVAR_ARCHIVE}, "The 1/N odds of a player receiving a role and not being passed up."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah checked again, I would just set the tricklerate as before to 3 and check if it is 2, so 1/3 chance, that role gets assigned without the other conditions.
local minKarmaCVar = GetConVar("ttt_" .. roles.GetByIndex(subrole).name .. "_karma_min") | ||
local min_karmas = minKarmaCVar and minKarmaCVar:GetInt() or 0 | ||
|
||
while curRoles < roleAmount and #plys > 0 do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesnt removing this while loop here means, that players might not get a role in this pass?
As far as I can see, the "CanSelectRole" method can most often just return false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also unsure about what this change implies for the selection process further down.
We need to think of the assumptions, that were made for what this function does codewise.
It always tries to assign players to the given subrole until roleAmount of players received the role.
This is now not the case anymore and we need to check if that is assumed to happen here and if other functionality relies on that to happen etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(After requested Review)
Isnt this still having the same problem here?
Exchanging the while loop with a for loop seems like different behaviour?
965dd50
to
5ca661c
Compare
I see you worked again on this PR. We discussed this one as well las sunday and we had the uniform opinion, that the trickle down convar should be removed. It might be a good idea to move it to a library variagble though. Something like @ZenBre4ker Wasn't sure if you broke any of the roleselection logic, so he has to confirm your changes. Last but not least we'd like to let you know that we tend to remove the role avoidance completely as it doesn't work that well anyway. Most players seem really confused by it. |
is the intention to have this commit remove the role avoidance settings instead? or will that be later? |
Later. If you want to add to the role avoidance that is fine. Just be aware that it will probably be removed at some point |
eefe340
to
f5d7a83
Compare
@@ -16,6 +16,7 @@ roleselection.finalRoles = {} | |||
roleselection.selectableRoles = nil | |||
roleselection.baseroleLayers = {} | |||
roleselection.subroleLayers = {} | |||
roleselection.trickleDownRate = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still can have a sane default, as it was there before too with the random(3) == 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still 0, should be at least 3.
local minKarmaCVar = GetConVar("ttt_" .. roles.GetByIndex(subrole).name .. "_karma_min") | ||
local min_karmas = minKarmaCVar and minKarmaCVar:GetInt() or 0 | ||
|
||
while curRoles < roleAmount and #plys > 0 do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also unsure about what this change implies for the selection process further down.
We need to think of the assumptions, that were made for what this function does codewise.
It always tries to assign players to the given subrole until roleAmount of players received the role.
This is now not the case anymore and we need to check if that is assumed to happen here and if other functionality relies on that to happen etc.
f5d7a83
to
a9ac53f
Compare
5c71b7b
to
aa6e29a
Compare
aa6e29a
to
c0a4b86
Compare
c0a4b86
to
5e549e3
Compare
local minKarmaCVar = GetConVar("ttt_" .. roles.GetByIndex(subrole).name .. "_karma_min") | ||
local min_karmas = minKarmaCVar and minKarmaCVar:GetInt() or 0 | ||
|
||
while curRoles < roleAmount and #plys > 0 do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(After requested Review)
Isnt this still having the same problem here?
Exchanging the while loop with a for loop seems like different behaviour?
@@ -16,6 +16,7 @@ roleselection.finalRoles = {} | |||
roleselection.selectableRoles = nil | |||
roleselection.baseroleLayers = {} | |||
roleselection.subroleLayers = {} | |||
roleselection.trickleDownRate = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still 0, should be at least 3.
while plysAmount > 0 and availableRolesAmount > 0 do | ||
local pick = math.random(plysAmount) | ||
local ply = plys[pick] | ||
for i = #newPlys, 1, -1 do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The for loop here also has the wrong behaviour. It only goes through every player once. But it could be that some players are not assigned.
CHANGELOG.md
Outdated
@@ -108,6 +108,10 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel | |||
- Moved reset buttons onto the left (by @a7f3) | |||
- Added ammo icons to the weapon switch HUD and player status HUD elements (by @EntranceJew) | |||
- Changed the disguiser icon to be more fitting (by @TimGoll) | |||
- Role selection RNG improvements (by @EntranceJew): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in my opinion there are no RNG improvements, as you said in this PR, it generally only "made dead code not dead"
… into feature/role-preference-options
# Conflicts: # CHANGELOG.md
made dead code not dead