Peak Playing Times
-
Spunkmeyer
- Posts: 2013
- Joined: Fri Jun 27, 2003 7:00 am
- Location: Contact me regarding: CC, Slayer and AllegWiki.
Something is off.. i have been for past 3 or 4 days to log in 19:00 GMT.. a bit before "peak" time and found noone there.
Usually at least 1 or 3 people there like 17:00 GMT (mu usual login time). Atleast some AFK people, but not 0.
But now i see nothing.. no alleg for 4 days..
Statistics is a lie !
[PS: id rather be in game than on forums]
Usually at least 1 or 3 people there like 17:00 GMT (mu usual login time). Atleast some AFK people, but not 0.
But now i see nothing.. no alleg for 4 days..
Statistics is a lie !
[PS: id rather be in game than on forums]
Last edited by boe on Fri Jun 29, 2012 7:08 pm, edited 1 time in total.
They can't stop me!! MRAH!!!!!!
Looking at Juckto's explaination it struck me that it's not 'sunday' that's important, but 'squad game peak' that we want to call out. In that light, I am treating 19:00 UTC on Sunday as midnight, and adjusting the graph labels accordingly so that if Juckto looks at the graph at UTC+13:00, he's going to see that the best time to login is 9:00am on monday local time, which I think is optimal. I also added a timezone dropdown that auto sets to your local time, and lets you client side shift the graph and the squad game time on change.
Fwiffo, take a look and see what you think of this one.
Looking at Juckto's explaination it struck me that it's not 'sunday' that's important, but 'squad game peak' that we want to call out. In that light, I am treating 19:00 UTC on Sunday as midnight, and adjusting the graph labels accordingly so that if Juckto looks at the graph at UTC+13:00, he's going to see that the best time to login is 9:00am on monday local time, which I think is optimal. I also added a timezone dropdown that auto sets to your local time, and lets you client side shift the graph and the squad game time on change.
Fwiffo, take a look and see what you think of this one.
Code: Select all
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<!-- BT - Added to support user's local timezone.
http://www.pageloom.com/automatic-timezone-detection-with-javascript -->
<script type="text/javascript" src="http://cdn.bitbucket.org/pellepim/jstimezonedetect/downloads/jstz.min.js"></script>
<!-- BT - Added to support display of user's local timezone. -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
// BT - Date shift chart data to user's local timezone.
function fixTimezone(timezoneOffsetMinutes, dataArray) {
var timezoneOffsetHours = Math.round(timezoneOffsetMinutes / 60) * -1;
var shiftHours = timezoneOffsetHours;
var output = new Array();
output[0] = dataArray[0];
if(timezoneOffsetHours < 0)
timezoneOffsetHours = 23 + timezoneOffsetHours;
for(var i = 0; i < 24; i++) {
var currentHour = timezoneOffsetHours + i;
if(currentHour > 23)
currentHour -= 24;
dataArray[currentHour + 1][0] = i+':00';
output[i + 1] = dataArray[currentHour + 1];
}
return output;
}
function drawChart(timezoneName, timezoneOffsetMinutes)
{
$("#chart_div").empty();
weekendLabel1 = "Saturday Avg";
weekendLabel2 = "Sunday Avg";
// Once squad game time crosses midnight local time, shift the labels up a day.
if(timezoneOffsetMinutes / 60 >= 4)
{
weekendLabel1 = "Sunday Avg";
weekendLabel2 = "Monday Avg";
}
// BT - Added fixTimezone function to dateshift the chart data.
var data = google.visualization.arrayToDataTable(fixTimezone(timezoneOffsetMinutes, [
['Hour','Weekday Avg',weekendLabel1,weekendLabel2],
['0:00',8.7,3.2,9.8],['1:00',11.2,7.8,13.8],['2:00',11.3,11.8,15.5],['3:00',11.1,13.5,13.5],['4:00',8.0,11.0,9.8],['5:00',5.1,10.5,9.0],['6:00',2.0,7.2,8.5],['7:00',0.8,5.0,7.5],['8:00',0.6,2.0,6.5],['9:00',0.4,1.2,1.8],['10:00',0.8,1.2,2.2],['11:00',1.2,2.2,2.5],['12:00',1.7,3.8,4.0],['13:00',2.3,6.0,4.5],['14:00',2.4,6.0,7.2],['15:00',2.8,6.8,8.8],['16:00',3.3,8.8,9.0],['17:00',4.8,13.2,11.2],['18:00',6.6,13.0,13.5],['19:00',6.4,13.5,23.0],['20:00',7.9,10.8,19.5],['21:00',7.8,8.5,10.8],['22:00',5.9,11.2,11.5],['23:00',7.2,8.2,7.5]
]));
var options = {
curveType: 'function',
backgroundColor: {fill:'transparent'},
title: 'Allegiance Player Playing Patterns (past 30 days)',
vAxis: {title: '# of players', textPosition: 'none'},
// BT - Added user's local timezone name.
hAxis: {title: 'Hour (' + timezoneName + ')', gridlines: {color: '#333', count: 24}, slantedText: true, slantedTextAngle: 90, showTextEvery: 1, textStyle: {color: 'black', fontName: 'Arial', fontSize: 12} }
}
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
// BT - Determine next squad game time in user's local timezone.
$(document).ready(function()
{
var currentTimezoneName = jstz.determine().name();
var currentTimezoneOffsetMinutes = new Date().getTimezoneOffset();
// BT: Add timezone selection dropdown.
var $ddlTimezone = $("#ddlTimezone");
$.each(jstz.olson.timezones, function(offsetMinutesList, zoneName)
{
var offsetMinutes = parseInt(offsetMinutesList.split(",")[0]);
// Ignore any .5 timezones, they will just have to pick a neighbor timezone.
// .5 timezones messes up the date shifter, and the graph legend, etc.
if(offsetMinutes % 60 == 0)
{
// If the local machine is obeying DST, and the timezone has an olson DST start date
// we'll pretend that the timezone should be shown with the DST offset.
var isDST = false;
if(jstz.olson.dst_start_dates[zoneName] != null && jstz.date_is_dst(new Date()) == true)
{
offsetMinutes += 60;
isDST = true;
}
var offsetHours = offsetMinutes / 60;
var offsetString = "UTC";
if(offsetHours >= 0)
offsetString += "+"
offsetString += offsetHours;
var currentStringLength = offsetString.length;
for(var i = 0; i < (10 - currentStringLength); i++)
offsetString += " ";
var selected = "";
if(currentTimezoneName == zoneName)
selected = "selected"
var isDSTString = "";
if(isDST == true)
isDSTString = " (DST}"
$ddlTimezone.append($("<option " + selected + " />").val(offsetMinutes).html(offsetString + zoneName + isDSTString));
$("#ddlTimezone option:last-child").attr("timezoneName", zoneName);
}
});
$ddlTimezone.change(function()
{
var offset = $("#ddlTimezone option:selected").val();
var timezoneName = $("#ddlTimezone option:selected").attr("timezoneName");
drawChart(timezoneName, offset);
updateSquadgameTime(offset, timezoneName);
});
$ddlTimezone.trigger("change");
});
function updateSquadgameTime(timezoneOffsetMinutes, timezoneName)
{
var squadGameTime = new Date();
for(var i = squadGameTime.getUTCDay(); i != 0; i = squadGameTime.getUTCDay())
squadGameTime.setUTCDate(squadGameTime.getUTCDate() + 1);
squadGameTime.setUTCHours(19 + (timezoneOffsetMinutes / 60));
squadGameTime.setUTCMilliseconds(0);
squadGameTime.setUTCMinutes(0);
squadGameTime.setUTCSeconds(0);
var month=new Array(12);
month[0]="January";
month[1]="February";
month[2]="March";
month[3]="April";
month[4]="May";
month[5]="June";
month[6]="July";
month[7]="August";
month[8]="September";
month[9]="October";
month[10]="November";
month[11]="December";
var squadGameHours = squadGameTime.getUTCHours ( );
var squadGameMonth = month[squadGameTime.getUTCMonth()];
var squadGameDay = squadGameTime.getUTCDate ( );
var squadGameYear = squadGameTime.getUTCFullYear ( );
$("#spanSquadGameTime").html(
squadGameMonth + " " +
squadGameDay + ", " +
squadGameYear + " " + squadGameHours + ":00:00 (" + timezoneName + ")");
}
</script>
</head>
<body>
<!-- BT: Cause the select to be centered. -->
<div style="display: inline-block; text-align: center;">
<div id="chart_div" style="width: 1100px; height: 500px;"></div>
<select id="ddlTimezone" style="font-family: monospace"></select>
</div>
<h3>Next Squad Game Time: <span id="spanSquadGameTime"></span></h3>
<pre>
Special thanks to these contributors:
BackTrak - client side timezone shifting
and all the folks who provided feedback (and convinced me to graph it) on this <a href="http://www.freeallegiance.org/forums/index.php?showtopic=66568">thread</a>
older versions of this program
<a href="http://spathiwa.com/cgi-bin/pp.pl">version 1</a> (only shows 1 week's worth of data)
<a href="http://spathiwa.com/cgi-bin/gpp.pl">version 2</a> (only shows 1 week's worth of data)
<a href="http://spathiwa.com/cgi-bin/spp.pl">version 3</a> (only shows 1 week's worth of data)
<a href="http://spathiwa.com/cgi-bin/mpp.pl">version 4</a> (uses monthly set of data)
</pre>
</body>
</html>

ya the drop down solutions involves an extra "submit" click and also adds user intervention. was thinking automate it and do it all in one page load (or a hidden reload as suggested) and only require user intervention if they want to manually adjust tz (in case it is not detected correctly)
let me give it a whirl and see what you guys think... been busy w/ other work projects
@boe is this a real issue?
let me give it a whirl and see what you guys think... been busy w/ other work projects
@boe is this a real issue?
lol... didnt expect it to be that easy...
http://spathiwa.com/pp/
give it a try guys.. ive only tested it on my own timezone (UTC-7) and Australian (UTC+10)
just go there and see if it picks the right time for you...
also you javascript magicians, can you view source on http://spathiwa.com/pp/index.html and see if i need to fix anything? it's my first javascript and i did it w/ plenty of googling...
here's the index.html
http://spathiwa.com/pp/
give it a try guys.. ive only tested it on my own timezone (UTC-7) and Australian (UTC+10)
just go there and see if it picks the right time for you...
also you javascript magicians, can you view source on http://spathiwa.com/pp/index.html and see if i need to fix anything? it's my first javascript and i did it w/ plenty of googling...
here's the index.html
Code: Select all
<html>
<head>
<script type="text/javascript">
var timezoneOffsetHours = new Date().getTimezoneOffset() / 60;
var url;
if(timezoneOffsetHours > 0){
url = 'http://spathiwa.com/cgi-bin/tz_mpp3.pl?-'+timezoneOffsetHours;
}else{
url = 'http://spathiwa.com/cgi-bin/tz_mpp3.pl?'+Math.abs(timezoneOffsetHours);
}
this.document.location.href = url;
</script>
</html>Only if you want to, you could consolidate:
down to one line.
But what you have works just as well. 
Code: Select all
if(timezoneOffsetHours > 0){
url = 'http://spathiwa.com/cgi-bin/tz_mpp3.pl?-'+timezoneOffsetHours;
}else{
url = 'http://spathiwa.com/cgi-bin/tz_mpp3.pl?'+Math.abs(timezoneOffsetHours);
}Code: Select all
url = 'http://spathiwa.com/cgi-bin/tz_mpp3.pl?'+ (timezoneOffsetHours * -1);










