Map generation and Bonus placement

cfeyyaz

Chieftain
Joined
Oct 4, 2005
Messages
93
Location
Istanbul
Hi, I would like to make alterations regarding the bonus placement on randomly generated map(s):

1. I want to allow bonus resources to be placed adjacent to another bonus resource.
2. I want to adjust how much a starting location is sweetened by additional resources.

Are there any mods/map scripts that one of those features have already been made available?
Is there a way to implement those changes by myself by editing python files? If yes, which files should I look into and which sections on those files are responsible for placing the resources? Btw, I have some experience with programming.

Thanks in advance! :)
 
The first one can be done in the map scripts. Most of the scripts farm out placement of resources to a general utility bit of Python CvMapGeneratorUtil.py so if you make changes there it will affect all random maps.

The second, starting location, I have not been able to work out. It appears to be a mix of dll code and python code.
 
The first one can be done in the map scripts. Most of the scripts farm out placement of resources to a general utility bit of Python CvMapGeneratorUtil.py so if you make changes there it will affect all random maps.

That seems promising. Unfortunately, I spent a lot of time looing at the CvMapGeneratorUtil and also at the individual map scripts and I found very little that governs the resource placement and also nothing that denies resources to be placed adjacent to other resources. Maybe my eyes are not well trained, although I have some experience with programming (but very little with python). Could you be more specific? :)
 
For the most part the resources are placed during map generation. There is nothing that bans them being placed together, but most maps spread them out. Also the default implementation does this as well. The clustered resources you may encoutner sometimes in the starting plot are luxuries which are placed and then multiplied by number of civs in the game, in order to give you enough to trade potentially with a bunch of foreign civs.

Here is some code that I use to alter starting location in a map script:
Code:
#This is called at end, after players have been placed and given techs
def normalizeAddExtras():
    #get reference to map
    map = CyMap()
    #get global context
    gc = CyGlobalContext()
    #find how many players in the game
    player_num = gc.getGame().countCivPlayersAlive()
    #cycle through all alive players
    for iPlayer in range(player_num):
        #get this player
        pPlayer = gc.getPlayer(iPlayer)
        #get his starting plots
        pPlot = pPlayer.getStartingPlot()
After that all the plots adjacent to the starting plot, which is the plot where the game places the settler, can be checked for resources or have resources added to them.
 
Top Bottom