Announcement

Collapse
No announcement yet.

Controlling Settlers?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by BureauBert
    I just wonder how the latter (g.last_player) would work for the Diplomod script which needs to set up these huge arrays for storing e.g. the "has contact" information. For this setup a definite number of (max-) players is needed, as far as my understanding goes . I suspect that using g.last_player for this purpose would screw things up as soon as an additional (splinter-) civ appears. At least I think this is what already caused a lot of problems with the original version of Diplomod, and caused me to modify the setup of the array:
    I changed it from
    Code:
    DIP_hascontact[(DIP_NumOfPlayers * DIP_NumOfPlayers) + DIP_NumOfPlayers]
    to
    Code:
    DIP_hascontact[(MOD_MAXPLAYERS * MOD_MAXPLAYERS) + MOD_MAXPLAYERS]
    ... where MOD_MAXPLAYERS comes from the known function using preference("MaxPlayers"). For being on the safe side I could have used e.g. "28" instead of "MOD_MAXPLAYERS" as well, but I have been afraid that this would blow up the array enormously and need a lot of memory. Using g.max_player for this purpose would probably have this effect, too (but I really don't know anything about memory allocation). In this case I imagine a reliable variable containing the original preference value (= the maximum of players in the current game, and keeping this value even if the userprofile settings are changed in the meantime) could be useful. But certainly Dale or someone else who worked more intensely with Diplomod could tell if this actually is the case.
    I guess the difference between the "exe's MaxPlayers" and the "current game's MaxPlayer's" wouldn't hurt so much regarding the size of other arrays that need to be set up at gamestart and indexed by players - so it might be preferable to use g.max_player for these.
    Yes this is indeed a problem of Diplomod, I think this is the cause that ApolytonPack crashes when a splitter civ is added. And you are right g.last_player would screw things up, as NumPlayers from the userprofile.txt, and as you can set MaxPlayers to 0 you see that is not the solution either.

    I tried to use a constant for that array something like 32 or 40 I don't know what it was exactly. That was the reason for the constant of g.max_players, to allow slic writers not to hard encode this value into the scripts, so that noone needs to change their scripts if we increase the maximum. However back to my original point, with the constant we had some problems, it was odd half of the time we were able to start a new game, but the other half of the time the game crashed.

    -Martin
    Civ2 military advisor: "No complaints, Sir!"

    Comment


    • #17
      This thread is almost a chatroom this evening.
      Finally, let's threadjack it together!
      By saying:
      ... with the constant we had some problems, it was odd half of the time we were able to start a new game, but the other half of the time the game crashed
      ... do you mean the game crashed when you used a high number like 32 for setting up the Diplomod arrays while trying to fix it for the APOLpack (because the arrays grew too big)?
      In the game I just started for testing I replaced the "MOD_MAXPLAYERS" stuff with g.max_players, therefore my diplomod version must have set up an array like this in the first turn:
      Code:
      DIP_hascontact[(32 * 32) + 32]
      in other words:
      DIP_hascontact[1056]
      I never calculated this before, it's *really* huge Well some minutes ago it didn't crash the game, just setting up the array doesn't seem to do any harm.
      However: g.max_players is a useful variable - specially now we all know the correct syntax
      The modding knowledgebase: CTP2 Bureau (with CTP2 AE Modding Wiki). Modern Times Mod (work in progress): MoT-Mod for CTP2.

      Comment


      • #18
        Originally posted by BureauBert
        I never calculated this before, it's *really* huge Well some minutes ago it didn't crash the game, just setting up the array doesn't seem to do any harm.
        Actual this is not so big just 32*32 + 32 = 1056.

        My Continent ID function in MG_Functions.slc holds for each tile the continent ID and the default gigantig world map has 140*70 = 9800 and the arrays I use to calculate these continent IDs, becomes during calculation much bigger. But indeed it was odd with a constant value for the Diplomod function we experimenced crashes randomly.

        -Martin
        Civ2 military advisor: "No complaints, Sir!"

        Comment

        Working...
        X