Skip to content

Server Browser UI

The server browser UI presents a scrollable list of SteamServerAdvertisement entries, each rendered by a SleekServer widget. The system supports column-based layout with per-column visibility toggles, multi-criteria filtering, ping display, favoriting, bookmark management, and server curation integration.

Source code location: Unturned/Sleek/SleekServer.cs, SleekServerBookmark.cs, Unturned/Settings/ServerBookmarks.cs, UI/Menu/Play/MenuPlayServerListFiltersUI.cs, UI/Menu/Play/MenuPlayServerBookmarksUI.cs

SleekServer — The Row Widget

SleekServer is a SleekWrapper that represents a single server row in the list. It holds a reference to the SteamServerAdvertisement it displays and manages 17 visual sub-elements:

ElementTypePurpose
buttonISleekButtonClickable row background
favoriteButtonSleekButtonIconToggle favorite status
nameLabelISleekLabelServer name
mapBoxISleekBoxCurrent map name
playersBoxISleekBoxCurrent player count
maxPlayersBoxISleekBoxMax player capacity
fullnessBoxISleekBoxPlayer fullness indicator
pingBoxISleekBoxConnection ping in ms
anticheatBoxISleekBoxAnti-cheat status
perspectiveBoxISleekBoxFirst/third person
combatBoxISleekBoxPvP/PvE mode
passwordBoxISleekBoxPassword protected
workshopBoxISleekBoxWorkshop mod count
goldBoxISleekBoxGold membership
cheatsBoxISleekBoxCheats enabled
monetizationBoxISleekBoxMonetization type
pluginsBoxISleekBoxPlugins enabled
thumbnailSleekWebImageServer thumbnail icon

Column Visibility System

The SynchronizeVisibleColumns() method iterates through each column widget, toggling visibility based on FilterSettings.columns. Each column has a fixed width stored as SizeOffset_X. When a column is hidden, its width is removed from the layout; when shown, its horizontal position is calculated from the right edge:

csharp
if (FilterSettings.columns.anticheat)
{
    horizontalOffset -= anticheatBox.SizeOffset_X;
    anticheatBox.PositionOffset_X = horizontalOffset;
    anticheatBox.IsVisible = true;
    horizontalOffset -= spacing;
}
else
    anticheatBox.IsVisible = false;

This right-to-left layout means columns stack from right to left when visible, with the server name and map filling the remaining space on the left.

Favoriting

The isCurrentlyFavorited property checks Provider.GetServerIsFavorited(info.ip, info.queryPort) to determine if the server is in the player's favorites list. The favorite button toggles this state.

Filter and Sort System

MenuPlayServerListFiltersUI provides the filter configuration UI. It exposes filter controls for:

  • Name — substring match on server name
  • Map — toggle per-map visibility with a list of known levels
  • Monetization — None, NonExclusive, Exclusive
  • Password — Any, Yes, No
  • Workshop — Any, Yes, No
  • Plugins — Any, Yes, No
  • Cheats — Any, Yes, No
  • Attendance — Any, Vacant, Occupied
  • Not Full — filter out full servers
  • VAC Protection — Any, Secure, Insecure
  • Third-party Anti-Cheat — Any, Secure, Insecure
  • Combat — Any, PvP, PvE
  • Gold filter — Any, Gold, Non-Gold
  • Camera — Any, First, Third, Both
  • List source — Internet, LAN, Favorites, History
  • Max ping — integer field for ping cap

Each boolean/combo filter is represented by a SleekButtonState with configurable states. The SynchronizeFilterButtons method reads from FilterSettings.activeFilters to update the UI state, and MarkActiveFilterModified tracks dirtiness.

Presets

Filter configurations can be saved as presets. Custom presets are stored as SleekCustomServerListPresetButton widgets, while defaults use SleekDefaultServerListPresetButton. The presets scroll view is split into two containers: customPresetsContainer and defaultPresetsContainer.

Ping Display

Ping is displayed through the pingBox column. The value comes from the SteamServerAdvertisement.ping field, which is populated by the Steamworks server query system (ISteamMatchmakingServers). The Provider layer receives ping data as part of the server list response from Steam's backend, including both the reported ping and the server's response time.

SleekServerBookmark — Bookmark Widget

SleekServerBookmark is a separate SleekWrapper used in MenuPlayServerBookmarksUI. Unlike SleekServer which represents a live server in the list, the bookmark widget represents a persisted server entry:

csharp
public class SleekServerBookmark : SleekWrapper
{
    private ServerBookmarkDetails bookmarkDetails;
    private ISleekButton button;
    private SleekButtonIcon toggleBookmarkButton;
    private SleekWebImage thumbnail;
    private ISleekLabel nameLabel;
    private ISleekLabel descLabel;
    private ISleekLabel hostLabel;
}

Bookmark State

The ServerBookmarkDetails class stores per-server metadata:

FieldTypePurpose
steamIdCSteamIDPersistent server identifier (requires GSLT)
hoststringIP address, DNS name, or web API URL (optional since 2025-01-20)
queryPortushortSteam query port (zero for Fake IP servers)
namestringServer name (updated from SteamServerAdvertisement)
isBookmarkedboolCurrently bookmarked state

The toggle button flips isBookmarked and calls ServerBookmarksManager.AddBookmark or ServerBookmarksManager.RemoveBookmark:

csharp
private void OnClickedToggleBookmarkButton(ISleekElement button)
{
    bookmarkDetails.isBookmarked = !bookmarkDetails.isBookmarked;
    if (bookmarkDetails.isBookmarked)
        ServerBookmarksManager.AddBookmark(bookmarkDetails);
    else
        ServerBookmarksManager.RemoveBookmark(bookmarkDetails.steamId);
}

Bookmark List Sorting

MenuPlayServerBookmarksUI.SynchronizeSortedBookmarks() copies all bookmarks from ServerBookmarksManager.GetList() into a sorted list using ServerBookmarkComparer_NameAscending (A-to-Z by name), then rebinds the UI list. The descending comparer inherits from the ascending one and negates the comparison.

Bookmark-specific sort support includes ServerBookmarkComparer_NameAscending and ServerBookmarkComparer_NameDescending.

Tutorial Display

When the bookmark list is empty, a tutorialBox is shown. This is controlled by tutorialBox.IsVisible = sortedBookmarks.Count < 1.

Server Curation Integration

The Sleek directory includes server curation widgets (SleekServerCurationRule, SleekServerCurationItem, SleekServerCurationRuleTester). These integrate with ServerListCurationAsset to filter servers based on curated rules. Curation rules can:

  • Whitelist or blacklist servers by name, IP range, or SteamID
  • Apply labels and categories
  • Override server display properties

The curation system operates alongside the player's personal filter settings, with curation rules applied at the Provider level before results reach the UI.