Knuckle Cracker

Creeper World 3 => DMD Map Discussion => Topic started by: Grauniad on February 16, 2014, 10:54:52 AM

Title: Weekly 5-map tournament - any takers?
Post by: Grauniad on February 16, 2014, 10:54:52 AM
I think I've figured out how a weekly 5-map tournament can be conducted in the DMD. I've always has a fair amount of interest in the CW2 weekly tournament. And maybe Mopa42 can write the necessary interface for CW3?

The compiler for the week generates 5 DMD maps, name them according to the theme and play them. ALternatively, (s)he can take maps from the current inventory if they already fit the theme. Then all players have the week to improve their scores.
Title: Re: Weekly 5-map tournament - any takers?
Post by: Helper on February 16, 2014, 11:53:45 AM
I'm going to hate myself in the morning, but count me in.
That CW2 tourney was a lot of fun - but time-consuming and addictive.
Title: Re: Weekly 5-map tournament - any takers?
Post by: Wheatmidge on February 16, 2014, 01:34:09 PM
Hmmm, count me in too... Probably.

It is a fun way to encourage random map playing.

I still have not actually made any DMD maps. So I'll have to play around with that for a while the first time I get to make a tournament.
Title: Re: Weekly 5-map tournament - any takers?
Post by: MizInIA on February 25, 2014, 03:30:18 PM
count me in
Title: Re: Weekly 5-map tournament - any takers?
Post by: asmussen on April 15, 2014, 05:12:52 PM
So, I was thinking about taking a stab at building a tool similar to mopa42's CW2 tournament tool, but I'm not sure how to go about pulling scores for CW3 maps. For CW1 and CW2, there is a web interface for viewing player scores that can be leveraged by such a tool, but as far as I can tell CW3 has no equivalent service. Presumably this is because of the ways that scores can be viewed within the CW3 application itself, but it makes it more difficult to write a utility that would need to access the map scores. Would it be possible for whatever method the CW3 application uses to pull scores from the knucklecracker website to be shared with us?
Title: Re: Weekly 5-map tournament - any takers?
Post by: deety42 on April 25, 2014, 08:57:03 PM
I so miss the weekly games.  I'd love to be in.  I also haven't tried generating any DMDs, but I could give it a try on the off chance I win!
Title: Re: Weekly 5-map tournament - any takers?
Post by: miquelfire on April 28, 2014, 09:56:16 AM
Someone who need to reverse engineer what the game does to talk to the server to get the scores.

I'm not aware of anyone on the forums with the skill and time to do such a thing. (I'm not sure if I have the skill or tools, but I know I don't have the time even if I did)
Title: Re: Weekly 5-map tournament - any takers?
Post by: asmussen on April 28, 2014, 10:50:59 AM
Quote from: miquelfire on April 28, 2014, 09:56:16 AM
Someone who need to reverse engineer what the game does to talk to the server to get the scores.

I'm not aware of anyone on the forums with the skill and time to do such a thing. (I'm not sure if I have the skill or tools, but I know I don't have the time even if I did)

Well, I looked at it it a little bit, and it looks like getting the scores for a particular map isn't too difficult, provided you have the gameUID of the map that you want. There is a php script that the game appears to call named scoreQuery.php which looks pretty straightforward from the packet trace I was looking at. However, getting the list of games (Which is where I assume you'd map the map names to the gameUID values) looks to be a bit trickier. There is a queryMaps.php that looks to be used for that, but the data being returned from that appears to be binary data. Possibly encrypted or compressed. If it's just compression, and I can identify the type of compression being used, that might be enough to get where I need to be at, but I haven't had enough time to continue my analysis, as I've been busy getting settled into a new job that I started last week. I was hoping that Virgil might just tell us how to use the score listing utilities, but in the absence of that, I think there is still a decent chance that we can work it out given time.
Title: Re: Weekly 5-map tournament - any takers?
Post by: knucracker on April 28, 2014, 03:34:38 PM
I've just extended the scoreQuery.php service to take a map # for either a custom map or a dmd map.

Examples:
http://knucklecracker.com/creeperworld3/scoreQuery.php?customID=1
http://knucklecracker.com/creeperworld3/scoreQuery.php?dmdID=1

This allows you to skip knowing the guid for a map and just work off of the much easier to manage map number.

The data returned is XML and the format is obvious.  Note that with a little bit of creativity somebody could create a score viewer or a 5 map score viewer all in javascript so it runs in browsers directly.  Here's a proof on concept slapped together from google seach results copy pasted together:


<html>
<body>

<script>
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 
xmlhttp.open("GET","http://knucklecracker.com/creeperworld3/scoreQuery.php?dmdID=1",false);
xmlhttp.send();
xmlDoc=textToXML(xmlhttp.responseText);


document.write("<table border='1'>");
var x=xmlDoc.getElementsByTagName("record");
for (i=0;i<x.length;i++)
  {
  document.write("<tr><td>");
  document.write(i+1);
  document.write("</td><td>");
  document.write(x[i].getElementsByTagName("user")[0].childNodes[0].nodeValue);
  document.write("</td><td>");
  document.write(x[i].getElementsByTagName("score")[0].childNodes[0].nodeValue);
  document.write("</td><td>");
  document.write(x[i].getElementsByTagName("time")[0].childNodes[0].nodeValue);
  document.write("</td></tr>");
  }
document.write("</table>");


function textToXML ( text ) {
      try {
        var xml = null;

        if ( window.DOMParser ) {

          var parser = new DOMParser();
          xml = parser.parseFromString( text, "text/xml" );

          var found = xml.getElementsByTagName( "parsererror" );

          if ( !found || !found.length || !found[ 0 ].childNodes.length ) {
            return xml;
          }

          return null;
        } else {

          xml = new ActiveXObject( "Microsoft.XMLDOM" );

          xml.async = false;
          xml.loadXML( text );

          return xml;
        }
      } catch ( e ) {
        // suppress
      }
    }
</script>

</body>
</html>

Title: Re: Weekly 5-map tournament - any takers?
Post by: kwinse on April 28, 2014, 05:16:11 PM
QuoteXMLHttpRequest cannot load http://knucklecracker.com/creeperworld3/scoreQuery.php?dmdID=1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

Ah, cross-domain security (no, running the same file off my dropbox (http://dl.dropboxusercontent.com/u/73817062/programming/CW3/dmdtest.html) instead of localhost doesn't fix it).
Title: Re: Weekly 5-map tournament - any takers?
Post by: knucracker on April 28, 2014, 07:30:26 PM
Try it again now...
Title: Re: Weekly 5-map tournament - any takers?
Post by: kwinse on April 28, 2014, 08:12:15 PM
Yeah, working now, thanks! And heck, I can probably pull together something with html and javascript if I know what all features you want.
Title: Re: Weekly 5-map tournament - any takers?
Post by: planetfall on April 28, 2014, 08:57:13 PM
If you do start this, I only ask that you don't use any maps bigger than, say, 200x200, to be merciful to those with slower machines who still want to participate (me...)
Title: Re: Weekly 5-map tournament - any takers?
Post by: asmussen on April 29, 2014, 01:18:38 AM
Thanks, Virgil! That should make things a lot easier. Maybe I'll have some time this weekend to do something with that, assuming that somebody else hasn't already come up with something by then.
Title: Re: Weekly 5-map tournament - any takers?
Post by: kwinse on April 29, 2014, 02:09:11 PM
dmd.html (http://dl.dropboxusercontent.com/u/73817062/CW3/dmd.html)

Got a basic viewer for up to 5 maps. Note it caches each map's output html for subsequent look ups, so if you look up a map with this, then post a score, you have to refresh the page (or clear that cache) in order to get the updated scores from that map.

It also supports for a url parameter "?maps=[comma separated list of map numbers]" to pre-fill the inputs:

dmd.html?maps=10,9,20,5a (http://dl.dropboxusercontent.com/u/73817062/CW3/dmd.html?maps=10,9,20,5a) (Yes that is intentionally a case of not-a-number)

I can definitely do more advanced stuff with this if people want.
Title: Re: Weekly 5-map tournament - any takers?
Post by: Karsten75 on April 29, 2014, 02:22:36 PM
Awesome. Look at the CW2 game and the table there. It would be col if you could make an export file  that can be copy/pasted into the forum to conform. :)
Title: Re: Weekly 5-map tournament - any takers?
Post by: kwinse on May 02, 2014, 01:21:00 AM
dmd.html (http://dl.dropboxusercontent.com/u/73817062/CW3/dmd.html)

Okay thousands of requests to the server later I got something more to show.

-Added a player totals table, ranked by number of maps, then score. It should in theory handle rank ties correctly too. Times are only displayed in the totals table as tooltips on the scores and aren't summed but I could change that if wanted.
-Added a blacklist by player name, entered through an input (separated by newlines), by checkbox on the total table, or in the url like the maps (e.g. dmd.html?maps=10,9,20,5a&bl=teknotiss,Grauniad (http://dl.dropboxusercontent.com/u/73817062/CW3/dmd.html?maps=10,9,20,5a&bl=teknotiss,Grauniad)) (dunno if commas, ampersands, or equals signs are allowed in names ingame but I know they could and would interfere with parsing the url)
-Export totals table, for the forums or wiki. Doesn't have the coloring options that mopa42's program had, but I can add them if they're wanted. Note: do have to copy yourself because of security but it does auto-select after export. Example:
Spoiler
Rankings for DMD maps #6, 7

#NameScore 6Score 7Total
1MadMag6515559012105
2tomiz481838508668
3purpleyukari59585958
4Folacin54075407
5teknotiss48644864
6BinkyRider45744574
7Toyoch35163516
8The Mole32663266
[close]
-Pressing enter while on a map id input should fetch scores.

I removed most of the caching, mainly so that the time you grab the scores is guaranteed to be about the same. This was intended to be for a timestamp feature like you see on mopa42's exports but I got confused trying to convince the Date object to consistently convert to the forum's timezone. The only caching left should be something that stops you from fetching the exact same set of maps within a minute.

Totally not sold on the colors or page layout. I'm not so good at stuff like so if you have specific suggestions I'm all ears.

Virgil, if you're still reading this topic, how would I get scores by time like you can ingame?
Title: Re: Weekly 5-map tournament - any takers?
Post by: kwinse on June 14, 2014, 08:24:16 PM
dmd.html (http://dl.dropboxusercontent.com/u/73817062/CW3/dmd.html)

Because I can't leave well enough alone, I've gone and rewritten most of the code. Mostly internal changes to use libraries and to make the xml requests asynchronous, though I did figure out coloring per-map scores and the timestamp* in the exports.

Let me know if anything's broken/missing (besides the time range, I still don't know how (if I can)).

*I hope it's right anyway, timezones are confusing. >_>

Spoiler
Rankings for DMD maps #6, 7

#NameScore 6Score 7Total
1MadMag6515559012105
2tomiz481838508668
3purpleyukari59585958
4Folacin54075407
5teknotiss48644864
6BinkyRider45744574
7Toyoch35163516
8The Mole32663266
Scores retrieved at 18:58:07 14 June 2014 +05:00
[close]

EDIT: Watched the network requests on the CW2 scores and got the time filter working for this.
Title: Re: Weekly 5-map tournament - any takers?
Post by: Helper on June 20, 2014, 12:59:03 PM
@kwinse,
Looks as though you've done some nice work, so what's the next step?
Title: Re: Weekly 5-map tournament - any takers?
Post by: Wheatmidge on July 01, 2014, 01:46:22 PM
I think it would be great if we could get some new people interested in this. Has anyone tried mentioning it on Steam forums? I actually haven't played much creeper world in the last while but the weekly tournaments are always a blast.
Title: Re: Weekly 5-map tournament - any takers?
Post by: stewbasic on July 01, 2014, 07:58:22 PM
I've been tempted to express interest in this but not sure if I can commit the time... would it be considered bad form to only participate some weeks?
Title: Re: Weekly 5-map tournament - any takers?
Post by: Wheatmidge on July 03, 2014, 11:54:23 PM
Quote from: stewbasic on July 01, 2014, 07:58:22 PM
I've been tempted to express interest in this but not sure if I can commit the time... would it be considered bad form to only participate some weeks?


No at all. I think the only rule was that the winner of each week selects the maps for the next week. There is no obligation to play all the time.
Title: Re: Weekly 5-map tournament - any takers?
Post by: Flabort on July 04, 2014, 04:00:21 PM
Quote from: kwinse on June 14, 2014, 08:24:16 PM
Let me know if anything's broken/missing
Well, it's not something broken or missing, but more of a feature request. Can you make a second version that pulls scores from CS maps?
I want to include a link in my signature that contains all my maps so far (or my most recent ones if I have more than it can handle) top ten scores plus my own.

Since it's unlikely I'll ever have a top ten score in my own maps :P
Title: Re: Weekly 5-map tournament - any takers?
Post by: kwinse on July 05, 2014, 12:22:13 PM
Ironed out over PM (http://knucklecracker.com/forums/index.php?topic=16650.0), if you hadn't noticed Flabort's sig yet. ;)
Title: Re: Weekly 5-map tournament - any takers?
Post by: ctuna on July 11, 2014, 04:24:15 PM
Count me in, at least at first. Though selecting the next week's maps and posting the matrix and results was a real chore for a dinosaur like me. I'd guess from the low scores I see about the system compared to my own, that "low score" ship has sailed.
Title: Re: Weekly 5-map tournament - any takers?
Post by: Flash1225 on July 12, 2014, 09:34:47 PM
I'm in, for sure. Tried some of the CW2 1-week 5-maps tournaments, but those are hard, some of them. I'll be back to make a list for the first one.
Title: Re: Weekly 5-map tournament - any takers?
Post by: MizInIA on July 18, 2014, 03:34:39 PM
Quote from: Wheatmidge on July 03, 2014, 11:54:23 PM
Quote from: stewbasic on July 01, 2014, 07:58:22 PM
I've been tempted to express interest in this but not sure if I can commit the time... would it be considered bad form to only participate some weeks?


No at all. I think the only rule was that the winner of each week selects the maps for the next week. There is no obligation to play all the time.
lots of people would participate in the CW2 tournament and only do a couple of the maps. maybe it was because of time, maybe they just weren't interested in winning and having the responsibility of setting up the next tournament or maybe some of the maps just didn't interest them, only they know for sure