View Full Version : building artdef, citystyle (CityLSystem), python (?)


cool3a2
Aug 21, 2009, 05:47 AM
I'd like to continue the problem of this thread: http://forums.civfanatics.com/showthread.php?t=329479. (http://forums.civfanatics.com/showthread.php?t=329479) I would have prefered to continue the other thread itself, but didn't figured out how to rename it and as is the title misses the point somehow.

So I still don't want to give this up. At the moment I see two solutions for this problem, but plain xml won't be enough, I think...
a) GeoModder told me how to place a building into the citycenter, simply by adding this line:
<Attribute Class="Scalar">szSpecialLayout:CityCenter</Attribute>
This would even give the building the best place, but the default houses don't move and therefore overlap with my building. An idea would be to do some python work to force the other buildings to move. Well, if there would be an xml solution I've missed, I'd prefer that. So let me know if you have an idea. I have no idea what to do in python to move the other houses, so this is kind of vague.

b) Secondly, there are two other lines, similar to the one above, that brought me to an other idea:
<Attribute Class="Scalar">szSpecialLayout:Coast</Attribute>
and
<Attribute Class="Scalar">szSpecialLayout:Water</Attribute>
If I get this right, then szSpecialLayout is a python function. Correct me if I am wrong... And Coast and Water are arguments to it. So it seems that, in general, a building can be forced to only occur on certain types of squares. The naive way, typing
<Attribute Class="Scalar">szSpecialLayout:Plain</Attribute>
doesn't work :sad: But I think it should be possible to define an argument for the mentioned function, that stands for squares without hills, peaks, ocean, coast and rivers (maybe by even reusing the Water argument). If there is no legal square around, then the building just doesn't show up. Or, as a second version, the building gets positioned in the citycenter (which would be prefered anyways), where it seems to be okay to have it on a hill. Coast and ocean are impossible there anyways. The only thing that should be excluded, are rivers as it may look strange if there is a river just under the building.

I guess b) is possible somehow. The problem is, that I've never done python work so far (but I am a bit experienced with c++ at least), so I have no clue where to start. There are tutorials about python, but all seem to be far away from my specific problem. Furthermore, there seems to be quite a lot of python files, but I can't find the one with szSpecialLayout, so it would be nice if someone could help me a little by at least bring me on the right way. I am open for alternative ideas also, so feel free to share your thoughts.

BTW: As mentioned,
<Attribute Class="Scalar">fCurvatureBias:68</Attribute>
did not have the desired effect. Maybe I set up the new leaf incorrectly. GeoModder told me, that this requires a lot of definitions in a lot of files, so doing it the way it is mentioned in the other thread, may have been to simple. Some hints would be of help.

The_J
Aug 21, 2009, 07:02 PM
I have no idea, how to access the city graphics with python. But i'm not very experienced, maybe EmperorFool knows something.

cool3a2
Aug 22, 2009, 02:53 AM
Okay, thanks. I'll write him a pm for the case he missed this thread.

EmperorFool
Aug 22, 2009, 03:14 AM
I'm in the same boat as The_J, I'm afraid. I have no experience with Civ's graphics routines for city layouts or dealing with the engine. The only graphic APIs I know are to place the little icons on the map (like recommended action plots and rally points) and shaded borders (like culture and settler founding areas).

I did a quick find in files of the SDK for "szSpecialLayout" and found nothing. In the Python and C++ code the "sz" prefix signifies a string, so this is probably the name of a string parameter that can be passed to the layout function where the value after it is the value for that parameter.

BTW, "Plains" is the name for the 1:food:1:hammers: tile while "PLOT_LAND" is the type name for flat land, so maybe try "Land" instead of "Plain".

cool3a2
Aug 22, 2009, 05:11 AM
BTW, "Plains" is the name for the 11 tile while "PLOT_LAND" is the type name for flat land, so maybe try "Land" instead of "Plain".
I'll try that, although I think that I already did. I also tried 'Plains' instead of 'Plain' - with no luck either. Well, thank you for your help.

cool3a2
Aug 22, 2009, 06:40 AM
As expected 'Land' didn't work. Still, I managed to tweak the problem, although I didn't solved it yet. I put the building into a 4x2leaf and rotated it. This ways it gets placed onto the cities main square and therefore surrounding hills and coasts don't seem to be a problem anymore. As it also gets a beautiful concrete ground, rivers don't seem to be a problem anymore. The only problem occurs, if the city is placed on a hill itself. Then the building starts 'flying'. I could put some socket under it, but the building flies quite high and therefore finding an accurate ground could be difficult. Also, the mentioned concrete ground could be a problem then. If the socket would be a green hill for example, it sticks out because of the grey ground...

<Attribute Class="Scalar">fCurvatureBias:68</Attribute> still doesn't change anything. Don't know what it is good for exactly or how it does work...