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

Add ability to view and give accolades via website #554

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

jauggy
Copy link
Member

@jauggy jauggy commented Jan 9, 2025

Feature

This allows players to gift accolades via the match page to any player. And view your own.
You can gift 20 accolades in a 30 day window. This is configurable by the admin.

The types of accolades you can give are set by the admin. This feature to add accolades was already added in the past.

Screenshot 2025-01-09 at 2 57 22 pm

Screenshot 2025-01-09 at 2 58 02 pm

Screenshot 2025-01-09 at 3 04 21 pm

Adding accolade types

These should already exist in prod. If you want to add them on localhost, go to Admin> Badge Types

Gifting an accolade

Just go to a match and the accolade button is next to the report button.

@jauggy
Copy link
Member Author

jauggy commented Jan 9, 2025

@L-e-x-o-n if you have spare time can you put this on integration server? I've tested locally and it works but want to see how looks with the accolades already set up.

@jauggy jauggy force-pushed the jauggy/accolades branch 2 times, most recently from fd8d472 to e535cc9 Compare January 9, 2025 08:30
@jauggy jauggy marked this pull request as ready for review January 12, 2025 15:40
@L-e-x-o-n
Copy link
Collaborator

@L-e-x-o-n if you have spare time can you put this on integration server? I've tested locally and it works but want to see how looks with the accolades already set up.

Sorry for the delay, deployed.

@L-e-x-o-n
Copy link
Collaborator

Appears to be working. I am just thinking about the feature that lets you see who gave you and other users an accolade, while interesting to know I am not sure if it would be better if they were anonymous. The previous system chose a random target, this one allows you to select anyone which creates possibilities for potential accolade farming, friends playing custom 1v1s and giving themselves accolades...

@jauggy
Copy link
Member Author

jauggy commented Jan 13, 2025

The purpose of Accolades is to reduce toxicity in public matches by reward positive behaviour. It's important for players to know what behaviour they're being rewarded for so they are encouraged to do it more often. For example, say someone helps me out in a game when they didn't need to - I could give them teamwork accolade. Afterwards, since they know it was from me, they will also know they received it for helping me specifically. Then they will try and help others in future games.

Farming accolades from friends is like asking your mum to give you compliments. It has no value. I've added a summary so that people can also see the number of unique users who have given you accolades. Someone who is genuinely receiving them would have a high unique count.

Screenshot 2025-01-13 110353

If someone is only playing private games, they don't really need accolades. The purpose of this is to improve the friendliness of public matches. Private matches amongst friends are already non-toxic.

@jauggy
Copy link
Member Author

jauggy commented Jan 13, 2025

@L-e-x-o-n I just checked on your profile and it gives me an internal server error. Any logs?

Actually just viewing my own past matches doesn't seem to work. Are you updating something?

Same with Amojini: https://server5.beyondallreason.info/profile/21114/accolades

@L-e-x-o-n
Copy link
Collaborator

@L-e-x-o-n I just checked on your profile and it gives me an internal server error. Any logs?

Actually just viewing my own past matches doesn't seem to work. Are you updating something?

Same with Amojini: https://server5.beyondallreason.info/profile/21114/accolades

I haven't changed anything.
Log for accolades:

** (exit) an exception was raised:
    ** (ArgumentError) cannot convert nil to param
        (phoenix 1.7.14) lib/phoenix/param.ex:71: Phoenix.Param.Atom.to_param/1
        (phoenix 1.7.14) lib/phoenix/verified_routes.ex:594: Phoenix.VerifiedRoutes.encode_segment/1
        (teiserver 0.1.0) lib/teiserver_web/live/account/profile/accolades.html.heex:35: anonymous fn/2 in TeiserverWeb.Account.ProfileLive.Accolades.render/1
        (elixir 1.16.3) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
        (teiserver 0.1.0) lib/teiserver_web/live/account/profile/accolades.html.heex:24: anonymous fn/2 in TeiserverWeb.Account.ProfileLive.Accolades.render/1
        (phoenix_live_view 0.19.3) lib/phoenix_live_view/diff.ex:386: Phoenix.LiveView.Diff.traverse/7
        (phoenix_live_view 0.19.3) lib/phoenix_live_view/diff.ex:538: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/7
        (elixir 1.16.3) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3

and for matches:

 ** (KeyError) key :value not found in: nil

If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map
        (teiserver 0.1.0) lib/teiserver_web/live/battles/match/show.ex:98: anonymous fn/2 in TeiserverWeb.Battle.MatchLive.Show.get_match/1
        (elixir 1.16.3) lib/enum.ex:3342: anonymous fn/2 in Enum.sort_by/3
        (elixir 1.16.3) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
        (elixir 1.16.3) lib/enum.ex:3342: Enum.sort_by/3
        (teiserver 0.1.0) lib/teiserver_web/live/battles/match/show.ex:98: TeiserverWeb.Battle.MatchLive.Show.get_match/1
        (teiserver 0.1.0) lib/teiserver_web/live/battles/match/show.ex:29: TeiserverWeb.Battle.MatchLive.Show.handle_params/3
        (phoenix_live_view 0.19.3) lib/phoenix_live_view/utils.ex:462: anonymous fn/5 in Phoenix.LiveView.Utils.call_handle_params!/5

@L-e-x-o-n
Copy link
Collaborator

The purpose of Accolades is to reduce toxicity in public matches by reward positive behaviour. It's important for players to know what behaviour they're being rewarded for so they are encouraged to do it more often. For example, say someone helps me out in a game when they didn't need to - I could give them teamwork accolade. Afterwards, since they know it was from me, they will also know they received it for helping me specifically. Then they will try and help others in future games.

Farming accolades from friends is like asking your mum to give you compliments. It has no value. I've added a summary so that people can also see the number of unique users who have given you accolades. Someone who is genuinely receiving them would have a high unique count.

Screenshot 2025-01-13 110353

If someone is only playing private games, they don't really need accolades. The purpose of this is to improve the friendliness of public matches. Private matches amongst friends are already non-toxic.

I understand the idea but don't think such a reward will do much, it's not really noticeable, hard to find unless you are looking for it, people most likely won't even know it exists. As for the visibility of the sender, it might encourage reciprocal rewarding the people that give you the accolade, probably not an issue for now. Maybe it would be nice to see who has given you accolades but not the givers of accolades of another person, for privacy reasons. These observations are mainly from my experience with other games, they usually have some kind of reward for getting enough of these accolade equivalents and they have a way to display it publicly for all to see.

@L-e-x-o-n
Copy link
Collaborator

L-e-x-o-n commented Jan 13, 2025

A bigger issue is the possibility of giving enemies "Good teammate" accolade, I think giving accolades to enemies is fine but maybe the options should depend on the team they are in, there could be a "worthy opponent" accolade for example.

I also noticed you can give accolades for matches you haven't even played in, this seems like a bug.

@jauggy
Copy link
Member Author

jauggy commented Jan 13, 2025

Accolades are the counterpoint to reporting. And you can report players for matches you aren't in. Example would be on Twitch I saw that match where you used skuttles to kill bases of two players. I could give you the Strategist award for that even though I wasn't in the match.

I agree that good teammate should be restricted to teammate only. I can make that enhancement in a future PR as this one has enough complexity.

But yeah if we restrict to only teammates for all accolades that might be easier from a coding point of view. I'll have to investigate later.

@jauggy
Copy link
Member Author

jauggy commented Jan 13, 2025

@L-e-x-o-n I've fixed the errors that have caused the crashes. Can you put on integration again? Thanks.

@L-e-x-o-n
Copy link
Collaborator

@L-e-x-o-n I've fixed the errors that have caused the crashes. Can you put on integration again? Thanks.

Done

@L-e-x-o-n
Copy link
Collaborator

Accolades are the counterpoint to reporting. And you can report players for matches you aren't in. Example would be on Twitch I saw that match where you used skuttles to kill bases of two players. I could give you the Strategist award for that even though I wasn't in the match.

I agree that good teammate should be restricted to teammate only. I can make that enhancement in a future PR as this one has enough complexity.

But yeah if we restrict to only teammates for all accolades that might be easier from a coding point of view. I'll have to investigate later.

Farming accolades from friends is like asking your mum to give you compliments. It has no value. I've added a summary so that people can also see the number of unique users who have given you accolades. Someone who is genuinely receiving them would have a high unique count.

Accolades without any rewards are already bit useless and without much value, they don't do or give anything and are hard to see. The issue is that as soon as there is a reward of some kind people will try to farm it by whatever means available.
This includes giving them to friends every match, even for matches you haven't participated in. This IMO reduces whatever value achieving accolades fairly has.

The purpose of Accolades is to reduce toxicity in public matches by reward positive behaviour. It's important for players to know what behaviour they're being rewarded for so they are encouraged to do it more often.

Why would anyone care about this if they could get a few of their friends/clanmates and give each other accolades, you would get more in a minute than anyone could get by playing matches and hoping their allies give them. You are rewarding this behaviour more than what happens in game.

@L-e-x-o-n
Copy link
Collaborator

L-e-x-o-n commented Jan 13, 2025

I think it might be a good idea to start a Discord thread on this topic to collect some additional feedback and suggestions, what do you think?

Should the list of available accolades be modified, some new added, some old ones removed (being able to give good teammate to enemy team feels like a bug and I would prefer to remove it completely than leave it in it's current state)?

@jauggy
Copy link
Member Author

jauggy commented Jan 13, 2025

@jauggy
Copy link
Member Author

jauggy commented Jan 13, 2025

Amojini's is now working: https://server5.beyondallreason.info/profile/21114/accolades
Raghna working: https://server5.beyondallreason.info/profile/694/accolades

But yours is not. Any logs?

I wonder if you have an accolade that no longer exists?

@L-e-x-o-n
Copy link
Collaborator

Amojini's is now working: https://server5.beyondallreason.info/profile/21114/accolades Raghna working: https://server5.beyondallreason.info/profile/694/accolades

But yours is not. Any logs?

I wonder if you have an accolade that no longer exists?

** (exit) an exception was raised:
    ** (KeyError) key :colour not found in: nil

If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map
        (teiserver 0.1.0) lib/teiserver_web/live/account/profile/accolades.html.heex:26: anonymous fn/2 in TeiserverWeb.Account.ProfileLive.Accolades.render/1
        (elixir 1.16.3) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
        (elixir 1.16.3) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
        (teiserver 0.1.0) lib/teiserver_web/live/account/profile/accolades.html.heex:24: anonymous fn/2 in TeiserverWeb.Account.ProfileLive.Accolades.render/1
        (phoenix_live_view 0.19.3) lib/phoenix_live_view/diff.ex:386: Phoenix.LiveView.Diff.traverse/7
        (phoenix_live_view 0.19.3) lib/phoenix_live_view/diff.ex:538: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/7
        (elixir 1.16.3) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
        (phoenix_live_view 0.19.3) lib/phoenix_live_view/diff.ex:384: Phoenix.LiveView.Diff.traverse/7
        ```

@jauggy
Copy link
Member Author

jauggy commented Jan 13, 2025

Thanks Lexon. That tells me what's wrong. I'll take a look. Seems like some people have an accolade that no longer exists.

@jauggy
Copy link
Member Author

jauggy commented Jan 13, 2025

@L-e-x-o-n can you run this query on integration server:

select * from teiserver_account_accolades taa 
where taa.badge_type_id  not in (select id from teiserver_account_badge_types tabt)

This will check if there is anyone who has an accolade that has since been deleted.

I don't need to know the result, just if it returns more than 0 rows.

@jauggy
Copy link
Member Author

jauggy commented Jan 13, 2025

@L-e-x-o-n I fixed the bug. It was because some people have an accolade without a badge_type. Not even sure how that is possible.

When you have spare time can you redeploy to integration.

@L-e-x-o-n
Copy link
Collaborator

Done

@jauggy
Copy link
Member Author

jauggy commented Jan 15, 2025

@L-e-x-o-n when you have time can you place the latest of this PR on integration. I have improved the workflow based on Pandaro feedback. Also now limited Accolade to your team only.

If we want some accolades to be for anyone and some accolades for team-only that would require a new column in db. Could be revisited in the future.

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.

2 participants