Weekly 5-map tournament - any takers?

Started by Grauniad, February 16, 2014, 10:54:52 AM

Previous topic - Next topic

Grauniad

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.
A goodnight to all and to all a good night - Goodnight Moon

Helper

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.

Wheatmidge

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.

MizInIA


asmussen

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?
Shawn Asmussen

deety42

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!

miquelfire

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)

asmussen

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.
Shawn Asmussen

knucracker

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>


kwinse

#9
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 instead of localhost doesn't fix it).

knucracker


kwinse

Yeah, working now, thanks! And heck, I can probably pull together something with html and javascript if I know what all features you want.

planetfall

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...)
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.

asmussen

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.
Shawn Asmussen

kwinse

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 (Yes that is intentionally a case of not-a-number)

I can definitely do more advanced stuff with this if people want.