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

[Map Script] SpiralGalaxy.py for Final Frontier

Discussion in 'Civ4 - Map Scripts' started by cephalo, Feb 12, 2008.

  1. PsiCorps

    PsiCorps FF: Babylon 5 mod team

    Joined:
    Dec 30, 2007
    Messages:
    1,424
    Location:
    Britain
    Hi Cephalo, is this script 3.17 compatable
     
  2. cephalo

    cephalo Chieftain

    Joined:
    Jul 26, 2007
    Messages:
    2,056
    Location:
    Missouri, USA
    The patch happened while my home computer is dismantled, so I haven't tested it. I'm not yet aware of any issue that would prevent it from working unless there are new terrain types or something.
     
  3. Premier Valle

    Premier Valle FF: Babylon 5 Mod Team

    Joined:
    Sep 9, 2007
    Messages:
    675
    Location:
    Ich bin in Mexico Stadt
    I'm currently playing with SpiralGalaxy and 3.17, so far everything works fine (I'm in the middle part of the game).

    EDIT: I finished the game, and there was no problem at all!.
     
  4. Phaedris

    Phaedris Chieftain

    Joined:
    Jan 20, 2009
    Messages:
    13
    I really like this map script but I am having problems playing this in multiplayer I keep getting OOS error's whenever I start a game.
    I'm using patch 3.17
    Does anyone else have problems playing with this in multiplayer?
     
  5. cephalo

    cephalo Chieftain

    Joined:
    Jul 26, 2007
    Messages:
    2,056
    Location:
    Missouri, USA
    Looks like there's a bug in there. It's supposed to detect a network game and switch to the apporopriate random number generator but it looks like I left it commented out by accident. Funny nobody noticed this for a whole year. :lol:

    Ok I fixed it. Download it again and it should work. Let me know because I fixed it without playtesting...:eek:
     
  6. Phaedris

    Phaedris Chieftain

    Joined:
    Jan 20, 2009
    Messages:
    13
    Seems to work fine now played for a while and no OOS error's :)
     
  7. Daryl95

    Daryl95 Templar

    Joined:
    Nov 9, 2008
    Messages:
    271
    Location:
    America
    What about a toroidal map?
    Is this v3.19 compatible?
     
  8. cephalo

    cephalo Chieftain

    Joined:
    Jul 26, 2007
    Messages:
    2,056
    Location:
    Missouri, USA
    Untested on 3.19. Should work though.

    I didn't use a toroidal option because real galaxies are flat discs. If you are at one end of the galaxy, you really do have to cross the whole galaxy to get to the other end. Keep going off the edge and eventually you'll probably hit a whole new galaxy.
     
  9. PsiCorps

    PsiCorps FF: Babylon 5 mod team

    Joined:
    Dec 30, 2007
    Messages:
    1,424
    Location:
    Britain
    How do you increase the size of the maps without increasing the number of star systems and other features/hazards?
     
  10. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    16,052
    Location:
    In orbit
    Odd indeed. I playtested (before the fix) on MOO2Civ with no real OOS problems - as far as I remember. Will use the fixed version for the next patch anyway. (I heard of this mapscript via deanej and was under the impression it was his; credit will be corrected as well.)

    Good to know.;)
     
  11. cephalo

    cephalo Chieftain

    Joined:
    Jul 26, 2007
    Messages:
    2,056
    Location:
    Missouri, USA
    Wow, I haven't looked at this code for a loooong time, but there's gotta be an easy way... I'll try to look into it.
     
  12. PsiCorps

    PsiCorps FF: Babylon 5 mod team

    Joined:
    Dec 30, 2007
    Messages:
    1,424
    Location:
    Britain
    many thanks, i look forward to your response
     
  13. Daryl95

    Daryl95 Templar

    Joined:
    Nov 9, 2008
    Messages:
    271
    Location:
    America
    I understand that but I was just wondering how you make a toroidal mapscript.
     
  14. Daryl95

    Daryl95 Templar

    Joined:
    Nov 9, 2008
    Messages:
    271
    Location:
    America
    I remember editing a couple thing in Final Frontier.py, or was it this one, and then it didn't show up. I was trying to make a mod where planets replaced stars and moons replaced planets. This mod didn't work in the end but why was it that when I removed a few features from the script so it was just a solar system the game didn't show it?
     
  15. cephalo

    cephalo Chieftain

    Joined:
    Jul 26, 2007
    Messages:
    2,056
    Location:
    Missouri, USA
    I think all you have to do is change the getWrapX and getWrapY functions and set them to return 'True'.
     
  16. cephalo

    cephalo Chieftain

    Joined:
    Jul 26, 2007
    Messages:
    2,056
    Location:
    Missouri, USA
    Ok, I had a look and right at the front of the script there are some tuning variables to adjust the densities of these features.
     
  17. PsiCorps

    PsiCorps FF: Babylon 5 mod team

    Joined:
    Dec 30, 2007
    Messages:
    1,424
    Location:
    Britain
    OK I have tried increasing the map size once before but it didn't work and now i've dived in at the deep end before i learnt to swim. Starting at the beginning, i'll ask questions :lol:
    Is there a ratio of height to width that needs to be observed when adjusting the map size?
    The variables you mentioned above do you decrease the value to decrease the density of features or increase it to do the same?
    Is there a step by step guide to setting up or adjusting the parameters of your map before you even start the game?
     
  18. cephalo

    cephalo Chieftain

    Joined:
    Jul 26, 2007
    Messages:
    2,056
    Location:
    Missouri, USA
    I think you can use any size you like, but it's possible that the map requires a square aspect. The feature density is how many of these objects are placed per map square.
    So for a standard map with grid size 22x22, you times 4 to get map dimension of 88x88 which is 7744 map tiles. At 0.0045 SolarSystemsPerPlot, that comes to around 34 solar systems.
     
  19. PsiCorps

    PsiCorps FF: Babylon 5 mod team

    Joined:
    Dec 30, 2007
    Messages:
    1,424
    Location:
    Britain
    Thanks for the info Cephalo, i'll investigate and play around now i have some knowledge.
     
  20. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    I was trying to make it possible for wormholes to be added to this mapscript (like I did with the default FinalFrontier mapscript) and ran into some confusing errors.

    Firstly, I wanted to make sure that my wormholes would be placed some distance away from each other and added this function to the mapscript, based on the checkForRoom one that is triggered from each feature generation.

    Code:
        def checkForWormholeRoom(self,x,y,feature):
            gc = CyGlobalContext()
            mmap = gc.getMap()
            xStart = x - (CyMap().getGridWidth() / 4)
            xEnd = x + (CyMap().getGridWidth() / 4) + 1
            yStart = y - (CyMap().getGridHeight() / 4)
            yEnd = y + (CyMap().getGridHeight() / 4) + 1
            for yy in range(yStart,yEnd):
                for xx in range(xStart,xEnd):
                    if (yy == yStart or yy == yEnd - 1) and (xx == xStart or xx == xEnd - 1):
                        continue #skipping corners
                    i = GetIndex(xx,yy)
                    if i == -1:
                        return False
                    plot = mmap.plot(xx,yy)
                    if plot.getFeatureType() != feature:
                        return False
            return True
    Then, I changed the checkForRoom and shouldAddFeature function line (which requires them to all be true) to this:

    Code:
    if self.shouldPlaceFeature(x,y,self.featureWormhole) and self.checkForRoom(x,y,self.featureWormhole) and self.checkForWormholeRoom(x,y,self.featureWormhole):
    However, when I do this the map seems to hang while "initializing map". So I gave up and removed this... but now my wormholes get dropped within, say, six plots of each other occasionally (which make them useless). Is there something wrong with my code? Or some easier way I can do this?
     

Share This Page