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 scripts that don't work

Discussion in 'Civ4 - Caveman 2 Cosmos' started by billw2015, Oct 11, 2019 at 7:07 AM.

  1. billw2015

    billw2015 Chieftain

    Joined:
    Jun 22, 2015
    Messages:
    657
    Please list ones you know should not be used for any reason, we should remove them from the mod (at least the v40 release anyway) until they are fixed so as to not waste players time and patience having to find out for themselves 20 hrs into a game.

    e.g. If it doesn't generate all required resources (I'm not sure there are any other criteria what would break the game totally based on map generation).

    edit: If we don't know one way or the other we might want a generic map validation script in python we can tack on the end of a map generator to confirm if it did or didn't make a valid map. If someone knows of one already that would be useful of course, or otherwise what we might like to validate.
     
    Last edited: Oct 11, 2019 at 10:09 AM
  2. MattCA

    MattCA Chieftain

    Joined:
    Jan 25, 2019
    Messages:
    142
    Gender:
    Male
    The largest map script is 1052 kb and the smallest is 4 kb.
    I think most of them don't affect resource placement directly.

    Here's some code from CvMapGeneratorUtil.py that attempts to add missing bonuses. CvGame has a function with the same name.
    Spoiler :
    Code:
    class BonusBalancer:
     def __init__(self):
      self.gc = CyGlobalContext()
      self.map = CyMap()
    
      # Rise of Mankind mod start
      self.resourcesToBalance = ('BONUS_BAUXITE', 'BONUS_COAL', 'BONUS_COPPER', 'BONUS_HORSE', 'BONUS_IRON', 'BONUS_OIL', 'BONUS_URANIUM', 'BONUS_SULPHUR', 'BONUS_RUBBER')
      # Rise of Mankind mod end
    
      self.resourcesToEliminate = ('BONUS_MARBLE', )
    
     def isSkipBonus(self, iBonusType):
      type_string = self.gc.getBonusInfo(iBonusType).getType()
    
      return ((type_string in self.resourcesToBalance) or (type_string in self.resourcesToEliminate))
    
    
     def normalizeAddExtras(self):
    
      for i in range(self.gc.getMAX_PC_PLAYERS()):
       if (self.gc.getPlayer(i).isAlive()):
        start_plot = self.gc.getPlayer(i).getStartingPlot() # returns a CyPlot
        startx, starty = start_plot.getX(), start_plot.getY()
    
        plots = [] # build a list of the plots near the starting plot
        for dx in range(-5,6):
         for dy in range(-5,6):
          x,y = startx+dx, starty+dy
          pLoopPlot = self.map.plot(x,y)
          if not pLoopPlot.isNone():
           plots.append(pLoopPlot)
    
        resources_placed = []
        for pass_num in range(4):
         bIgnoreUniqueRange  = pass_num >= 1
         bIgnoreOneArea   = pass_num >= 2
         bIgnoreAdjacent  = pass_num >= 3
    
         for bonus in range(self.gc.getNumBonusInfos()):
          type_string = self.gc.getBonusInfo(bonus).getType()
          if (type_string not in resources_placed) and (type_string in self.resourcesToBalance):
           for (pLoopPlot) in plots:
            if (pLoopPlot.canHaveBonus(bonus, True)):
             if self.isBonusValid(bonus, pLoopPlot, bIgnoreUniqueRange, bIgnoreOneArea, bIgnoreAdjacent):
              pLoopPlot.setBonusType(bonus)
              resources_placed.append(type_string)
              #print "placed", type_string, "on pass", pass_num
              break # go to the next bonus
    

    Code for generating the map jumps around a lot, this is just a small piece of the puzzle but I think making this more aggressive or making a new version might be a good step in improving random map generation. I assume the c++ version is similar. Looks like it checks to see if those specified bonuses exist at least once on the map and if it doesn't it will place 1 of that bonus close to a players start location and moves on to the next bonus.

    A better method that recalculates bonuses could consider map size and num players. Could have it ensure more then 1 resource is on the map - perhaps have 2 or 3 levels for how common a resource should be. Maybe an xml tag would be good for which bonuses should be recalculated and how common. default 0 value could be no recalc so it would be 1 tag.

    There is code that counts num of everything for logging. You got an idea for what will happen when a map is considered invalid?

    For the space map generators Github project I was thinkin it might be good to split the map up into the required space regions before the python map script part - so probably in the dll. Then call a bunch of different map scripts sepatately, giving them the plots of 1 region each. If you split you map like that instead of in the python you will end up with the exact mapscripts you guys will need for multimaps.
     
    billw2015 likes this.
  3. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,081
    Gender:
    Male
    Location:
    Las Vegas
    You don't really need different regions on one map. The multimaps coding in place so far assumes you'll be generating an entirely new map at the point the game calls for that map to be made and then added to the list of maps you have. The dimensions can differ (iirc) and the scripting to run can differ, but we need to add the programming to call the new map to be created and what happens at that point based on what map type is requested in that call. We need to then define at what points various calls are made - what triggers them to be necessary now, as we decided we'd want the game to only generate them when a demand for them emerges. This is actually one of the few real things that's standing in the way of real progress here now.

    I know we will probably need to build those triggers into being the result of what happens when you get the opportunity to see or reveal into another map and/or travel there by a unit mission, even if its to a random place on that map. Some unit missions, or perhaps even buildings being constructed results or a tech being invented may give us the first opportunities to put eyes on what exists on a map and that would likely be taking place before a unit goes there - I mean, we've been able to observe the bright side of the moon from the planet's surface enough to 'see' the map of that portion of it since the first observatory I'd say. So, perhaps a starting trigger might be to reveal half the moon map at the construction of the first observatory. Just as an example. And when that happens in the game, since we are looking to reveal a map that is yet to be defined, that's when the moon script generator would kick in and pump out a moon map of such and such X by Y size based on a % of the size of the Earth Map in play. At the same time, I suppose an orbital map that shows the Planet and cislunar space and then the moon planetary body in a plot would also be generated, or perhaps that waits until we have a satellite or something.

    On that cislunar map, btw, I'd like to see some python that controls a round by round repositioning of the moon that indicates its orbit. I don't think it has to be too concerned about how fast the moon is actually orbiting based on the amount of time that's passing - it's more just for flavor, like all unit movements on the map are allegorical. The spaces around the planet and the space of the moon itself would be the valid portals into which some units could access a mission to go 'to' the next map, and in the case of the tiles around the planet, each would have a corresponding zone on the planetary map that would be enabled for the incoming unit to select to be placed once the mission deposits them onto that map.

    This might take some popup screen work for giving unit owners the opportunity to select where on the alternative map they are 'landing' their incoming unit.

    Anyhow, to start with simply building out the ability for the game to generate these alt maps and running them through the sequences that actually generate them would be brilliant! Imo, it's certainly our next step in designing towards MMs.
     
  4. MattCA

    MattCA Chieftain

    Joined:
    Jan 25, 2019
    Messages:
    142
    Gender:
    Male
    The last game I played was version 36. When version 37 came out I didn't really want to keep playing if I couldn't use the new space stuff with that game. Seeing the second half of the tech tree get filled up also made me realize how active the mod still was. So I started learning the code beginning with the xml. And lately the mod is even more active so I'm not too late.

    Point is I know nothing about the future eras.

    There is xml for the x and y size of the multimaps already but I like the idea of going off of the size of the earth map more. Better then the maps being the same size for every game.

    So all the maps for the planets are accessed through an actual spacemap map? How does a unit with land domain switch maps? Click a mission then player gets a new unit on the spacemap and the original unit disappears?
     
  5. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,081
    Gender:
    Male
    Location:
    Las Vegas
    Yeah we'd probably need a new tag for each map type entity. I imagine we could really make an info type for each that really guides a generic scripting process as well. % of the original Earth map size would make everything relatively consistent to the initial scaling.

    Well mind you that the missions would need to be programmed out so some of that is still subjective. However, I see land domain units as largely requiring being loaded onto a space transport to be capable of transitioning maps and it's the space capable unit that would go out.

    We would need a map for Cislunar space (between the earth and moon) and then a map for the solar system as well, wherein each planet, wherever it ends up in terms of plot would be the portal for transitioning between the cislunar maps for those planets for units capable of making the transition.
     
    MattCA likes this.

Share This Page