Simple Python Things

Nice to see, and thanks for the flowers :).


@dacubz: I had some questions...


And I've tried now to implement that...er..."map scanning" algorithm, but stumbled upon a problem: The areas don't match the areas. I can collect all CvArea objects for a map, and these are for my test map roughly 100. But when I go over the plots, then a pPlot.area().getID() or pPlot.getArea () will return some arbitrary high numbers, up to 15000. Considering that the test map has only 5600 plots, this doesn't make any sense :dunno:.
 
I meant regarding the adjusted SpawnACiv version for you ;).

And I've tried now to implement that...er..."map scanning" algorithm, but stumbled upon a problem: The areas don't match the areas. I can collect all CvArea objects for a map, and these are for my test map roughly 100. But when I go over the plots, then a pPlot.area().getID() or pPlot.getArea () will return some arbitrary high numbers, up to 15000. Considering that the test map has only 5600 plots, this doesn't make any sense :dunno:.

duh, I shouldn't have assumed that the index of an area is also it's ID :shake:.


So, geography 101:
Spoiler :

attachment.php


attachment.php


But finally:
Spoiler :
attachment.php


So, currently England is an island which is/has:
- More than 5 tiles
- taller than wide
- has the largest CvArea to the east
- has the largest CvArea to the south
- has a smaller island to the west in range of max 10 tiles

Tested that on different maps, works for normal Europe/world maps, fails for maps without England :).
Guess I'll have to look the next days into loading the city names from Rhye and squeezing/stretching/shifting these names accordingly :).
 

Attachments

  • england2.jpg
    england2.jpg
    157.5 KB · Views: 299
  • thiscouldbeireland.jpg
    thiscouldbeireland.jpg
    148.2 KB · Views: 269
  • yay.jpg
    yay.jpg
    148.5 KB · Views: 259
This is how they should be spawned
-A city placed (no settler)
-Warrior. worker placed on city
-If there is a python code to check the starting techs, do so and add those if not no need to add techs, 30 gold

I think that answers all your questions

Is there anyway to block them from becomming vassels?
 
Automatic detection of the city states, or do you somehow want to define a list somewhere which civ is a city state and which not?

Don't think you can prevent vassalage.
But I'm not that familiar anymore with the rules...do both civ need the required tech?

I'm planning to do this in my mod (some day :)...). I will use the "provinces" (Each plot has a defined province) I already have or markers for important cities and a modified version of Xynth's Dynamic City Naming, so a city name will have properties like general priority, water access and so on.
The Map Markup is not much work, since I use a tool based on an Java map editor (If you need something like that, I could adjust it for you), but the harder work is probably to find all the city names for bigger mapsizes.

...and I have to come back to this.
Do you have at least a partial grid with names yet?
Because I've looked at the names from Rhye, and there's no universal name grid, but rather one for each possible civ, and mostly limited to the regions where they are supposed to appear in RFC. Which leaves quite some gaps in different areas.
Else I might have to look into the tool...that would be some work...
 
Automatic detection of the city states, or do you somehow want to define a list somewhere which civ is a city state and which not?

Don't think you can prevent vassalage.
But I'm not that familiar anymore with the rules...do both civ need the required tech?
List in python would be easiest I would think instead of a xml tag.
Isnt there a tag in the leaderheads section for vassalage? If you put htem favor it at 0 do you think possibly that would stop it?
 
List in python would be easiest I would think instead of a xml tag.

-> then no XML at all. Because if they all start with the same things, and you want to list them in the py file, then there's no need to define anything in an additional file.
Nice, that's easier :D.

Isnt there a tag in the leaderheads section for vassalage? If you put htem favor it at 0 do you think possibly that would stop it?

Oh, that could be an idea. But I guess you'd probably have to check the SDK to see at what point becoming a vassal will be impossible.
 
Or I thought I'd do it :ack:.
Does anyone with BUG experience have a clue, why one function from the merged file is triggered, but the other not, without any error messages in the log?
e.g. onUnitBuilt is triggered, but no onBeginGameTurn. The log says both has been recognized. And I have no idea where the problem could be :dunno:.

2.5 weeks ago...god...time flies.
Whatever, I'm a moron. Made some stupid mistakes in the configuration file, that caused the problem.

Attached an adjusted version. Just drop all the files in the respective folders (not sure if PythonCallbackDefines is per default in BUG; if yes, then you have to merge it), add
PHP:
<load mod="DyingHeroes"/>

to the end of the config\init.xml, and change in the DyingHeroes.py on top the 2 instances of "BUG Mod 4.0" to the name of the mod folder in which you want to merge it (e.g. "Caveman2Cosmos", if that is the folder name).

If any problems appear, then let me know it.
 

Attachments

...and I have to come back to this.
Do you have at least a partial grid with names yet?
No, and it will probably take some time before I even start to code anything about city names. Currently it is just an idea.
Because I've looked at the names from Rhye, and there's no universal name grid, but rather one for each possible civ, and mostly limited to the regions where they are supposed to appear in RFC. Which leaves quite some gaps in different areas.
Else I might have to look into the tool...that would be some work...
I've just uploaded it here. I'm not sure if it is really useful for you, but you might give it a try.

Short description:
"Set Highlight": Opens a dialog with a list. It contains "Highlight Strings" that are associated with a color. You can choose one and then draw on the map. (Delete with right mouse button)

"Load Map": Load a Civ4MapMaker map. You probably don't have any :)
"Import Map": Load a civ4 map.
"Save XML": Saves your highlight (on the map) and your "Highlight Strings" in an XML file. It should be easy to convert it into whatever you need, it you have problems with that, I can help you probably :)
"Open XML": Loads a highlight and "Highlight Strings" from an XML file.
 

Attachments

This is how they should be spawned
-A city placed (no settler)
-Warrior. worker placed on city
-If there is a python code to check the starting techs, do so and add those if not no need to add techs, 30 gold

I think that answers all your questions

Okay, that is so far done.
Do you want that your spawning civs have the appropriate bonuses for the difficulty level?
 
I've just uploaded it here. I'm not sure if it is really useful for you, but you might give it a try.

Short description:
"Set Highlight": Opens a dialog with a list. It contains "Highlight Strings" that are associated with a color. You can choose one and then draw on the map. (Delete with right mouse button)

"Load Map": Load a Civ4MapMaker map. You probably don't have any :)
"Import Map": Load a civ4 map.
"Save XML": Saves your highlight (on the map) and your "Highlight Strings" in an XML file. It should be easy to convert it into whatever you need, it you have problems with that, I can help you probably :)
"Open XML": Loads a highlight and "Highlight Strings" from an XML file.

Jus took a look at it, seems to be useful.
Not sure how to interpret the output of the "Save XML" option though :hmm:.

Since this will probably quite some manual work, I'll first take a look if I can adjust the city name grid from Rhye for the other maps, if the stretching/squeezing/shifting works, and if it does, then I'll try to collect a full set of names.
 
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>
 
:ack: *urgh*
Progress report: Started defining the position of London in England, and tried to shift the name grid accordingly. Theoretically that works, but that format, which Rhye used, is uber ugly. Not only that you have to access the coordinates in reverse order, the name grid is also upside down and has, at least for the original map, a north/south shift of 67 plots, and I have no idea where that comes from :ack:.

So I thought maybe I should define a name grid myself, but then again...the biggest maps can have up to 25000 plots, and if you say that 60% of the earth is water, then you're still left with 10000 plots. Which is a bit much for manual work.
But does that stuff not have to be available online somewhere? I mean GPS data, and map data is sure online, look at google maps, and that could be converted, if it was available somehow as plain text...a geoinformatician would be handy right now :ack:.
Guess I have to do some research tomorrow :ack:.
 
:p

Via this I've ended at this site, and I have now a 25mb text file here with names, population and GPS data. Guess that should be enough.

So, the plan...read that file into a script, sort it by GPS data, lay a grid over it, and search the biggest town/city for that place. Strip the data down, and print it into a separate file.
The biggest maps currently are 232 x 112 or 192 x 120, so mmhh...300 x 150 should be enough, I guess.
EDIT: Duuhh...360 x 180 might maybe make more sense...
 
Back
Top Bottom