Weekly Map Scorer Program

Started by mopa42, July 19, 2011, 04:53:29 PM

Previous topic - Next topic

DarthVader12

Great tool. This will help the tournaments so much. If I had to add one more option it would be the memory option mentioned above.

Fisherck

I've tried but can't get anything that invloves internet connection to work for me. Not the fetch scores, import or export. I have tried reconnecting my internet, but that has not worked either... :(
My CW2 Maps
My CW1 Maps
Quote from: Sqaz on August 28, 2011, 02:49:35 PM
The comments are here to comment, dare to use them.

mopa42

#17
Quote from: Fisherck on July 22, 2011, 03:59:43 PM
I've tried but can't get anything that invloves internet connection to work for me. Not the fetch scores, import or export. I have tried reconnecting my internet, but that has not worked either... :(
Steps to try:
- Make sure you can get scores and view the forum the normal way through a web browser.
- A firewall might be blocking java or my program in general.
- Run as administrator might help maybe
- Is there anything useful in the error message it gives?
- If you still have v0.1, can that fetch scores either?
- Try running the program with a console, since the program sometimes will print detailed errors to standard out. If you run the program with java.exe not javaw.exe (the default double-click association), there will be a console when the program runs. In a command prompt, try java -jar CodeMapTournament0.2.jar, giving a full path like "C:\Program Files\Java\jre6\bin\java.exe" if java isn't in your path (java.exe might also reside in C:\Windows\System32).

Fisherck

Quote from: mopa42 on July 22, 2011, 06:21:29 PM
Steps to try:
- Make sure you can get scores and view the forum the normal way through a web browser.
- A firewall might be blocking java or my program in general.
- Run as administrator might help maybe
- Is there anything useful in the error message it gives?
- If you still have v0.1, can that fetch scores either?
- Try running the program with a console, since the program sometimes will print detailed errors to standard out. If you run the program with java.exe not javaw.exe (the default double-click association), there will be a console when the program runs. In a command prompt, try javaw -jar CodeMapTournament0.2.jar, giving a full path like "C:\Program Files\Java\jre6\bin\java.exe" if java isn't in your path (java.exe might also reside in C:\Windows\System32).

Well, it does not give an error message. It just does not do anything when I push the buttons... I have both versions, and neither work. I'll try some of the other stuff and see if that works.
My CW2 Maps
My CW1 Maps
Quote from: Sqaz on August 28, 2011, 02:49:35 PM
The comments are here to comment, dare to use them.

Fisherck

Well, now I feel rather embarrassed. Apparantly, if you don't extract it first, it will open up, but you can't fetch the scores. But once you do extract it, there is nothing wrong.... What do you know. ::)
My CW2 Maps
My CW1 Maps
Quote from: Sqaz on August 28, 2011, 02:49:35 PM
The comments are here to comment, dare to use them.

mopa42

Quote from: Lord_Farin on July 22, 2011, 01:47:47 PM
One last request would be some kind of memory that automatically brings up the last 5 maps when the application is opened (ie. the maps which were viewed before the application was closed last time). Such would make for less traffic on the servers, and it would be convenient ;)
That's easy enough.

Here's the latest update, v0.3, now with maps memory. The program stores the 5 maps you last had open into a small file named ".missions" and reads them in again when it starts up. The file is in the same folder you run the jarfile from. No problem if the file is missing / can't be accessed. If the file gets corrupted for some reason, you can just delete it and have the program re-create it.

Download it on the first post. (I've removed v0.2, let me know if anyone needs it for anything).

Evil Roc

Excellent tool, thank you very much!

thepenguin

hey, mopa, you typo'd a tooltip on the export tab (latest, not lastest)
We have become the creeper...

Lord_Farin

It seems the rounding policy for the times is different in your program than in the game, as I just scored 6:42 in CW2, which shows up as 6:43 in the program. Minor issue I'm sure, but still I thought I'd inform you.
Behold, Nexus! Looketh skywards, for thy obliteration thence nighs, my foul enemy!

mopa42

Quote from: Lord_Farin on August 09, 2011, 04:52:32 PM
It seems the rounding policy for the times is different in your program than in the game, as I just scored 6:42 in CW2, which shows up as 6:43 in the program. Minor issue I'm sure, but still I thought I'd inform you.
Yeah, sorry about that. It was very hard for me to figure out exactly how Virgil does his rounding, because there can be several steps between the raw frame count and the rounded minutes and seconds. I've given it my best shot, but sometimes it is still off by one second. This doesn't happen very often though.
I might try to come back and fix that sometime.

xoft

I was wondering, is the conversion routine from seed phrase (code we enter into CW2) into the level seed (32-bit int that is used by the score script) known? Any chance of sharing the formula with us other programmers? ;)

Thanks in advance

mopa42

Quote from: xoft on November 07, 2011, 04:20:18 PM
I was wondering, is the conversion routine from seed phrase (code we enter into CW2) into the level seed (32-bit int that is used by the score script) known? Any chance of sharing the formula with us other programmers? ;)
Sure thing.
Hope this isn't too confidential to share, but here's what I discovered:

Take the code string, change everything to lower case, take the MD5 hash of that.
Interpret the first 4 bytes (first 8 hex digits) as an unsigned integer.
That gives you the magical seed number for the code map.

(the relevant bits from my code are in Mission.java and ScoreFetcher.java if you were looking at that)

UpperKEES

Quote from: mopa42 on November 07, 2011, 04:44:26 PM
Take the code string, change everything to lower case, take the MD5 hash of that.
Interpret the first 4 bytes (first 8 hex digits) as an unsigned integer.
That gives you the magical seed number for the code map.

You just got to love this guy! 8)
My CW1 maps: downloads - overview
My CW2 maps: downloads - overview

thepenguin

Quote from: UpperKEES on November 07, 2011, 04:51:03 PM
Quote from: mopa42 on November 07, 2011, 04:44:26 PM
Take the code string, change everything to lower case, take the MD5 hash of that.
Interpret the first 4 bytes (first 8 hex digits) as an unsigned integer.
That gives you the magical seed number for the code map.

You just got to love this guy! 8)

It says that in the source of his file ;)

QuoteThis document describes how to fetch high scores for Creeper World 2 from the server.
*** COMPLETELY UNOFFICIAL! USE AT YOUR OWN RISK! ***

If you can read this, then you know how to open jar files, so you'll probably understand the rest of what I have to say.


Basically, you query http://knucklecracker.com/creeperworld2/scoreQuery.php with various parameters in order to get a list of records in XML format.
The parameter string to the score query is in the usual format ?key1=value1&key2=value2 (or use an HTTP GET object).

The various parameters you can have are:
* gameUID = text
   s0-s19 for Days 1-20, b0-b9 for Bonus 1-10, credits for Credits, and proceduralXXXX-YZ for Code missions.
      XXXX is the decimal digits (no leading zeros) of the number representing the hash of the code string
            take the string, convert to lower case, trim leading and trailing whitespace, then get an MD5 hash. Use the first 4 bytes (first 8 hex digits) to make an unsigned integer.
      Y is the size: 0, 1, or 2 for small, medium, large
      Z is the complexity: 0, 1, or 2 for low, medium, high
   default is s0 for Day 0
* sort = text
   "scores" for sorting by Top Scores or "time" (not times) for sorting by Top Times
   default is "scores" if omitted
* userfilter = text
   whatever you type in for a user name (escaping any funny characters with the %xx code)
   default is blank if omitted
* groupfilter = text
   whatever you type in for a group filter (escaped)
   default is blank if omitted
* timefilter = integer
   0, 1, 2, or 3 for "All Time", "Last Few Days", "Last Week", "Last Month"
   default is All Time if omitted

Of these parameters, only gameUID is really required for normal use.


The document returned is in XML format without spaces so it isn't very human readable.
(If you're using a web browser, use View Source to see the XML goodies)
The format (indented) is roughly this:
<records>
<record>
   <rank>1</rank>
   <user>First Place</user>
   <score>10000</score>
   <time>8000</time>
   <plays>6</plays>
</record>
<record>
...
</record>
...
</records>

The time is given in frames (30 frames per second, and it is tricky to match the way the score viewer rounds to tenths of a second. It truncates instead of rounding in one place, but I think it must round somewhere else. Anyway, divide by 30 to get seconds)


In my program which uses this stuff, I put in a 100 millisecond delay between server requests. Short enough it's not too noticeable by people. It's not strictly necessary, but it seems like bad manners to uncover Virgil's hidden php page and the swamp it with lots of repeated queries.

Anyway, share and enjoy and be nice.
We have become the creeper...

xoft

Thanks a lot.

To clear things up even more, "funny" characters (>127) are UTF8-encoded before MD5ing, at least by the official score viewer. I might check if the game does this as well later.