1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[BtS 3.19 Mod] Culturally Linked Starts

Discussion in 'Civ4 - Mod Components' started by Jean Elcard, Sep 10, 2008.

  1. vincentz

    vincentz Programmer

    Joined:
    Feb 4, 2009
    Messages:
    3,556
    Gender:
    Male
    Location:
    Denmark
    I get this error 9 out of 10 (though when I dont get it, its pretty much PERFECT :goodjob:)

    Spoiler :
     
  2. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Hummmm... Tried it again 10 times and it went fine without errors each time. Results were good and if I found something a bit strange, there was always a reason (like too many European civs, etc.). Now I always did the same thing: play with my adapted Custom Continents map script (post #92), random 18 BtS Civs, random number of continents. I have not installed the SDK/option part.

    So, it means that you are doing something different. I have to ask some questions then:
    Do you try it with the SDK stuff?
    What map script are you trying?
    How many civs (read below)?
    Have you changed parameters in the file?

    The parameters look like: coords.append((0, 60.000, 15.000))
    1st number = AST
    2nd number = latitude (should be beween -90 and +90)
    3rd number = longitude (should be between -180 and +180).

    This could be obvious to you but what is not might be my "trick": for each player, I'm adding to both latitudes and longitudes the "iPlayer" / 10. Meaning that if you have 50 players, a number of 4.9 is added to the generic AST numbers for the last player. And this could then be out of range. Prudently, you should not use for example latitudes at 88 or longitudes at 176.

    What is more worrying for you might be that Jean Elcard said in his OP that "You are allowed to use up to 40 civilisations". What happens if you use more than 40 civs, I have no idea, as the math involved in his calculations is way over my head, I was never good at trigonometry! :mischief:

    Now I have included a new file. Nothing new really but a popup should appear in the process: either with "Hello World" or with "Wrong coordinates in file"...

    Please try it your end and tell which popup appears 1) when the script works 2) when you have the error. It might be that something else is happening too.

    EDIT: if you have changed the parameters, it is also important to respect the syntax for latitudes and longitudes, they must keep a floating point notation (55.000 or 55.0 but not just 55).
     
  3. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,540
    Gender:
    Male
    Location:
    Canberra, Australia
    In the original there was a place where a divide by zero may occur. I think it happens if a civ does not have an entry in the coordinates list. I tested that a valid value was returned and if not put out an error message.
     
  4. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Thanks DH. The coords are entered per Art Style Type (AST) now in this alternate version. Is it possible to have a civ without AST?

    From what I read on the internet, it might be that a float is taken as an integer and it results in an error. In the last version, I changed a iPlayer / 10 by iPlayer / 10.0. Let's hear from vincentz now ;)
     
  5. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,540
    Gender:
    Male
    Location:
    Canberra, Australia
    Or maybe an art style that has not been added to the list?
     
  6. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Not in this case as vincent said he had less than 12 Art Styles.

    I've added a check anyway to return the first Art Style Type if it comes out of range.

    File updated in my "OP" (post #97).
     
  7. vincentz

    vincentz Programmer

    Joined:
    Feb 4, 2009
    Messages:
    3,556
    Gender:
    Male
    Location:
    Denmark
    I still get the error if I just use the basic mod (Culturally Linked Starts) with nothing else except the changed file. Tried Archipelago and Big'n'Small. I do get a Hello World though ;)

    I think I found the cause. Every time I load the mod, it works, but if I exit to Main Menu and try to generate another map, its a 10/10 that the error occurs. Maybe it needs to reset somehow (???).

    I added some extra map sizes to the mod, so its not a pita to select many civs everytime testing ;)

    edit : or it have to unload from game/memory after initial setup, which is the only time needed?
     

    Attached Files:

  8. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    That was helpful! :D

    Indeed, the memory is not reset when you exit to main menu - you are still in Civ4.

    I was puzzled because it looks like all the lists were initialised at zero before starting the code but then I realised that the file is probably not read again in its entirety. Putting the "CoordinatesDictionary = []" at a different place seem to have solved the problem.

    When I did my 10 consecutive tests, each time I exited the game completely, without even thinking to just exit to the main menu. That is because I'm used to do so when I make any small Python adjustment in a file.

    The last version of the file is attached to post #97.

    :cool:
     
  9. vincentz

    vincentz Programmer

    Joined:
    Feb 4, 2009
    Messages:
    3,556
    Gender:
    Male
    Location:
    Denmark
    Thanks :D
    I really like this. The fact that its not predictable, together with the somewhat culturally clustered civs, makes it 5 stars for me.




    A final question :

    The Clusters (AST), are they relative to each other or would they be completely randomized.
    (I.E. if I put Greco-Roman close to European, would their clusters try to be neighbours and if I put Southamerica far from Northamerica would they be far apart? or would they be completely randomized on map?)

    coords.append((0, 60.000, 15.000))
    coords.append((1, 30.000, 120.000))
    coords.append((2, 10.000, -90.000))
    coords.append((3, -10.000, 35.000))
    coords.append((4, -30.000, 50.000))
    coords.append((5, -40.000, 70.000))
    coords.append((6, -50.000, 90.000))
    coords.append((7, -60.000, 130.000))
    coords.append((8, -70.000, 150.000))
    coords.append((9, -80.000, -30.000))
    coords.append((10, 80.000, -160.000))
    coords.append((11, 0.000, 0.000))

    Plotted coordinates from file:


    Also, there are 12 AST in the file. Does it check beyond the number of AST I have in mod, does it just ignore the last ones or does it use it for further placements if "space" ran out for previous ASTs?
     

    Attached Files:

  10. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Thanks for the 5 Stars. Jean Elcard deserves 4.9 out of it! :D

    I didn't change any of the math linked to the re-distribution of starting points to civs according to the coordinates. So yes, one group should be close or far away from another depending on the coords.

    The coords included might be the weak part of the file, I didn't even try to figure them on a map like you did! ;) Of course, I have no way to know in advance what will be the different ASTs in a Mod. It's really up to the modder to decide what he prefers to do with them.

    Difficult for me to answer precisely the last question, except for this:

    - you can add ASTs to the list but I suppose that the more you add, the less good the overal result would be.

    - if you have less ASTs, the remaining ones will be ignored. Let's say you have 10 of them (0-9), coords for AST 10 and 11 will be ignored.

    - if you have more than 12 and if you don't change the file, I added a check to validate them as AST 0.

    Does it answer your questions?
     
  11. vincentz

    vincentz Programmer

    Joined:
    Feb 4, 2009
    Messages:
    3,556
    Gender:
    Male
    Location:
    Denmark
  12. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,540
    Gender:
    Male
    Location:
    Canberra, Australia
    My, probably wrong, understanding of the "regions" was that they were based on the start position and group of the first player. This means they are quite random form one game to the next since the start position of player one is random in the first instance.

    This is more from observation than anything else. When I play the Egyptians my near neighbours are middle-east and African nations no matter if I am at one of the poles or equator.
     
  13. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    You are probably right, as I said earlier, the starting positions are not defined by this Mod Comp, just re-distributed according to the parameters set in the file.

    Furthermore, the civs are not assigned a position which might correspond to their coordinates in real world but just a position that could reflect the distances between them as expressed by the coordinates.

    Besides, in this alternate version with Art Style Types (file in post #97 as a reminder :) ), the different groups are not treated separately, it's just that all civs in a same group automatically receive coordinates that should make them immediate neighbours.

    As a final note, I should say that the original version of Jean Elcard is still pretty much valid (I will keep it for myself for example) and that the alternate version is just... an alternate version! The advantage of the alternate version is that you should only modify the file when you have a new Art Style Type. In the original version, you have to modify the file (add the coordinates) each time that you want to add a civilization to your mod.
     

Share This Page