Skip to content

Guide: Complete the Roles and Equipment pages - #1831

Open
ROODAY wants to merge 6 commits into
TTT-2:masterfrom
ROODAY:add-roles-guide-new
Open

ROODAY wants to merge 6 commits into
TTT-2:masterfrom
ROODAY:add-roles-guide-new

Conversation

@ROODAY

@ROODAY ROODAY commented Aug 12, 2025 •

Copy link
Copy Markdown

Completes the Roles and Equipment pages in the help menu's Guide section. Both pages are read-only and show what is actually available on the server, so new players can look up what exists in a round.

Roles

  • Lists all roles that can be part of the game, with their icon and a badge for built-in roles.
  • Shows a role's name, team, description, whether it is built-in and, for subroles, which role they are based on.
  • Roles that are disabled in the role settings are hidden. Role settings are server convars that are not readable by non-admin clients, so this adds a small server request (roles.RequestEnabledRoles) that returns the indices of all roles that are part of the game. Roles that are not distributable are always listed, since they can still be handed out during a round (e.g. revival or sidekick roles).
  • Descriptions use the same ttt2_desc_<role> language identifiers as the role settings menu, with a fallback string for roles that do not provide one instead of showing the raw identifier.

Equipment

  • Lists all installed equipment (weapons and items), sorted by their translated name, with their icon and a badge for built-in equipment.
  • Shows an equipment's name, type, description and the roles that are able to buy it. The buyable roles respect custom shops, as they are built from the shop data that is already synced to clients.
  • Equipment that no role can buy is still listed, as it can be handed out by a role loadout.

Notes

  • Wrapped text uses a plain DLabel: DLabelTTT2 paints its text with draw.SimpleText and therefore cannot wrap long descriptions.
  • The equipment page intentionally has no enabled/disabled filter.

🤖 Generated with Claude Code

@ROODAY

ROODAY commented Aug 12, 2025

Copy link
Copy Markdown
Author

There are still some things I'd like to fix:

  • Add a search bar to make finding a role easier
  • Remove the margin around the submenu content for this page, so that the list of roles is flush
  • Make the displayed information prettier

I think I can figure out the first one, but this is my first time making a PR to this codebase, so any help regarding the other two would be greatly appreciated! TBH I'm not even sure what info should be displayed/how to make it pretty

@ROODAY
ROODAY force-pushed the add-roles-guide-new branch from ea75a52 to 72d0422 Compare August 12, 2025 04:36
@TimGoll

TimGoll commented Aug 12, 2025

Copy link
Copy Markdown
Member

First of: I really appreciate what you did here. However, I have to say that it does not fit our design language so far. I'm a bit confused why your scrollbar looks different. And you should put the content in forms instead of bare strings

@ROODAY

ROODAY commented Aug 12, 2025

Copy link
Copy Markdown
Author

@TimGoll sure, I can use forms like how admin Roles page works, I guess these would be in form help text and just not have any of the config toggles/inputs?

As for the scrollbar looking different, I'm not sure why it's like that. I'm using a DScrollPanel instead of a DSubmenuList as the latter required a bunch of fields/data to be set that seems to only be on pages derived from base_gamemodemenu.lua, but this guide->roles page is derived from base_gamemodesubmenu.lua. I initially tried just replicating the admin roles page but ran into a ton of errors/stuff just not rendering and not knowing what was going on, so it felt easier to just rebuild from scratch with the components that DSubmenuList uses internally.

Sidenote, would you know how to remove the margin around the content area in this gamemode submenu? I don't think I explicitly set any margin here (and in other submenus I see there is a margin so it looks like something set at a default level)

@ROODAY

ROODAY commented Aug 12, 2025

Copy link
Copy Markdown
Author

Also just linking the thread from discord to bring the discussion together: https://discord.com/channels/442107660955942932/1402951259601768519

@TimGoll

TimGoll commented Aug 14, 2025

Copy link
Copy Markdown
Member

I guess these would be in form help text and just not have any of the config toggles/inputs?

Yes, for example by using help boxes which automatically support localization and line wrapping. However, I envisioned something way more in-depth for the guide, but I struggle to find any time to work on it.

As for the scrollbar looking different, I'm not sure why it's like that. I'm using a DScrollPanel instead of a DSubmenuList

That's probably it. The submenu list is heavily modified to have the style I was aiming for. It has been a while, I'm not so sure anymore how exactly it works. As you can see in #1752 I also started to completely refactor the codebase of vgui, because stuff like you encountered here really annoyed me.

Sidenote, would you know how to remove the margin around the content area in this gamemode submenu? I don't think I explicitly set any margin here (and in other submenus I see there is a margin so it looks like something set at a default level)

I think this is defined in the base menu in cl_help. If you want to change it, it will probably cause some pain for you because this propagates through the whole menu.

Rudhra Raveendran and others added 2 commits November 4, 2026 11:53
The roles guide now lists every registered role and shows its description,
team and base role in a read-only view. Descriptions use the same
ttt2_desc_<name> language identifier as the role settings menu, with a
fallback for roles that do not provide one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ROODAY
ROODAY force-pushed the add-roles-guide-new branch from 72d0422 to 8e47850 Compare November 4, 2026 20:31
ROODAY and others added 3 commits November 4, 2026 13:41
Roles that are disabled in the role settings can never be assigned, so
they should not be shown to players in the guide. The role settings are
fetched from the server, since server convars are authoritative. Roles
that are not distributable are still shown, as they can be handed out
during a round.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Whether a role is enabled is decided by server convars, which cannot be
read by non-admin clients. Add a request that returns all roles that can
actually be assigned, so that clients can filter out disabled roles, e.g.
in the roles guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
List all installed equipment with its name, type, description and the
roles that are able to buy it. Equipment without a description falls
back to a generic hint, equipment that can only be handed out by a role
is listed as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ROODAY ROODAY changed the title Implement TT2 Guide -> Roles Guide: Complete the Roles and Equipment pages Nov 4, 2026
@ROODAY

ROODAY commented Nov 4, 2026

Copy link
Copy Markdown
Author

@TimGoll wanted to revive this as I got some time to look at it again, here are some screenshots of it in game

image image

Wasn't sure how to fill in the Gameplay section since that might be more subjective than just piping data into a view.

@ROODAY

ROODAY commented Nov 5, 2026

Copy link
Copy Markdown
Author

@saibotk just tagging you as I saw you were the most recently active in other prs!

@Nosebody

Nosebody commented Nov 9, 2026 •

Copy link
Copy Markdown

@ROODAY
Can you do something like this?
I guess that fits better? That was my idea before i fund this pull request

(it is a render from claude)
grafik

@ROODAY

ROODAY commented Nov 9, 2026

Copy link
Copy Markdown
Author

@Nosebody thanks for the feedback! Is this a mockup or is there a branch I can base off of? Regardless I have some questions on how to implement this view:

  • Does each role have a Shop vs built-in tag?
  • Does each role have a color assigned to it already?
  • Where does the "HOW TO PLAY" text get populated from?
  • If roles are grouped by team, how should the UI handle a server with many roles installed? (e.g. in my screenshots earlier I have quite a few intalled). Scroll horizontally? Would this be any better than scrolling vertically?
  • Same for equipment regarding scrolling.
  • Also aren't there some roles that aren't traitor or innocent but third parties? Do they have enough info to populate further team panels? (e.g. jackal team)

@Nosebody

Copy link
Copy Markdown

Sorry that picture is a render, it is not build on code, i am more on the design side.
Every role has a color, i know that because i create a hud that use the role colors. I guess a tab for „other teams“ make sense? The shop data can we take live from the server, because u can edit shops. Make the same teams the same color? The how to play is something that has to be create per hand i guess.

@ROODAY

ROODAY commented Nov 11, 2026

Copy link
Copy Markdown
Author

I see, I can update to add role colors, group by team, and show the shop data. For the how to play, I don't think we should create by hand. Perhaps we can expose a field on roles that allows formatted text (markdown/html etc?) for the how to play section, but then this will be empty for most roles until role addon authors update to supply this info.

Roles are grouped by team in collapsible sections and shown as cards with
their icon, role color, team color and Built-in/Shop tags. The page can be
searched and filtered by team. Selecting a card opens the role details
below its row: description, "How to play", properties (base role, shop,
starting credits, public visibility) and the equipment of the role's shop.

The starting credits are a server only convar, they are now sent along
with the enabled roles. Role addons can provide a "How to play" section
with the language identifier ttt2_howtoplay_<rolename>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ROODAY

ROODAY commented Nov 13, 2026 •

Copy link
Copy Markdown
Author

@Nosebody I reworked the roles page based on your mockup, here's how it looks now:

Screenshot 2026-11-13 143209 Screenshot 2026-11-13 143214 Screenshot 2026-11-13 143221 Screenshot 2026-11-13 143226 Screenshot 2026-11-13 143235 Screenshot 2026-11-13 143244

What's in it:

  • Roles are grouped by team in collapsible sections. Innocent and Traitor come first, then the other teams (Jackal, Necromancer, ...) and "No Team" last.
  • Each card shows the role icon on the role color, the team bar in the team color, and Built-in / Shop tags.
  • You can search by role name and filter by team.
  • Clicking a card opens the details below its row. They show the description, "How to play", properties (base role for subroles, which shop the role uses, starting credits, visible to everyone) and the role's shop items.
  • Everything comes live from the server: only enabled roles are shown, shops reflect the shop editor (linked shops show e.g. "Traitor shop"), and starting credits are sent by the server, so they match what admins have set.

For "How to play", roles can now provide an optional language key, ttt2_howtoplay_<rolename>. Every line becomes a bullet point, and the section is hidden when a role doesn't have one. Because it's a language key, it can be translated like the role descriptions.

I wrote the "How to play" texts for Innocent, Traitor and Detective myself. Could you check whether that copy works for you, or if you'd phrase anything differently? For all other roles, the plan is to let the role addon creators add a "How to play" text to their roles themselves.

One deviation from the mockup: your mockup had the Detective's bar in blue, but since you suggested using the same color for the same team, the bar uses the team color and the icon box keeps the role color.

Could you also share a mockup for the Equipment page? I've left it as it is for now so it can follow your design.

This branch has not been deployed

No deployments
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