AGSM v1.0 (The Allegiance Game Stats Merger)
Posted by Cort, Sep 25 2015, 06:36 PM in Tools
Cort's Constructs presents AGSM v1.0, the AllegGameStatsMerger.
Note: AGSM has already received some updates, but the link to the latest version has been edited into this post.
Overview
AGSM can take stats screenshots you made from within Allegiance (using the 'PrntScr' button on the stats page) and merge them into one complete image.
Allegiance currently doesn't allow you to export game stats. What you can do is take screenshots of the stats pages. Unfortunately, only twelve players will be shown per screenshot. But if you want to post the stats of a game on the forum, you'll want to include all players.
The usual way the community handles this is to take screenshots of all the pages, then merge them manually in some raster image editor. AGSM automates the last of these steps. It will *not* help you take the actual screenshots, it can just combine them to one image.
If you follow some simple rules, you'll end up with pretty clean images, looking like this:
Usage
AGSM is designed for taking as much work from you as possible. So almost everything is automated.
That means, AGSM will automatically try to find 'clusters' in your screenshots. It will analyse when you took those screenshots and will group all those together taken in short intervals.
It will also analyse and reorder them depending on the position of the scrollbar included in the screenshots. Therefore, it doesn't matter in which order you take them. You can go upside down or downside up or even jump around like crazy, it doesn't matter.
The screenshots can also overlap. You can take them using page scrolling (clicking the scrollbar above or below the 'thumb'), but you'll get better results if you create them with a bit of overlap. The overlapping parts with automatically be removed.
Let's have a look at a screenshot of the GUI and talk about the controls and what they do.
- Here you can select the source directory, i.e. the directory your screenshots are in. The Allegiance directory should be entered there by default, so there's normally nothing to do.
- The 'screenshot timeframe' determines how your screenshots are grouped into clusters. Two screenshots will be considered as being in different clusters if the first screenshot of one cluster has been taken more than the amount of seconds you enter here after the last screenshot of the previous cluster. Another way to look at it would be that if you put 60s here, you'll have to wait 60s after taking one set of screenshots before you start the next. In general, this value should do fine and there shouldn't be any need to adjust it.
- Click the 'Process' button to start the processing. This will fill the list box marked with (4). (It's empty when you start the application.) Click it again to abort it.
- You'll get a list of the detected clusters and when you started to take them. Pay attention to those being marked with '[WARNINGS]', something went wrong there. Those having '[FAILED]' can't be saved. (Probably because it's not a cluster of stats screenshots.) Select a cluster here to see the merged image in (5).
- You can see the final image here. Make sure no player is missing.
- The log will tell you everything the application has done to merge the screenshots together. Pay attention to lines like 'merging failed' or 'file discarded' (but those also generate warnings in the cluster list).
- The application will suggest to save the file in the directory your screenshots came from and will suggest a filename based on the time the screenshots were taken. This filename is also 'URL-compatible', i.e. you can upload the file and link it without having to do any escaping of special characters. Nevertheless, you can change it if you want.
- Click on 'Save' to write the image you saw in (5) to the disk.
Usage summary
Launch the application, click on 'Process', select cluster, click on 'Save', upload file and post.
Limitations
- Screenshots using Slipstream GUI are not supported.
- Whether there are general problems with merging, only your tests will tell. I couldn't produce any with my screenshotsβ¦
- Processing is rather fast, but might take some memory. I have a maximum memory usage of 75MB for a short time with about 90 screenshots in my directory. It completely depends on how many of those have to be merged and how many are actually stats screenshots, so YMMV. But yeah, optimisations would most probably be possible.
Tips for getting best results
- You can use page scrolling (clicking the scrollbar above or below the 'thumb'), but you'll end up with the white lines following the first player of a page then. You'll get better results if you scroll with some overlap, e.g. by taking a screenshot every half page.
- Make sure you move the mouse cursor away from the stats region and also don't have it hovered over the scrollbar. Just flick your mouse so the cursor moves to some corner of the screen, then press the button.
- Don't have a line in the stats selected. If you accidentally did select one, just switch to the game lobby and back to the stats and it will disappear.
- Don't change the sorting order while taking your set of screenshots (duh).
- Screenshot in fullscreen mode. (I actually haven't tested what happens when you screenshot in windowed mode.)
Reporting bugs
When you're reporting bugs or incorrect merge results, PLEASE also upload/e-mail me the files you tried to process (no worries, BMPs are compressed to tiny archives, even when using a crappy format like ZIP, and I can uncompress pretty much anything) and the shown log. If I can't reproduce it, your report is pretty worthless.

Download
Download: AGSM v1.11 installer [Release Notes]
(Access to the source code repository on request.)
Upgrades
Whether I'll proceed working on this depends on whether there's actually any interest in using it. An excerpt from my to-do list:
GUI:
define minimum size for window
change mouse cursor to hourglass while processing?
second colon in output filename leads to weird bug
replace the ugly file/dir pickers with editbox+icon
double-buffering / get rid of preview flickering
save GUI window size/position
Processing:
do some profiling on the actual merging process and optimise progress bar
free cropped images asap / reduce memory usage
add button to open merged image in image editor
optionally delete merged images
Error handling/reporting:
catch&log any unexpected exceptions occuring during merging
show proper error message for unexpected exceptions from the GUI
log exceptions from processing or GUI and allow them to be automatically submitted
implement 'check for updates'
optimise process of creating empty preview imagebox (or get rid of imagebox and use wxDC, f.e.)
Meta:
Installer: optionally create desktop/quicklaunch shortcut (see Components/Tasks pages), run application at the end when installation is finished
Final remark: Yes, indeed, it would have made more sense to just add f.e. CSV support to the Alleg client. But this was a lot more fun and I learned more from it.

-- Cort
[EDIT 2007-09-30: Updated post to v1.1 (screenshots unmodified)]
[EDIT 2007-12-03: Updated post to v1.11 (screenshots unmodified)]
Comments
Aaron Moore, Sep 26 2007, 02:10 AM
I was wondering how you did that.
Thanks for sharing, this is very cool.

madpeople, Sep 26 2007, 05:45 AM
psst! cut off the scroll bar in the final image

(if you wanted to be clever, you could try cutting off the scrollbar, but keeping the rounded edges (ok, you just need to cut off the bar, then add on a separate edge image on top..)
ImmortalZ, Sep 26 2007, 01:44 PM

Last I hear, aarm is jumping around in glee due to this util saving him 30 mins of pain after SGs.
Your_Persona, Sep 28 2007, 03:01 AM
Here is after 1.5 evenings of work.

There is a little bug in the OCR as far as the points column is concerned. Nothing very hard to fix, it just misses the '1's if they are 1st or 2nd char.
I have also not yet implemented the alphabetic part for reading the player name. Maybe another evening for this.
If you are interested in this at all, then I can give you a SVN repo for the library.
It's also getting quite fast. That is what I've been spending the most time on recently.
madpeople, Sep 28 2007, 06:35 AM
yeah, i thought about the black bits, but they could be a little trickier to do i thought...
and i did notice it was 600px wide, so i was slightly confused by the statement of it supposed to be 612vs the image posted, wasn't sure if the one you posted you had edited to make 600 px wide so it looked nicein the post, or if you had fixed it to make them 600 wide, but not changed the 612 statement
Your_Persona, Sep 28 2007, 10:44 PM
I sent you your password, for commit permissions.
Anon has read only permissions.
on AGSM v1.0 (The Allegiance Game Stats Merger)