diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-03-14 20:50:44 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-03-14 23:04:11 +0100 |
commit | a43a4427d3dcb93e4317291bbd6227bc4130670e (patch) | |
tree | 1fe66f671a36829147ec1f3e3afea2007bf1e207 /views | |
parent | a3e6bb6dd0ebf7f2a368403f406c2f3d82654ed1 (diff) | |
download | server-a43a4427d3dcb93e4317291bbd6227bc4130670e.tar.gz |
WIP match makingwip-matchmaking
Use greedy best fit algorithm to partition tickets into matches.
Iterate using random start points to search for the best partitioning.
Diffstat (limited to 'views')
-rw-r--r-- | views/about.pug | 35 | ||||
-rw-r--r-- | views/admin_match.pug | 53 | ||||
-rw-r--r-- | views/header.pug | 1 | ||||
-rw-r--r-- | views/match.pug | 81 |
4 files changed, 170 insertions, 0 deletions
diff --git a/views/about.pug b/views/about.pug index dd34547..9f73e84 100644 --- a/views/about.pug +++ b/views/about.pug @@ -69,6 +69,41 @@ html dd. Anything goes. Read the game notice and adapt! + h2 Waiting room + + p. + In the public waiting room you can post a request for a game, or respond to someone else's request for a game. + If you see a game you want to play, click the Join link and enter the game. + Once the game has enough players, the creator can start the game. + + p. + If you'd like to post your own request for a game, click the create a new game link and + select the scenario and options you want to play. + + p. + If you want to play with friends, check the "private" checkbox and invite your friends + from the join page after you have created the game. + + h2 Matchmaking + + p. + The match maker will match players up and start games automatically + once there are enough people waiting for the same game. + Players will be matched with opponents of similar Elo ratings when possible. + + p. + Live tickets expire after 3 hours if you don't get a match. + All of your other Live tickets are removed when you get matched for a Live game. + + p. + Fast tickets take the time of day into account. + Queue up when you want to start playing for the best results. + + p. + <i>Don't queue up for too many games!</i> + It can take a while for the matches to start, + so you may end up with more games than you can handle. + h2 Privacy statement p When you create an account we collect the following personal information: diff --git a/views/admin_match.pug b/views/admin_match.pug new file mode 100644 index 0000000..11a6c54 --- /dev/null +++ b/views/admin_match.pug @@ -0,0 +1,53 @@ +//- vim:ts=4:sw=4: + +mixin show_ticket(ticket) + - var setup = SETUP_TABLE[ticket.setup_id] + tr + td= ticket.name + td= ticket.rating + td= setup.setup_name + td #{ticket.time} UTC + +mixin show_ticket_list(list) + table + thead + tr + th User + th Rating + th Title + th Age + tbody + each ticket in list + +show_ticket(ticket) + +doctype html +html + head + include head + title Matches + style. + div.buttons { margin-top: 8px } + body + include header + article + h1 Waiting Room - Admin + + p Time is #{new Date().toISOString()} + + h2 Live Tickets + if live_tickets.length > 0 + +show_ticket_list(live_tickets) + else + p No live tickets. + + h2 Fast Tickets + if fast_tickets.length > 0 + +show_ticket_list(fast_tickets) + else + p No fast tickets. + + h2 Slow Tickets + if slow_tickets.length > 0 + +show_ticket_list(slow_tickets) + else + p No slow tickets. diff --git a/views/header.pug b/views/header.pug index d386969..24dd9f2 100644 --- a/views/header.pug +++ b/views/header.pug @@ -9,6 +9,7 @@ header if user if ENABLE_FORUM a(href="/forum") Forum + a(href="/games/match") Match a(href="/games/public") Public if user.waiting > 0 a(href="/games/active") Games (#{user.waiting}) diff --git a/views/match.pug b/views/match.pug new file mode 100644 index 0000000..257752b --- /dev/null +++ b/views/match.pug @@ -0,0 +1,81 @@ +//- vim:ts=4:sw=4: + +- + var n_live = 0, n_fast = 0, n_slow = 0 + for (let t of tickets) { + if (t.pace === 1) n_live ++ + if (t.pace === 2) n_fast ++ + if (t.pace === 3) n_slow ++ + } + +mixin show_ticket(ticket) + - var setup = SETUP_TABLE[ticket.setup_id] + div + label + input(type="checkbox" name="tickets" value=ticket.ticket_id) + | #{setup.setup_name} + +doctype html +html + head + include head + title Matches + style. + div.buttons { margin-top: 8px } + body + include header + article + h1 Matchmaking + + if tickets.length > 0 + form(method="post" action="/games/match/unqueue") + if n_live > 0 + h3 Tickets - Live + each ticket in tickets + if ticket.pace === 1 + +show_ticket(ticket) + div.buttons + button(name="pace" value="1") Remove all + button(type="submit") Remove + if n_fast > 0 + h3 Tickets - Fast + each ticket in tickets + if ticket.pace === 2 + +show_ticket(ticket) + div.buttons + button(name="pace" value="2") Remove All + button(type="submit") Remove + if n_slow > 0 + h3 Tickets - Slow + each ticket in tickets + if ticket.pace === 3 + +show_ticket(ticket) + div.buttons + button(name="pace" value="3") Remove All + button(type="submit") Remove + p + else + h3 Tickets + p You have not queued for any matches. + + h3 Matches + + + if limit + p.error= limit + else + p Select what you want to play: + + form(method="post" action="/games/match/queue") + p + each title in TITLE_LIST + each setup in title.setups + label + input(type="checkbox" name="setups" value=setup.setup_id) + | #{setup.setup_name} + br + + p + button(name="pace" value=1) #{EMOJI_LIVE} Play Live + button(name="pace" value=2) #{EMOJI_FAST} Play Fast + button(name="pace" value=3) #{EMOJI_SLOW} Play Slow |