Repository navigation
Sort the server browser by players, ping or name - #5
Closed
medic-code wants to merge 2 commits into
Closed
medic-code wants to merge 2 commits into
medic-code wants to merge 2 commits into
Conversation
medic-code
force-pushed
the
feat/ping-order-progress
branch
from
October 25, 2026 16:35
aeac73c to
9624639
Compare
Players asked to sort the server browser by ping and by players. The order lives in p2p_lobby.c, where one comparator gives both the order p2p_lobby_games returns and the order update_probes times the hosts in, so a new order also changes which hosts are timed first. By ping, games with no ping (not yet timed, a password's, one whose join failed) stay last in either direction; by name, the case is ignored. The order is kept for the run, also while the browser is closed. The list is now sorted under p2p_lock, since the p2p thread reads the order too. Nothing sent between machines changes: the network version stays 38. Checked: tools/p2p_lobby_check.c shows four games by players, ping and name, each both ways, and probes them on Refresh in the order shown; the order survives the browser going off and on; an unknown order falls back to players. Six mutants of p2p_lobby.c (order ignored, reverse ignored, probes in their own order, case kept, no-ping first when reversed, a failed join's ping used) each fail it.
PC's join game screen has column titles that run "gamespy select header", each with an up and a down arrow, which the port left unwired and out of the focus. In the server browser, PLAYERS, PING and SERVER NAME now take the focus (up from the first game, left and right between them) and sort the games through p2p_lobby_set_order: PLAYERS the most first, PING the lowest first, SERVER NAME A to Z, and the other way at a second press on the same title, as PC's pair of arrows shows. The arrow over the sorted title points up for the lowest or A first and down for the most first. MAP, GAME and the icon columns stay out of the focus; LAN's and Direct Link's titles do nothing, as before. A sort goes back to the first game, and the A press a join posts still joins when a title has the focus. Checked: tools/harness/tests/test_browser_sort.py (the titles that sort, the arrow for each order, the focus, a press and a press again, a join's press, LAN), with eight negative controls; in a null-renderer run of three local hosts and a browser on a local broker, pressing up, right and A sorted the rows by ping lowest first, A again highest first, then PLAYERS most first, and REFRESH kept the ping order and timed the hosts in it. Network version stays 38.
medic-code
force-pushed
the
feat/browser-sort-columns
branch
from
October 25, 2026 16:40
142b622 to
48c5482
Compare
Owner
Author
|
Closing as redundant: OpenCE main (OpenCommunityEdition#490, 815d3a0) now sorts the server browser by its column titles with Halo PC's arrows and remembers the order (network.browser_sort). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Players asked to sort the server browser by ping and by players.
The browser shows one fixed order, most players first. With about 40 public games listed, a player who wants the nearest host has to read every PING number.
Halo PC sorted its list by its column titles. Those titles are in the port's menus, but do nothing.
What it does
Screenshots
Look at the order of the games: A on PLAYERS puts the fewest players first (it starts most first), A on SERVER NAME puts them A to Z, and A on SERVER NAME again puts them Z to A. The title being used is boxed. Only two public games were on this test build's version.
Decisions
header_sort_arrows); not checked against the PC game itselfDetails
gamespy select header, which callsbrowser_sort(menu_functions.c).browser_sortsets the order withp2p_lobby_set_order(p2p_lobby.c). Each framep2p_lobby_gamesreturns the games in that order, andupdate_probesuses the same comparator to choose which host to time next.port/linux/src/p2p_lobby.c:listing_ordersorts by the chosen key first and keeps the old order (players, failed, open, name) to break ties. By ping, a game with no ping (not timed yet, a password's, a failed join) is last in both directions. Name order ignores case. The list is sorted underp2p_lock, because the p2p thread reads the order too. Builds on Time server browser hosts in the order shown, with dots OpenCommunityEdition/OpenCE#441, which times the hosts in the order shown.port/linux/src/p2p.h:P2P_LOBBY_ORDER_PLAYERS / PING / NAME,p2p_lobby_set_order,p2p_lobby_order.port/linux/game/menu_functions.c: in the server browser, the header row joins the focus, and only the three sorting titles in it can take the focus. When the screen opens, the focus in the row goes to the sorted title, and only that title shows its arrow: up for lowest or A first, down for most first. A sort goes back to the first game. If a title has the focus when the browser posts a join's A press, the join still goes through. LAN and Direct Link titles do nothing, as before.source/interface/ui_widget.c: aport:comment updated (only some titles are disabled now).tools/ce_menus.py,port/assets/menus/UNWIRED.md:gamespy select headermoves to the wired functions.port/linux/README.md: the Server browser section describes sorting.User experience
How to test
python3 configure.py && ninja linuxpython3 -m pytest -q tools/test_linux_port.py -k p2p_signatures tools/harness/tests/test_browser_sort.py(Linux, or the halo-toolchain container: the harness needs a 32-bit C runtime).HALO_NETWORK_TEST=host:<map>andHALO_NETWORK_TEST_PUBLIC=trueon a local broker. Open the Server Browser on a fourth copy (HALO_MENU_OPEN=main_menu/multiplayer_type_select/join_game/join_game_screen), then try steps 2 to 5 above.Tested
tools/p2p_lobby_check.c(viatest_linux_port.py): players, ping and name order, each both ways; probes on Refresh in the order shown; the order kept while the browser is off; six mutants ofp2p_lobby.ceach fail ittools/harness/tests/test_browser_sort.py: 6 cases, 8 negative controlspytest tools/test_linux_port.py tools/test_web_build.py tools/harnessin the halo-toolchain container, at each commitninja android,ninja web