MantisBT - Zandronum |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0001799 | Zandronum | [All Projects] Suggestion | public | 2014-05-10 03:29 | 2014-11-28 18:22 |
|
Reporter | Watermelon | |
Assigned To | | |
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | new | Resolution | open | |
Platform | | OS | | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | | |
|
Summary | 0001799: Overhaul of the join queue |
Description | The join queue we currently have works, but is quite limited (especially in the way of team stuff). As I'm trying to solve another ticket, the join queue's limitations are getting in the way. I figure instead of adding more code to correct for the current mess, I would re-write it from the ground up in a properly structured class. This leads to four things:
1) Code clarity and new ease of use
2) Allow me to do another ticket without adding more hacky stuff on top of the current implementation (see linked ticket)
3) Allow saving of positions in line, which annoys people who are waiting to get into (for example) a duel server for 20+ minutes and accidentally timeout/disconnect [this occurs more frequently than one would think]
4) Can be used in the event system now easily (see linked ticket) |
Steps To Reproduce | |
Additional Information | |
Tags | No tags attached. |
Relationships | related to | 0000350 | new | | sv_maxplayersperteam | related to | 0001794 | closed | Torr Samaho | New script type EVENT |
|
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2014-05-10 03:29 | Watermelon | New Issue | |
2014-05-10 03:30 | Watermelon | Note Added: 0008766 | |
2014-05-10 03:30 | Watermelon | Relationship added | related to 0000350 |
2014-05-10 03:31 | Watermelon | Relationship added | related to 0001794 |
2014-05-10 03:31 | Watermelon | Relationship deleted | related to 0001794 |
2014-05-10 03:31 | Watermelon | Relationship added | child of 0001794 |
2014-05-10 03:32 | Watermelon | Note Edited: 0008766 | bug_revision_view_page.php?bugnote_id=8766#r4748 |
2014-05-10 03:35 | Watermelon | Description Updated | bug_revision_view_page.php?rev_id=4750#r4750 |
2014-05-10 07:15 | Hypnotoad | Note Added: 0008767 | |
2014-05-10 13:17 | Watermelon | Note Edited: 0008766 | bug_revision_view_page.php?bugnote_id=8766#r4751 |
2014-05-10 15:22 | Watermelon | Note View State: 0008766: private | |
2014-05-10 15:23 | Watermelon | Note Added: 0008772 | |
2014-05-10 15:24 | Watermelon | Note Edited: 0008766 | bug_revision_view_page.php?bugnote_id=8766#r4756 |
2014-05-10 15:25 | Watermelon | Note Edited: 0008766 | bug_revision_view_page.php?bugnote_id=8766#r4757 |
2014-05-10 15:25 | Watermelon | Note View State: 0008766: public | |
2014-05-10 21:02 | Watermelon | Note Edited: 0008772 | bug_revision_view_page.php?bugnote_id=8772#r4759 |
2014-05-10 21:02 | Watermelon | Note Edited: 0008772 | bug_revision_view_page.php?bugnote_id=8772#r4760 |
2014-05-10 21:03 | Watermelon | Note Edited: 0008766 | bug_revision_view_page.php?bugnote_id=8766#r4761 |
2014-05-10 21:04 | Watermelon | Note Edited: 0008772 | bug_revision_view_page.php?bugnote_id=8772#r4762 |
2014-05-10 21:04 | Watermelon | Note Edited: 0008772 | bug_revision_view_page.php?bugnote_id=8772#r4763 |
2014-06-02 03:11 | Watermelon | Assigned To | => Watermelon |
2014-06-02 03:11 | Watermelon | Status | new => assigned |
2014-06-02 03:11 | Watermelon | Note Added: 0008835 | |
2014-06-08 18:40 | Watermelon | Note Added: 0008931 | |
2014-06-09 14:06 | Konar6 | Note Added: 0008958 | |
2014-10-05 22:32 | Dusk | Relationship replaced | related to 0001794 |
2014-10-09 00:02 | Watermelon | Note Added: 0010392 | |
2014-10-09 00:02 | Watermelon | Assigned To | Watermelon => |
2014-10-09 00:02 | Watermelon | Status | assigned => new |
2014-11-28 18:22 | Watermelon | Target Version | 2.0 => |
Notes |
|
(0008766)
|
Watermelon
|
2014-05-10 03:30
(edited on: 2014-05-10 21:03) |
|
Here is an outline of what I have in mind and (mostly) coded so far:
#include <deque>
#include <vector>
#include "doomtype.h"
#include "networkshared.h"
#include "sv_main.h"
#include "zstring.h"
//-----------------------------------------------------------------------------
// Defines
//-----------------------------------------------------------------------------
#define JOINQUEUE_DEFAULT_TIMEOUT (5 * 60 * TICRATE)
#define JOINQUEUE_NOT_IN_LINE -1
#define JOINQUEUE_NO_POSITION -1
//-----------------------------------------------------------------------------
// Enums
//-----------------------------------------------------------------------------
typedef enum {
JQPRIORITY_ANY = 0, // The first player found (either random or specific team)
JQPRIORITY_RANDOM = 1, // Priority given to random's
JQPRIORITY_SPECIFIC = 2, // Priority given to people who want that specific team
} JoinQueueTeamPriorityType_e;
//-----------------------------------------------------------------------------
// Structures
//-----------------------------------------------------------------------------
// Encapsulates a join entry
typedef struct {
// The player identifier
ULONG ulPlayer;
// The team the player wishes to join
ULONG ulTeam;
// The address the player was connected with (to see if they reconnect)
NETADDRESS_s netAddress;
// The gametic the user joined the queue with
int gameticJoinedQueue;
} JoinQueueEntry_t;
//-----------------------------------------------------------------------------
// Classes
//-----------------------------------------------------------------------------
// A class that contains operations for a functioning join queue
// The front of the queue holds the players who are first in line to be picked
class JoinQueue {
private:
std::deque<JoinQueueEntry_t> queue; // The queue that holds all the players who want to join
LONG timeoutTicThreshold; // How long until a disconnected player is purged
bool popIntoGame(const ULONG ulPosition);
public:
JoinQueue();
~JoinQueue();
void addPlayerToFrontOfQueue(JoinQueueEntry_t playerEntry);
void addPlayerToBackOfQueue(JoinQueueEntry_t playerEntry);
bool addPlayerToQueuePosition(JoinQueueEntry_t playerEntry, const ULONG ulPosition);
bool popPlayerIntoGame(const ULONG ulPlayer);
bool popPositionIntoGame(const ULONG ulPosition);
bool popTeamIntoGame(const ULONG ulTeam, JoinQueueTeamPriorityType_e priorityEnum);
int getQueuePosition(ULONG ulPlayer);
JoinQueueEntry_t getFrontOfQueue();
JoinQueueEntry_t getBackOfQueue();
JoinQueueEntry_t getQueueEntryAt(const ULONG ulPosition);
JoinQueueEntry_t getQueueEntryForPlayer(const ULONG ulPlayer);
std::vector<JoinQueueEntry_t> getPlayersForTeam(const ULONG ulTeam);
bool removePlayerFromQueue(const ULONG ulPlayer, const bool bBroadcast);
bool removePlayerFromQueueFront(const bool bBroadcast);
bool removePlayerFromQueueBack(const bool bBroadcast);
bool removePlayerFromQueueAt(const ULONG ulPosition, const bool bBroadcast);
void handleSpectatorLeftGame(const ULONG ulPlayer, const bool bWantPop);
void handlePlayerLeftGame(const ULONG ulPlayer, const bool bBroadcast = true);
bool isPlayerInLine(const ULONG ulPlayer);
LONG getPositionInLine(const ULONG ulPlayer);
void setTimeoutThreshold(const LONG ticAmount);
LONG getTimeoutThreshold();
bool attemptToRestorePlayer(const ULONG ulPlayer, NETADDRESS_s netAddress);
ULONG getSize();
bool isEmpty();
void purgeMissingPlayers(const bool bBroadcast);
void clearQueue();
FString getPrintableJoinQueue();
};
//-----------------------------------------------------------------------------
// Extern variables
//-----------------------------------------------------------------------------
extern JoinQueue g_joinQueue;
//-----------------------------------------------------------------------------
// Prototypes
//-----------------------------------------------------------------------------
void JOINQUEUE_CLIENT_SetPositionInLine(LONG lPosition);
|
|
|
|
|
|
(0008772)
|
Watermelon
|
2014-05-10 15:23
(edited on: 2014-05-10 21:04) |
|
I don't know where my post went, it seems to have vanished.
For your ticket, because of what it's requesting... it'd be best if Torr looked into that.
I pushed the latest (non-working) code to the repo in it's own branch.
EDIT:
After pushing again, I think it needs some re-writing and trimming of the fat that doesn't need to be in there.
There's some stuff that needs fixing fr sure, one of which is where I return weird structs (incomplete). I'll find a better solution later.
I'm also really happy to see that deque's indices are O(1)! I thought it was O(n) complexity. Thank you STL
|
|
|
|
I'm changing the API of this class because there's a ton of methods that no one will use anyways.
It will have the basics and we're good to go. |
|
|
|
Need input:
How do we handle people with the same IP? Like brothers who play. The question is, how does the remembering of stats work? Is it based on port as well as IP?
I'm trying to figure out this one last issue before proceeding with completion of the new join queue. |
|
|
(0008958)
|
Konar6
|
2014-06-09 14:06
|
|
Remembering frags works with the player name and IP:port. |
|
|
|
Will resume when I complete other tickets |
|