Pitboss WebStats Proof of Concept - Curious About Interest

What do you think?

  • I am interested in this and have my own PHP/MySQL server that I would run this on.

    Votes: 16 47.1%
  • I am interested, but I do not have a webserver. I would like to use a public site to display stats.

    Votes: 17 50.0%
  • I like the idea, but I wouldn't use it.

    Votes: 1 2.9%
  • I don't like the idea.

    Votes: 0 0.0%

  • Total voters
    34
Status
Not open for further replies.

OverloadUT

Stats Monkey
Joined
Nov 9, 2005
Messages
352
Location
Novato, CA
I have spent the last several days working on a project I am calling "Pitboss WebStats" and I finally have a proof of concept I can show off.

Click here to see

What you're seeing is the current state of the Pitboss game I'm playing in, accurate to the last 30 seconds. If someone logs in, logs out, converts to an AI, finishes their turn, etc. it's all logged and viewable on that page. There are also two RSS feeds available on that page. If you're running Firefox, you should see the familiar RSS logo in the address bar. Go ahead and add those feeds to your Bookmarks to see how they work. One is a display of who has and hasn't finished the current turn (thanks to The Obb for the idea) and the second feed is simply a feed of the game log.

The core part of this is accomplished by a pair of scripts:
The first half is an application (the "Uploader") that runs on my Pitboss server machine. It monitors the Pitboss admin window and whenever it sees a change, it uploads the data to my webserver.
The second half is a set of php scripts connected to a MySQL database that can receive the data from the Uploader and store it in the database.

And then of course there are the php scripts that display the pages (the RSS feeds and the page linked above.)

I have several plans for making this better:
  • Of course a better layout and looks nice.
  • Individual player stats. You should be able to tell when the last time each player logged in, how many turns a player has missed, etc.
  • Score Graphs?
  • Maybe the ability to auto-kick someone out of the game if they miss too many turns in a row. I currently do this manually in our game.
  • I'm open to ideas!

One big thing I am contemplating is allowing anybody to use my webserver to display their pitboss game stats. The whole thing is already designed to be able to handle multiple games at once; that works right now in fact. I would probably register a domain like civpitboss.com (any better ideas?) to make it easy for pitboss hosts to have a place that shows their game stats. I would do this if there is a big interest in this program, but not a big interest in setting it up on your own server.

My question to you, the pitboss server hosts: are you interested in this kind of thing? Do you have a php/mysql webserver that you would install the php script on, or would you rather have a public site that you could use to display your Pitboss WebStats?
 
OMG I would kill for such impressive web-based functionality. I've got MySQL/PHP running on my server already. Are you releasing an early version of this? I would love to get hold of it if you are. This is awesome!
 
Well, I'm a little disappointed by the small number of replies, but oh well.

If you check out the link above again, you'll see that I added a much nicer looking layout complete with a "live" turn timer. I'm working now on player-specific stats, although I'm not sure exactly what I am going to put on that page. Right now I'm thinking "Last Time Logged In" "Total Turns Missed" and a filtered game log that only shows events related to that player.

There is also a new third RSS feed available that gives you a list of the players in the game sorted by score, with the familiar asterisk representing that they have finished their current turn.

portuga: Tell your Pitboss host to check this thread! ;)

sometemple: I plan on releasing the .exe portion of this pretty soon, and ask that people try to have it upload to my server to see if it works. Right now I have no idea if the uploader will always work. I have tried to anticipate different configurations (like not having a turn timer) but I might have missed some. I know I don't support "non-simultaneus" Pitboss games but I don't plan on it because I think simultaneus turns is what Pitboss is all about!

The PHP portion is a bit harder to release, due partly to the fact that I'm not a great PHP scripter and the code is a little messy (although I've done by best to keep it portable) and then of course there's the fact that my database structure is changing constantly, so whatever script I release to create the tables will be obsolete the next release. I'd like to have the feature list more complete before I release this portion.



I have thought of some more ideas for the whole thing in general:
Players should be able to create a simple "account" on the webpage and then "join" a pitboss game using a password that the admin set up. This would enable making a pitboss stats page private to players.
I am going to implement an email turn notifier in to the script and stop using Scree's stand alone turn notifier. The reason for this is I now have the ability to do some interesting things in the email. It could send the updated score list, for example, or maybe it could warn specific players that they missed their last turn.
 
I was very disappointed in the lack of response as well, but I would argue that once a release has been made and folks start talking about it demand will be overwhelmingly in your favor.

As a pitboss host I take for granted that no one else has the turn status in front of them 24/7. The email notification was a huge step up but not everyone checks their email religiously. I can only imagine that your utility will increase the number of turns played every day, as it gives them one more (and that's a really impressive one more) way to keep posted.
 
i haven't hosted a game before, but this is something i'd thought of, i'm glad to see it's already been developed! the new screenie looks much better than the original plain text too.
 
Ooh I wish I'd seen this thread earlier. Great work!

Once you add in the email notification this will do what my modified turn notifier does and a hell of a lot more, so I'd probably use your application rather than mine and will recommend that others do the same (I take little pride in my work :lol:). I would suggest adding the time remaining on the game clock to the 'who has and who hasn't finished their turn' feed, which is something I'd like to do for my program.

One question: how did you extract the game clock from the window? For instance, to get the players out of the game window, I use this C# code (which Scree wrote but I use in my part of the program):
Code:
motdHandle = FindWindowEx(pitBossHandle,System.IntPtr.Zero,"Edit",null);

I figure I have to replace "Edit" with something else... do you know what string I need? I have no idea how to find the names of the panels.

Do you have a php/mysql webserver that you would install the php script on, or would you rather have a public site that you could use to display your Pitboss WebStats?

I have a webserver but would need to set it up for php/mysql. A public site would be nice though :), you may want to talk to whoever runs CivFanatics about hosting it somewhere on this site.

Here's an idea you might consider: allow players to send messages to each other via the page, and players would be notified that they have a message waiting in the RSS feed. For example, player A sends a message to player B. The next time player B checks any of the RSS feeds, there's a line down the bottom saying '1 message unread', which they can read on the webpage. Messages could optionally be sent to the whole team or everyone in the game. It might not be worth doing though since it assumes the recipient actually uses and checks the RSS feed, which they may not.

This would require custom feeds for each player though. It might be easier just to make it so it has '1 message for player B' in a global feed, or perhaps just a number in brackets next to their name so you wouldn't need to add any new lines.

I can program in PHP but haven't done so in a while (since 3rd year compsci), feel free to message me if you want me to do any of the programming.
 
the oob said:
I would suggest adding the time remaining on the game clock to the 'who has and who hasn't finished their turn' feed, which is something I'd like to do for my program.
Done! At first I was showing the "time until turn over" timer, but that didn't work out so well because it could be pretty far off (depending on when your aggregator pulled the RSS feed) so I changed it to show the time that the turn will be over. It presents it in a nice human-readable format too. If it's today, it just says the time, if it's tomorrow is says "tomorrow at xx:xx", if it's later this week, it says something like "Saturday at xx:xx" - all in all I think it's pretty spiffy. :)

the obb said:
I figure I have to replace "Edit" with something else... do you know what string I need? I have no idea how to find the names of the panels.
Ah, yes the control names. They're a little annoying. I'm actually surprised "edit" pulls the MOTD, because that field is actually called "edit1". At least... for me. I'm using AutoIt for my application and it has a stand alone utility that lets you see the control names in any window. I honestly don't know how Windows controls work so it could be that AutoIt is actually just assigning its own names to the controls and C# is doing the same, slightly differently. I find that unlikely though. More likely is that when you search for "edit" in C#, it finds the first match, which is the "edit1" control. But these are just guesses.

I still haven't answered your question. The turn timer is "Static2" - however, if there is no turn timer at all, "Static2" is "Who" (player 1's "Who" label) - so I check to see if "Static2" is "Who" and if it isn't, I know it's the turn timer. For your reference, here are some of the comments in my code that tell you what the control names are for different parts of the admin window:
Code:
;Button1 = "Player 1"
;Button3 = "Player 2"
;Button5 = "Player 3"
;If there is a turn timer, the following are all increased by 1
;Static3 = Player 1's name
;Static9 = Player 2's name
;Static15 = Player 3's name
;Static7 = Player 1's score
;Static13 = Player 2's score
;Static19 = Player 3's score
;Static5 = Player 1's score
;Static11 = Player 2's score
;Static17 = Player 3's score


the obb said:
Here's an idea you might consider: allow players to send messages to each other via the page, and players would be notified that they have a message waiting in the RSS feed. For example, player A sends a message to player B. The next time player B checks any of the RSS feeds, there's a line down the bottom saying '1 message unread', which they can read on the webpage. Messages could optionally be sent to the whole team or everyone in the game. It might not be worth doing though since it assumes the recipient actually uses and checks the RSS feed, which they may not.
I actually added player messaging to my design doc. My plan for this thing has really exploded! Seeing if you have new messages through the RSS feed is an interesting idea; I think I might implement that. A custom feed for each player wouldn't be too hard to do. I could have the page not even offer RSS feeds unless you're logged in (you most likely wouldn't want a feed unless you're actually a player in the game anyway, and if you are a player, you should be logged in!)
 
Do I sense a partnership forming? This project seems to be getting bigger by the second! Any idea when we might see a beta release?

Keep up the great work, and let me know if anybody needs anything.
 
I still haven't answered your question. The turn timer is "Static2" - however, if there is no turn timer at all, "Static2" is "Who" (player 1's "Who" label) - so I check to see if "Static2" is "Who" and if it isn't, I know it's the turn timer.

For some reason I'm getting the current time when I use Static2 (or StaticX where X is any number) rather than the game clock.
 
Don't be concerned about the lack of responses - for my part I think it's a great idea. I already use the_oob's (scree's modified) turn notifier (many thanks to the both of you), and installed a web server on the same machine that hosts the game just to host the feeds. Then I found a PHP script to convert the feeds into HTML so that players who don't use RSS can still see who's played without logging in (and using up my upload bandwidth in the process).
Overload - I've been waiting for someone to create something like this (I figured it was inevitable). It's a fantastic idea and will make Pitboss games all the more user-friendly. I don't expect many people will use it though unless you/civfanatics make it available on a public site (option 2) and make a very user-friendly frontend - although I'm keen to use it either way since I've already set up a web server.
If there's anything I can help with (eg. upload my game stats to your server when you release the .exe like you've mentioned) I'll be sure to get involved.
One thing I am curious about though - how accurate is the estimate of when the current turn is due to end? I've noticed that my clock runs slow (likely a symptom of hosting on an older machine) - I assume that in situations like that the accuracy of the "new turn at xxx" will be somewhat... well, inaccurate?
Anyway, keep up the great work.
 
This looks great - also reminds me of the UT stats page, which from your name is where I guess you got the idea of the layout from ;)

I'll give this a go on my server.
 
OverloadUT said:
sometemple: I plan on releasing the .exe portion of this pretty soon, and ask that people try to have it upload to my server to see if it works. Right now I have no idea if the uploader will always work. I have tried to anticipate different configurations (like not having a turn timer) but I might have missed some. I know I don't support "non-simultaneus" Pitboss games but I don't plan on it because I think simultaneus turns is what Pitboss is all about!

Count me in! This looks like a great utility!

Also, I wouldn't worry so much about the lack of quick responses to this topic. The MP forum isn't as well trafficked as some of the other ones at CivFanatics.

BTW, is this 1.61 only? I'm still running 1.52 on my PB server.

Bernout
 
the oob said:
For some reason I'm getting the current time when I use Static2 (or StaticX where X is any number) rather than the game clock.
Hmm, I guess AutoIt uses its own names for the controls... You have some more arguments in that function call though - have you tried changing the "System.IntPtr.Zero" value to something else?

Kobald said:
One thing I am curious about though - how accurate is the estimate of when the current turn is due to end? I've noticed that my clock runs slow (likely a symptom of hosting on an older machine) - I assume that in situations like that the accuracy of the "new turn at xxx" will be somewhat... well, inaccurate?
Anyway, keep up the great work.
That's not unique to your machine. I'm hosting on a pretty good server and my "24 hour" turn timer ends up being about 24.7 hours. The uploader re-uploads the time remaining at least once every 15 minutes to try to keep that web version up to date, but the "New turn at xxx" indicator does indeed change. For example, my page says 10:20 right now, but when the turn ended last night, it said it would be at 10:04. I'm not sure what I can do about this. Computers are supposed to know how long a second is!

Keith_C said:
This looks great - also reminds me of the UT stats page, which from your name is where I guess you got the idea of the layout from ;)
I've been found out! I was actually semi-heavily involved in the development of UTStatsDB. I developed OLStats, a mod to UT2004 that greatly improved the built in stat logging as well as allowed you to output fully featured HTML files without even needing a PHP/MySQL server. It's one of my favorite creations. :) Can anyone tell that I'm a stats weenie?

Bernout1 said:
BTW, is this 1.61 only? I'm still running 1.52 on my PB server.
I can't imagine why it wouldn't work on version 1.52, as the interface didn't change at all, I believe. Or did it? Actually, I'm starting to think that 1.52 didn't have a "Finished Turn" indicator in the admin panel, but I can't remember for sure. If it is indeed missing that feature then it wouldn't work very well, as knowing who needs to play their turn I think is the most useful part of this...
 
OverloadUT said:
I've been found out! I was actually semi-heavily involved in the development of UTStatsDB. I developed OLStats, a mod to UT2004 that greatly improved the built in stat logging as well as allowed you to output fully featured HTML files without even needing a PHP/MySQL server. It's one of my favorite creations. :) Can anyone tell that I'm a stats weenie?

AHh - I thought I recognised your name, but couldn't place it! Keep meaning to run your stats on my server (Titan 32p ONS) but just never seem to get time. Not with Civ 4 in my life anyway ;) Top work on more stats packages though - I like the look of this Civ one!
 
OverloadUT said:
Hmm, I guess AutoIt uses its own names for the controls... You have some more arguments in that function call though - have you tried changing the "System.IntPtr.Zero" value to something else?

Ehh at this point I may as well just wait for you to finish your program and switch to it than bother updating mine... no sense in 'reinventing the wheel'.

OverloadUT said:
For example, my page says 10:20 right now, but when the turn ended last night, it said it would be at 10:04. I'm not sure what I can do about this.

You could simply put an asterix next to the timer display, and then down the bottom have:
* Turn may take longer than displayed due to bla bla bla
 
OverloadUT said:
I can't imagine why it wouldn't work on version 1.52, as the interface didn't change at all, I believe. Or did it? Actually, I'm starting to think that 1.52 didn't have a "Finished Turn" indicator in the admin panel, but I can't remember for sure. If it is indeed missing that feature then it wouldn't work very well, as knowing who needs to play their turn I think is the most useful part of this...

Ya, unfortunately it doesn't have the finished turn indication. Guess I'll have to wait until this game is finished and I start up a 1.61 server. Keep up the good work though! :D

Bernout
 
Beta Uploader Released!

I am releasing the current beta version of the uploader program, so people can try it out and make sure it works for everyone. :)

Pitboss WebStats Uploader version 0.7.0.2

Unrar that in to its own directory anywhere on your computer. It will create several files that it uses, so don't just throw it on your desktop or something.

  • Run it and select a profile (default is fine, or you can rename it if you like; it makes no difference.)
  • The "Game Name" must match your game name exactly - it uses this to find the Pitboss window by its title.
  • For the script location, enter this: http://www.apartment167.com/pitboss/pbupload.php
  • For the Upload Username/Password, enter anything you want. If the username already exists, the uploads won't work, so pick something unique. The password is just to make sure people can't upload fake stats to your game. After you upload for the first time, your password is locked to that forever. (This will be quite different once I make the whole account creation system on the website.) If you want to have stats for more than one pitboss game, you must supply a different user/pass for each one otherwise your stats will get really messed up.
  • Now click Start Watching! If all goes well, you will see the status text change to "Successful Upload" in a few seconds. If it says anything else, tell me!

Once the uploader is going, you can view your game stats by going to the WebStats main page and finding your game in the short list.

I sure hope this works!
 
Works for me :) I changed the update frequency from 10 seconds to 60 seconds though, I calculate it would use about 1.5 gigs of bandwidth a month if left as the default.

One suggestion: label what time zone the 'new turn at such and such time' is for, or (preferably) allow people to pick their own time zone.
 
the oob said:
Works for me :) I changed the update frequency from 10 seconds to 60 seconds though, I calculate it would use about 1.5 gigs of bandwidth a month if left as the default.

One suggestion: label what time zone the 'new turn at such and such time' is for, or (preferably) allow people to pick their own time zone.

I actually thought I changed the CheckInterval to 60 seconds in the code, but turns out I just changed it on my own .ini file. Oops! However, that just tells it how often to check for changes - it will only actually upload data if anything changes, so it shouldn't use too much bandwidth.

About the time zone thing: I do plan on implementing the ability to adjust the times displayed to the user's local timezone, once I get the account creation thing going. I'm not exactly sure how to do this, but I'm sure there are tons of examples of how to do it on the web.
 
Status
Not open for further replies.
Back
Top Bottom