-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Add live player count tracking #450
Comments
Ideally this would be done through some sort of API on the MasterServer. Updating a value in a database is a bandaid solution at best. |
Is this somthing #309 will handle? A bandaid solution might be necessary if the API is still a ways off from being merged. |
I don’t know if it’s in #309 but it could likely be added somewhat easily. This isn’t a critical issue and can wait for a proper solution. |
Gotcha If I end up implementing this myself in the meantime (the database version), should I create a pull request so others can pull it if they want, or should I just keep it in my fork? |
You can kind of already get the currently online players from the table SELECT
(SELECT `name`
FROM `charinfo`
WHERE `id` = `outer`.`character_id`) AS `Minifigure`,
(SELECT `name`
FROM `accounts`
WHERE `id` =
(SELECT `account_id`
FROM `charinfo`
WHERE `id` = `outer`.`character_id`)) AS `Account`,
(SELECT `name`
FROM `map`
WHERE `id` = `outer`.`map_id`) AS `World`
FROM `activity_log` `outer`
WHERE `activity` = 0
AND `time` > UNIX_TIMESTAMP() - 21600
AND `id` =
(SELECT MAX(`id`)
FROM `activity_log`
WHERE `character_id` IN
(SELECT `id`
FROM `charinfo`
WHERE `account_id` =
(SELECT `account_id`
FROM `charinfo`
WHERE `id` = `outer`.`character_id`))); For this query to work you need to add an extra table The query works perfectly most of the time. However, sometimes the |
This isn't really helpful for actually getting who is online in live time, it just gives you people on within the last 6 hours, which is not what the issue was about. However yes #309 will contain a method of getting all online players. |
No, it does not just give the people that were online within the last 6 hours. It looks for the newest row of each account in the |
Ah yeah, after further looking into how that table works again I realise I am wrong, apologies. That would be the only way to get online players. |
Is your feature request related to a problem?
No
Describe the solution you'd like
Add the ability for the number of currently online players to be tracked in the database. This would allow for easier moderation and allow for an external program to grab the current player count for display purposes.
Having the server update a new column in the
accounts
table called something likeis_online
which would be a boolean 0 for offline and 1 for online.Each time a user logs in, their
is_online
would be changed to a1
When a user logs off, their
is_online
value would be changed to a0
Repository breaking implications
The
accounts
table would need an additional column.Describe alternatives you've considered
A couple alternatives,
online_accounts
that is updated with the accounts that are currently online. (this is inefficient, and not ideal)Additional context
Briefly going through the code, its already tracked when user logs on/off, see
DarkflameServer/dWorldServer/WorldServer.cpp
Line 800 in 42f6f2f
and
DarkflameServer/dGame/UserManager.cpp
Line 139 in d9d27a8
The text was updated successfully, but these errors were encountered: