Announcement

Collapse
No announcement yet.

Creating map script: island start

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

  • Creating map script: island start

    Being a fan of the maritime strategy, I sometimes like to play a game where I start isolated on a small/medium sized island. Unfortunately, I am not a programmer and don't know how to weave my ways through the mysteries of Python.

    So with that said -- I'm looking to create a map script that I can tack on to, for instance, the 'continents' and 'terra' scripts to guarantee that player one will always start on its own island.

    Any hints on where to start with this project?
    "The nation that controls magnesium controls the universe."

    -Matt Groenig

  • #2
    Bump. No thoughts on this?
    "The nation that controls magnesium controls the universe."

    -Matt Groenig

    Comment


    • #3
      Play Custom Continents and select 1 continent per player.

      Comment


      • #4
        If you want to allow the ai to start on a continent, several together, then you may want to modify an existing kind of map and add an island on it for the player to start in?
        If so you should first decide what size the island should be.
        You can then generate a map with reasonably enough water and put an island in a free space.
        The best thing is probably to start learning python by looking at the custom continents script.
        Clash of Civilization team member
        (a civ-like game whose goal is low micromanagement and good AI)
        web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

        Comment


        • #5
          LD -- yes, this is exactly what I wanted to do -- a sort of "Great Britain/Japan" starting position. I was thinking of doing it in both the basic (non-custom) Continents and the Terra map. But I'm not sure how to define size/location/etc.

          I've looked through the python scripts as they are and, alas, it might as well be Kurdish to me. Is there a primer (accessible to a noob like me,) on map scripting in python anywhere?
          "The nation that controls magnesium controls the universe."

          -Matt Groenig

          Comment


          • #6
            No primer that I know. You can try http://apolyton.net/dir/index.php?si...s=5648&cat=353
            it's DougM's fair continents script. He said it was a base people could start from. This particular map script generates very geometrical shapes, you can check if it's understandable.
            It reuses the base, fractal generator, which I don't know well since I don't like fractal maps. What I rewrote uses seeds, so it would be possible to create a land seed somewhere and prevent other land seeds nearby, then make sure the player starts on that landmass.
            A quick check of Terra script:
            You can either rewrite the isValid function. It makes sure that the player starts on the biggest landmass and take the part of the script labelled 'Now the Carribean Islands' and modify the coordinates to add an island like Great Britain or Japan. Or you can use the Minor Regions and ensure the player starts on it, but I'm not sure it always creates an island.
            I don't know how you can do this easily on Continents as the script is more random.
            Clash of Civilization team member
            (a civ-like game whose goal is low micromanagement and good AI)
            web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

            Comment


            • #7
              Interesting. I'll take a look at that script when I get home and see if it makes any sense. Before I take a look, though, what is the difference between 'fractal' and 'seeds'?

              I assume: a land seed is a script that instructs the program to generate land based in a certain area. Do you have to specify the area on the map using coordinates?

              I confess I've no idea what the fractal generator does....
              "The nation that controls magnesium controls the universe."

              -Matt Groenig

              Comment


              • #8
                A fractal map actually uses seeds to generate terrain at a certain altitude. It divides the map in, f.e. 4 parts, and gives an altitude to each part. It then repeats the process for each quarter and iterates. The base process normally generates mountain ranges in the middle of lands. In order to avoid that, the scripts uses different fractals for land, hills and mountains. Thus mountains are created utterly randomly, and so are hills (though you can only get hills on lands and mountains on hills).
                You can check this in CvMapGeneratrUtil.py . I wouldn't say the code is easy to understand if you don't know fractals. Don't bother with the mountains/hills part, only the continent one (not that it'll be much easier, since they reuse the same function).
                My algorithm uses seeds to plant plates and then move them a bit according to tectonics to generate mountains not in the middle of lands but on the borders.
                Clash of Civilization team member
                (a civ-like game whose goal is low micromanagement and good AI)
                web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                Comment


                • #9
                  Looking through it, and I was wondering: if I take the "Carribean Islands" script, won't I have to redefine WHERE the islands are supposed to be located? How do I go about doing that?

                  And, double-checking, I see that there's a variable for the "[Indian] Subcontinent" script; sometimes it's a pangaea, sometimes it's akin to continents, and sometimes it's akin to an archipelago. Perhaps I could just set it to ALWAYS be archipelago and then make sure that player one is always set to start there. How do I redefine the "isValid" script to change player one start location?

                  THanks again for your help and patience with me on this.

                  JKP
                  "The nation that controls magnesium controls the universe."

                  -Matt Groenig

                  Comment


                  • #10
                    You can either relocate the coordinates of the Caribean or force the Indian subcontinent to be an island, or you can copy/paste (or make a function, that's better, but if you don't know programming, try cut and paste) the Caribbean part, and change the coordinates of the new pasted code.
                    For the isValid, you have to find out who the player is (wrt the ai - I haven't done it, don't know how to retrieve that) and force the position. I'm sorry I don't have time to look into this right now, I may have some time to check it later though.
                    Clash of Civilization team member
                    (a civ-like game whose goal is low micromanagement and good AI)
                    web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                    Comment


                    • #11
                      Okay. Thanks for all of your help.

                      I tried a simple thing last night, just tried to cut the map resizing from the Terra.py script and paste it into the generic 'continents' script, thinking I would get Terra-sized maps with a random continent generator. Refused to load at all. I've no idea what was wrong there, either.

                      If nothing else, it proved to me that I'm in over my head with this python scripting, and I maybe should just wait until the SDK comes out.... :-(
                      "The nation that controls magnesium controls the universe."

                      -Matt Groenig

                      Comment


                      • #12
                        Problem is Terra and continents don't use the same base class. Continents uses FractalWorld while Terra uses another one with a funny name. So the methods of one aren't available in the other.
                        Clash of Civilization team member
                        (a civ-like game whose goal is low micromanagement and good AI)
                        web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                        Comment


                        • #13
                          Okay....so what is a "base class"?
                          "The nation that controls magnesium controls the universe."

                          -Matt Groenig

                          Comment


                          • #14
                            You'll have to learn a bit of python and object oriented programming to understad that.
                            Roughly, the map generators use various algorithms. There are 3 main algorithms used in civIV, each one embodied by a "class". Each script uses one of these classes, sometimes subclassing it (i.e. it changes one method or a set of parameters but keeps the rest of the algorithm identical). Here you have two different algorithms, you can't use functions defined in one in the other because the variables and other routines are not there.
                            Clash of Civilization team member
                            (a civ-like game whose goal is low micromanagement and good AI)
                            web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                            Comment

                            Working...
                            X