Simple Python Things

well...doesn't seem too hard.
I've converted the data now in a civ suitable format, meaning I've now the cities here with coordinates from 0 - 360 /0 - 180, instead of -180 - +180 / -90 - +90.
Means London, which is .7 West (~-1), 51° North, is now 179 / 141 in civ termes.

But 1 problem are the multiple names.
Because apparently also London in Ontario, Canada, and London in Kiribati are in the list, as well as Paris in Texas and Berlin, New Hampshire (and probably some more).
Guess I'll first have to go over the list and select only the biggest names and kick the smaller ones out. Is probably not a problem for the better inhabited areas, but Kiribati...uh....

And in total there are 8828 city names. Considering that we have a theoretical map of 360 x 180, so in total 64800 tiles, where roughly 70% are water, this results in 19440 land plots...not really many names...

EDIT: Further problem might be the date line. At the moment I had assumed that most maps use the date line as the west border, but you cannot be sure. Might be necessary to go with something else as the west border, e.g. the end of Alaska, and let the names flow over the east border accordingly. But that will be ugly :ack:.
 
I'm not yet sure, so no hurry :).
And I can also deal with whatever output format is there, but I have to understand it :D.
e.g. I thought when I export a string, which is at a certain coordinate on a grid, that then this output would somewhere have 2 coordinates mentioned.
Which it doesn't, at least not that I could detect any, which leaves me a bit confused :confused:.

For reference: In the spoiler is what I get from a test (at least the top; I see further down is the rest of the map). test1 is the used string, I guess the values in the colour section are RGB (but 4 :hmm:?), but else...:dunno:.


Spoiler :

PHP:
 <array class="java.lang.String" length="1">
  <void index="0">
   <string>test1</string>
  </void>
 </array>
 <array class="java.awt.Color" length="1">
  <void index="0">
   <object class="java.awt.Color">
    <int>153</int>
    <int>0</int>
    <int>204</int>
    <int>255</int>
   </object>
  </void>
 </array>

Following that, there should be another section:
Spoiler :
Code:
<array class="[I" length="3"> // Width of the map: 2
 <void index="0"> // X Coordinate = 0 (counting from top-left)
  <array class="int" length="2"> // Height of the map: 2
   <void index="0"> // Y Coordinate = 0
    <int>4</int> // Highlight of plot (0|0): highlightstring with index 4
   </void>
   <void index="1">
    <int>-1</int> // Highlight of plot (0|1): None
   </void>
  </array>
 </void>
 <void index="1">
  ...
 </void>
</array>
I used the standard java xml serialization; the reason, why offered to write the "interpreter" myself, is, that I already have that data in the program and as an object. It's a job of a couple of minutes for me.
 
I've converted the data now in a civ suitable format... <Shortened> EDIT: Further problem might be the date line. At the moment I had assumed that most maps use the date line as the west border, but you cannot be sure. Might be necessary to go with something else as the west border, e.g. the end of Alaska, and let the names flow over the east border accordingly. But that will be ugly :ack:.

Sounds like lots of fun (:sarcasm:)
Enjoy. :p
 
Oh well, if the rest is done, then this will be a minor problem...hopefully :).


So, I sorted out the double names (makes my script run more than 10 minutes), and added the names, including the shifting, to the game. The names do not yet get squeezed accordingly, that's the next step.

Below a sample screenshot. The name grid is roughly 1/3 bigger than the displayed map (carter earth map, but I guess you can in general see that the names are roughly in the right place (that sure gets worse if you go farther away from England, due to mentioned fact that it's not squeezed and the names so get stretched quite wide over the map; but well, like said, that's the next step)
Spoiler :

attachment.php
 

Attachments

  • test-names.jpg
    test-names.jpg
    172 KB · Views: 256
netherlands?! bit far from germany isn't it?
 
:lol: I guess

so do you have to move there?

in any case congrats!
 
Oh well, if the rest is done, then this will be a minor problem...hopefully :).


So, I sorted out the double names (makes my script run more than 10 minutes), and added the names, including the shifting, to the game. The names do not yet get squeezed accordingly, that's the next step.

Below a sample screenshot. The name grid is roughly 1/3 bigger than the displayed map (carter earth map, but I guess you can in general see that the names are roughly in the right place (that sure gets worse if you go farther away from England, due to mentioned fact that it's not squeezed and the names so get stretched quite wide over the map; but well, like said, that's the next step)
Spoiler :

attachment.php
If anyone founds a city on the sea, they'll even get a unique name. :lol:

Sadly the further development has probably to be postponed, because I just got an email with an offer for a PhD position in the Netherlands. So I guess I might be a bit busy in the next time :D.


:woohoo:

:goodjob:
 
Had some time, so I tried to adjust the code further.
2 screenshots from 2 different maps:
Spoiler :

attachment.php


attachment.php


Obviously not ready, but heading in the right direction.
But I begin to wonder if the civ maps are accurate enough for something like that.
e.g. in the first screenshot, if you look where Amsterdam is (and that position is correct, Amsterdam is farther to the north than London), then I'm not sure if we really have any maps where you could place it correctly. At least Europe has some distortion, which is...quite bad.
Also not sure about the relations. e.g. Ireland is too far away, but that's due to the game engine (if placed correctly, it would be connected to England), and while the grid here is already stretched too far (e.g. Lisbon, which you can't see, is in the water), the bigger relations are also incorrect (American cities are placed too far at the west).
Okay, the continents could be treated independently, but that would also only fix (maybe) the American and Australian cities, but would not help within Europe.
Not sure about Asia. In the first map, the names are stretched too far to the east (to be expected), but no idea if the sizes are accurate.
Haven't tested it on other maps yet, but I guess the same applies to all maps we have.
 

Attachments

  • rightdirection.jpg
    rightdirection.jpg
    185.8 KB · Views: 209
  • rightdirection2.jpg
    rightdirection2.jpg
    206 KB · Views: 213
Looking at the maps, you may want to consider reducing the number of city names, removing the smaller ones of course.

Else if I build a city at this plot, it is Paris, but just one tile away it is Reims?
Perhaps it may be ok in bigger size maps, but if the screenshots are using the average map size, then doesn't it mean that big city names may not spawn because there are too many names nearby?
 
Hey, but this is where Reims is! (or at least should be)

I know what you mean. It would be weird having settled whole France without having Paris showing up, but that's how it is (or should be) accurate :dunno:.
Stretching the name to the surrounding tiles could sure be done, but then nearly whole France would only be Paris. Also not good IMHO :dunno:.
 
Hey, but this is where Reims is! (or at least should be)

I know what you mean. It would be weird having settled whole France without having Paris showing up, but that's how it is (or should be) accurate :dunno:.
Stretching the name to the surrounding tiles could sure be done, but then nearly whole France would only be Paris. Also not good IMHO :dunno:.

But thats easy to avoid. You give a tile Paris as city name, and if Paris already exists in the map, you take the alternative tile name, Reims.
 
or give each name a weighting... ie paris 10 reims 5... if the map is sqaushed then take the higher rated name
 
But thats easy to avoid. You give a tile Paris as city name, and if Paris already exists in the map, you take the alternative tile name, Reims.

That would only work for maps where the distances are big enough.
Because if you look at the first sample screenshot, if there Paris existed, then Reims would have to be in Germany or Spain, due to the minimum distance.

or give each name a weighting... ie paris 10 reims 5... if the map is sqaushed then take the higher rated name

That's more or less already happening (with the population as weight).
Else you'd see some smaller city names popping up there.
 
That would only work for maps where the distances are big enough.
Because if you look at the first sample screenshot, if there Paris existed, then Reims would have to be in Germany or Spain, due to the minimum distance.

Sure, but you were planning to use the same name grid for more than one map, right?
 
Back
Top Bottom