18 Feb, 2007, Zeno wrote in the 1st comment:
Votes: 0
So I'm rewriting my graph that I had for the MUD. It used to just be a bar graph. Now it's a line graph.
http://www.biyg.org/graphs/line.php

First off, does anyone have any general suggestions on how to improve it?

Second… the graph will eventually reach a point where the php memory limit is hit, and the graph will no longer be able to be generated. Does anyone have any ideas what to do about that, besides increasing the memory limit?
18 Feb, 2007, KaVir wrote in the 2nd comment:
Votes: 0
Zeno said:
First off, does anyone have any general suggestions on how to improve it?


I'm guessing you're just checking every half hour to see how many people are on, right?

Instead, why not keep track of the average over that period of time? So you might have 5.3 one hour, 5.8 the next, 6.15 the next, and so on? You could then have an average for the day, and perhaps have a separate graph showing the average for each day over the period of a year.

The hourly graph would be useful for finding out what time of day most people log on, while the yearly graphs would be an interesting record of the long-term popularity of your mud.
18 Feb, 2007, Skol wrote in the 3rd comment:
Votes: 0
I've done one like that for the last 6 years now, but I now need to write a php parser to decipher all the data hehe.
It's quite interesting to see which days of the week, which times in those days, which times of the year etc, have more/less players.
18 Feb, 2007, Skol wrote in the 4th comment:
Votes: 0
An excerpt:

Sun Feb 18 06:36:24 2007 - 4
Sun Feb 18 06:50:25 2007 - 4
Sun Feb 18 07:04:26 2007 - 4
Sun Feb 18 07:18:29 2007 - 6
Sun Feb 18 07:32:31 2007 - 6
Sun Feb 18 07:46:33 2007 - 4
Sun Feb 18 08:00:35 2007 - 4
Sun Feb 18 08:14:38 2007 - 7
Sun Feb 18 08:28:40 2007 - 9
Sun Feb 18 08:42:43 2007 - 9
Sun Feb 18 08:56:45 2007 - 9
Sun Feb 18 09:10:47 2007 - 14
Sun Feb 18 09:24:49 2007 - 14
Sun Feb 18 09:38:50 2007 - 13
Sun Feb 18 09:52:52 2007 - 14
Sun Feb 18 10:06:53 2007 - 14
Sun Feb 18 10:20:54 2007 - 11
Sun Feb 18 10:34:56 2007 - 11
Sun Feb 18 10:48:58 2007 - 13
Sun Feb 18 11:03:02 2007 - 14
Sun Feb 18 11:17:04 2007 - 14

It's REALLY simply, triggers when people type who I believe, my friend Jair wrote it (he did the deity code we see everywhere on diku's) back when he started the mud.
So yeah, basically I need to write a php parser to pop those into an array, then figure out how often I want to look (hourly etc), figure if I want some bar graph type visual etc.
18 Feb, 2007, Skol wrote in the 5th comment:
Votes: 0
One thing I really find interesting from view the raw data… it's never a spike of people, it's always a wave-like increase/decrease. I've never seen it go from like 5 to 35, it's always jumps of 1/2 up and down. I think it really goes to show that people congregate where other people are, one thing that helps is if the 'Imm' players are visible, if they have mortal players on, those visible too. And active heh, no one likes a botfest where no one's alive.
Sorry for the tangent :)
18 Feb, 2007, Zeno wrote in the 6th comment:
Votes: 0
KaVir said:
Zeno said:
First off, does anyone have any general suggestions on how to improve it?


I'm guessing you're just checking every half hour to see how many people are on, right?

Instead, why not keep track of the average over that period of time? So you might have 5.3 one hour, 5.8 the next, 6.15 the next, and so on? You could then have an average for the day, and perhaps have a separate graph showing the average for each day over the period of a year.

The hourly graph would be useful for finding out what time of day most people log on, while the yearly graphs would be an interesting record of the long-term popularity of your mud.

Hm, that would require coding on the MUD side which I don't mind. I don't know much about php, so the graph was kind of hacked together. :P But an average over time? Hmm. I'll probably change the data collection to an hour instead of a half hour. How many times do you think I should count the players per hour? Maybe 6, so every 10 minutes?
18 Feb, 2007, Conner wrote in the 7th comment:
Votes: 0
Personally, I think Skol's idea of checking how many are online each time someone uses the who command is a good idea but maybe combine that with checks on the half (quarter?) hour just for balance and then use that for your averages.

Also, while I agree that the hourly averages would help discern your peak times of day, and a yearly chart mu=ight help monitor long-term popularity (as well as seasonal changes), a weekly chart might help you see what days of the week see more or less activity as well.
18 Feb, 2007, Zeno wrote in the 8th comment:
Votes: 0
I dunno about relying on players to get a count. I could just as well use number_range to do a random interval each pulse.

The only problem is the php limit, again. Need to make sure that is fixed before I get too much into this.
18 Feb, 2007, KaVir wrote in the 9th comment:
Votes: 0
Zeno said:
How many times do you think I should count the players per hour? Maybe 6, so every 10 minutes?


Whenever the number of players changes or the current average is required (for a 'who' list display, etc), multiply the number of players by the number of seconds that have elapsed since the last time you saved the playercount, and add the result to the playercount. The actual average is the playercount divided by the total number of seconds that have elapsed since you started keeping track of the playercount.

I did create a snippet version of my code, but I don't think I have a copy of it on this computer. I can email you a (doesn't quite work outside of my mud) version if you like though.
18 Feb, 2007, Conner wrote in the 10th comment:
Votes: 0
While I can't help you with the php limits, if you don't want to rely on players using the who command, how about each time someone connects instead?
18 Feb, 2007, Zeno wrote in the 11th comment:
Votes: 0
Quote
the current average is required (for a 'who' list display, etc)

I'm confused about that. What does 'who' have to do with average players?

Quote
I did create a snippet version of my code, but I don't think I have a copy of it on this computer. I can email you a (doesn't quite work outside of my mud) version if you like though.

Sure, why not. Not like I need to port the code, I only need to get a concept of what would be done.
18 Feb, 2007, KaVir wrote in the 12th comment:
Votes: 0
Zeno said:
Quote
the current average is required (for a 'who' list display, etc)

I'm confused about that. What does 'who' have to do with average players?


Bad assumption on my part (I display the average whenever someone types 'who', and was writing my description from that perspective) - but basically any time you want to display the average number of players, you'll want to update it.
19 Feb, 2007, Zeno wrote in the 13th comment:
Votes: 0
Ah, so in that case… never in Smaug. :P

Thanks for the code.
19 Feb, 2007, Tyche wrote in the 14th comment:
Votes: 0
19 Feb, 2007, Guest wrote in the 15th comment:
Votes: 0
Stock Smaug had a really simple way of doing this. In the update loop, there's a spot that looks like so:
if ( (current_time % 1800) == 0 )
{
sprintf(buf, "%.24s: %d players", ctime(&current_time), num_descriptors);
append_to_file(USAGE_FILE, buf);
sprintf(buf, "%.24s: %dptn %dpll %dsc %dbr %d global loot",
ctime(&current_time),
sysdata.upotion_val,
sysdata.upill_val,
sysdata.scribed_used,
sysdata.brewed_used,
sysdata.global_looted );
append_to_file( ECONOMY_FILE, buf );
}


The descriptor count was dumped every 30 minutes into this file. You could speed this up a bit by cutting the 1800 down to 900 or however many seconds you want it to wait in between. Then just plot your averages that way.
19 Feb, 2007, Zeno wrote in the 16th comment:
Votes: 0
Yeah, that's sort of what I'm using now although it's modified. I was just wondering if a random interval would be better than a constant (every 30min is what I have now) interval.
20 Feb, 2007, Skol wrote in the 17th comment:
Votes: 0
Nod, the timed one is good, the 'omni' one was simply giving me a truly random one (of course there's certainly going to be at least one person on if they type omni, it isn't in 'who' my bad, but omni when immortals use that command to get the short list of player/clan/level/room etc). The regular time that it records the count is in update.c when it does the char_update function, once every 15 times. Although, reading the data…. it should be 16 heh, it's putting it every 14 minutes ack ;p.

But hey, I didn't write it originally, but I can fix it.
18 Sep, 2008, Zeno wrote in the 18th comment:
Votes: 0
I redid everything again. :P
http://biyg.org/graphs/line.php

Data is collected every 30sec and then each hour that data is processed into average in that hour and max in that hour.
12 Feb, 2009, Zeno wrote in the 19th comment:
Votes: 0
And I redid it again! :P

This one is finally shown to the public playerbase: http://www.biyg.org/graphs/index.php
13 Feb, 2009, quixadhal wrote in the 20th comment:
Votes: 0
The way we used to track how many users were online at any given time was to have a seperate "who" port, which printed the who list (as it would be seen by a level 1 player) and dropped the connection. Originally, this was a convenience feature, since you could quickly check to see if anyone you knew was on before logging in. Later, we hooked the output of a small bash script (grep, and awk) into MRTG to generate graphs.
0.0/34