In the STARTMAP opcode, the fourth parameter is a "gzip'ed intmap of
I've tried saving it as a file and decompressing it with "gzip -d file.gz". I receive the error message: "unexpected end of file"
Perhaps I'm saving the file wrong, or decompressing it wrong. I don't know. Here is the file: map.gz
Does anyone know where I'm going wrong, or do you have any ideas?
Hmmm.. Internet Explorer is trying to display that file as text when I paste the url, so go here instead and just click on the file link to download it: http://www.poelder.com
The file you put on there isn't a gzip file, but the actual map.
Which by the way looks ok.
Well, that's the exact data I received within the startmap message, and I saved it as a .gz file. It was my understanding that that binary message the server sends you is a gzipped file, and if we can decompress it then we can read it.
There's something strange going on. When I look at the file on your url it's 18k - so it's the gzipped file. But when I click on it or save it I see/recieve the decompressed data (1.21M).
So there's little to check on the original gz file. Maybe you can change the file extension, so that it'll download properly?
Thanks to the help of Jp, the map data has been successfully decompressed. The problem lied in the translation of the socket. In tcl, Jp and I were both using: fconfigure $socket -translation binary
But it should be: -translation lf
Now I just need to figure out what to do with this intmap. You can download it here: http://www.poelder.com/map (right-click, save as)
or rather, goto poelder.com and save-as
The int-map is quite easy. I'll be using hex notation, since that's easier for me ;-)
For every pixel of your map there are 4 bytes. The 1st of those 4 is either 00 or FF, with FF representing water and 00 being land.
In the case of water (FF) the next 3 bytes are FF too.
In the case of land (00) the next 3 bytes are the RGB value of that pixel. So the 2nd is red, the 3rd is green and the 4th is blue. When drawn out, this makes every country have it's own color.
It depends on with which version the map was made (web or download) how well you can distinguish the different countries / colors. Maps made with the web version have clearly distinguishable colors. Maps that are made with the download however dont have red and green (2nd and 3rd byte 00) and the blue (4th byte) increments the blue value by 1 with every new country. So you can't tell the difference so easily.
Then there's also the borders. They are marked by "FF FF FF FE".
Thanks, Jp. So the color of each country is the country ID, right?
btw, I said earlier the translation for the socket should be "lf". It should actually be: "-translation binary -encoding binary". "lf" was causing errors for me not related to the map data, but with the encoding and translation as binary, it's working perfect.
Yeah, Emiel told me the color for a country is the country ID, except it wasn't meant to be used as a color ;-)
I cant belive all this that your talking about guys, actually makes sense.
I wish I could learn programming in like 1 week
I dont have the energy to learn it...
Keep up teh good work guys
Man, that Poelder guy has quite a bit of trouble with the English language, and with Dutch too....
haha with a risk game is was making and then dropped when i found it was already done to death... I made each country a diferent color so i could make the map in paint and diffrentiate countries when i loaded it. In retrospect I would of used polygons, a bit uglier but much easier to deal with :).
offtopic- it says that the dominate member version has no download witch is of course untrue, assuming its jar compresses your downloading 2.2 mb or whatever is and then caching it, so you wont have to download again. (if its not a jar then your downloading it every visit, i think)
Reply to this discussion