Python for map script question : CyMapGenerator().addGameElements() ?

Sto

Should i code today ...
Joined
Dec 15, 2005
Messages
1,144
Location
Marseille (France)
Hi !

I wonder what serves the function CyMapGenerator().addGameElements(). Is this the function which adds the settler and the starting unit? If so, does it do only that? I did not find any information on this function .

I try to override it like you can do with AddBonuses or AddBonusType without success . Or are the functions of CyMapGenerator different from those of CvMapGeneratorUtil and are used for another thing ? I am lost a little!

I think that by adding elements of game (units, cities...) in my script, that causes a bad Sinchronization (' OutofSinc') in multiplayer. And I will like to solve this problem !
Could somebody give me informations on this function, or help me to solve this problem? It would be great !!

Thanks , Tcho .
 
Now I'll readily admit I know zero about map scripts and stuff so I can't help you much, but according to the source code, CyMapGenerator().addGameElements() adds Rivers, Lakes, Features, Bonuses and Goodies.

If code goes Out of Synch, that's normally because different players have conflicting game data, e.g. one player's code gives a million gold to all civs, but another player's code doesn't. Assuming all players are using the exact same set of files, this will mostly happen if you do stuff with unsynchronised random numbers or with getActivePlayer as part of a conditional statement. If you can't find anything in your code that might cause this to happen, try and dump all game info for every player in an MP game to a file and compare the differences.
 
Thank you !
Your answer helps me to understand how a game in multiplayer is launched. In fact I thought that the map was generated by the hosting player ,and that the others only recieved the result ?!

If yes ?

Even if I do not know how the game in multiplayer launches out, There is something I don't understand. Indeed, after having done many tests, I always obtain the same result (also in single player game , that's why I think there is anything else !) :

as soon as I place a unit in script for a player (human or AI), it seems that it have a bad initialization there. The settler and the starting unit do not appear (I have only the added unit). But only for the player concerned.
However when I place the units in the function ' startHumansOnSameTile() ': My unit is well created and does not cause problems of synchronization (but only for me).
As this function is called for the human players and the last entry point for map generator , I wondered whether it did not form part of a phase of initialization of the units, in which it is allowed to declare units?
I thus wonder how to integrate (or initialize) these units for each player?
Or perhaps one needs a LOG to be able to create a unit which is not defined in the map script . (Adding a unit during the play is always associated with an event) ? Is this possible to force the LOG ?

Perhaps will somebody have an idea with this example?

THanks, Tcho !
 
Back
Top Bottom