Announcement

Collapse
No announcement yet.

creating natural disasters via SLIC????

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

  • creating natural disasters via SLIC????

    i was looking at the SLIC flags, and started wondering if we could use them to simulate natural occurances. IF random locations are possible, we could have that spot get hit with an bombardment to simulate an earthquake, or plaque. Since bombardment can kill population and destroy buildings, a strong earthquake might consist of several bombardments. If nothing exists at the randomly selected location, nothing would happen. Also, a random weather number could give global food bonuses some years, and droughts in others.

    Since my SLIC knowledge is limited, i figured i'd throw it out to those who have used it more.

    ------------------
    History is written by the victor.

  • #2
    Since you can change land you can write a sliccode that can grow mountains and such anywhere on map, and adding beaches where you need them. Could be pretty cool.

    Comment


    • #3
      [Note: I have not yet looked at SLIC this is all pseudo code]

      Okay 1st you should create random locations on the map.
      If the map was 100x100 to create a random location you could use this (in Pseudo Code - I'll post how to do it in slick [hopefully] once Ii get back from a holiday)

      CreateRandomNo(1-100) -> Store it in variable i
      CreateRandomNo(1-100) -> Store in variable j
      Variable TempLoc = [i,j]

      Now say you wanted 10 locations. A for loop should doo that

      Creat loop from 1 - 10 -> Variable m
      {
      CreateRandomNo(1-100) -> Store it in variable i
      CreateRandomNo(1-100) -> Store in variable j
      Variable TempLoc[m]=[i,j]
      }

      Maybe that could work for random locations. The first should work, but I don't know about the second. If the second one didnt owork you could just do the first one x amount of times, and cjust change the name of the temploc varibale.

      Hope you understand, and I hope someone can convert my pseudo into SLIC

      Comment


      • #4
        Good idea of writing it out in psuedo code. Here's what i was thinking:

        pick an event (drought, great weather, quake, plague,none)

        if drought (10%)
        global decrease in food

        if great weather (10%)
        global increase in food production

        if quake (40%)
        determine richter factor (1 to 7)
        bombard location richter times (if city only)
        determine 1 tile radius around epicenter and bombard those tiles richter/2 times (if city only)

        if plague (20%)
        bombard location 3 times (if city or army to simulate deaths)
        determine 1 tile radius around center and bombard those tiles 2 times (if city or army to simulate deaths)
        if any of the tiles are a city
        infect it (gives plague a chance to spread)

        that leaves 20% when nothing happens. And the majority of quakes and plagues wont hit anything and cause no damage unless the radius is enlarged

        It seems that this should be doable.

        ------------------
        History is written by the victor.

        Comment


        • #5
          Okay, this code is to find a random location, and also for me to learn SLIC. I have come across a problem which ill describe at the end.
          scenario.slc
          Code:
          #include "msg.slc"
          int_t i;
          int_t j;
          int_t no_of_disasters;
          int_t x;
          int_t temp_locx[];
          int_t y;
          int_t temp_locy[];
          
          HandleEvent(BeginTurn) 'DStart_F' pre 
          {
          	Message (1, 'AGStartA');
          }
          
          HandleEvent(BeginTurn) 'DEachTurn_F' post 
          {
          	if (random(3) == 1)
          	{
          		i = random(20);
          		j = random(20);
          		no_of_disasters = 2; //Change the '2' to how many natural disasters you want
          		for(x = 0; x < no_of_disasters; x = x + 1) 
          		{
          			temp_locx[x] = i; //x value
          		}
          
          		for(y = 0; y < no_of_disasters; y = y + 1) 
          		{
          			temp_locy[y] = j; //y value
          		}
          	}
          }
          msg.slc
          Code:
          messagebox 'AGStartA' {
          	Show();
          	Title(ID_AG_START_TITLE);
          	Text(ID_AG_START_A);
          	Button(ID_AG_BUTTON_NEXT) 
          		{
          			Kill();
          		}
          }
          scen_str
          Code:
          AG_BUTTON_NEXT		 	"Next->"
          AG_START_TITLE	"Natural Disasters"
          AG_START_A	"Made by heardie"
          Now why doesn't this display a messagebox when the game loads?
          Do I need to call 'DStart_F'
          [This message has been edited by heardie (edited December 29, 2000).]

          Comment


          • #6
            thats a good ideas Alpha. when I get back on the 7th ill try and implement them. If its not done by then!

            Comment


            • #7
              For the messagebox problem, this will do it.

              Scenario.slc:
              Code:
              //just run once when the game starts
              
              HandleEvent(BeginTurn) 'DonStartGame' post {
              
              	if(IsHumanPlayer(player[0])) {
              		Message (g.player, 'DonTurn0');
              		DisableTrigger('DonStartGame');
              	}
              }
              
              messagebox 'DonTurn0' {
              	Show();
              	Title(ID_DON_TURN_0_TITLE);
              	Text(ID_DON_TURN_0);
              }
              Scen.str:
              Code:
              DON_TURN_0_TITLE "Natural Disasters"
              DON_TURN_0 "\nMade by Heardie"
              Don,
              CtPMaps (Hosted by Apolyton)

              Comment


              • #8
                What happens if the chosen location is ocean? You could add a check that makes sure that the disasters only hit land.

                Also, for droughts, would it be possible to have it actually change terrain - replace plains with deserts, for example? If so, you could add a mini-ice age/el nino trigger with similar effect.

                Finally, with the bombarding, will that also destroy tile improvements? If not, maybe that should be an additional effect of the disasters.

                Comment


                • #9
                  I had actually thought about those options also. Like if the quake was just offshore, to flood flatlands, or if it was a mountain, for it to be a volcano. But at that point I hadnt read too much about SLIC yet so didnt want to get too complicated. I figured quakes would destroy mines, road/rail, but farms and adv farms wouldnt be that affected by some ground shaking. I figured it would take quite a few years of drought to turn land bad or good years to turn desert into plains, so I didnt know how realistic those options would be. Altho natural disasters seem to happen alot, the big world changing ones are rare.

                  I'm glad I'm not the only one that thinks this is viable

                  ------------------
                  History is written by the victor.

                  Comment


                  • #10
                    quote:

                    Originally posted by wheathin on 12-29-2000 10:05 AM
                    What happens if the chosen location is ocean? You could add a check that makes sure that the disasters only hit land.



                    Maybe it could represent a tsunami - the code could search for all swamps within a certain radius and turn them into sea.
                    Watty

                    Comment


                    • #11
                      quote:

                      Originally posted by Matthew Watson on 12-30-2000 11:04 AM
                      Maybe it could represent a tsunami - the code could search for all swamps within a certain radius and turn them into sea.


                      I had figured any flatland would be hit by the tital wave.

                      ------------------
                      History is written by the victor.

                      Comment


                      • #12
                        Instead of using bombardment to destroy things, it might be better to use manually destroy buildings (using DestroyBuilding), damage or kill units (using KillUnit or DamageUnit) or destroy terrain improvements (using CutImprovements) or change terrain (using KillTile or Terraform), change citysize (using KillPop or MakePop), etc. This gives you much more control over what happens and you could even come up with things that reduce the effects of these disasters.

                        One thing though, it's not possible to increase or decrease food or production through SLIC. The only workaround for this that I know is to create and destroy special city-improvements for this purpose (e.g. a city improvement called Drought that decreases food in a city with 10% or a building called great weather that gives 10% extra food in the city). It's not pretty but as far as I see there's no other solution to this.
                        [This message has been edited by Locutus (edited December 31, 2000).]
                        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                        Comment


                        • #13
                          Clever... very clever...keep up the work on this guys, sounds fascinating! I'd love to include random weather in my games, it would help spice things up.

                          Comment


                          • #14
                            part of the fun of adding disasters would be their unpredictability of damage. Once you start specific coding, wouldnt you lose that randomness? Plus even in this day, look at the damage that has been done in Californian quakes, which I guess has the most stringest building codes for surviving quakes. By using bombardment, you never know which buildings might be destroyed or how many if any population is killed. My personal preference is to keep as much totally random as possible, altho I understand that may not be everyones opinion.

                            If we cant do weather via SLIC, how about randomly generated wonders. WONDER_DROUGHT that reduces global food, or WONDER_GREAT_WEATHER that increases it?

                            ------------------
                            History is written by the victor.

                            Comment


                            • #15
                              Well, randomness isn't a problem since SLIC has a Random function. If a quake happened in or near a city you could specify the chance a building is destroyed (even make this specific for certain types or buildings or whatever) and cycle through all buildings and wonders in the city and use the Random function to test if it would be destroyed or not. This is just as unpredicable as the bombardment function, but much more tweakable (e.g. you could make a Bank much more likely to survive than a Factory or whatever).

                              One problem with the wonder/advance I forgot to mention is that there is a max of 64 buildings & wonders, so you can only have so much of these events. Also, the disadvantage of using a Wonder instead of a building is that you can only have one at a time, which might be undesirable (but sometimes it might not matter, so it's still useful but only when no more than one at a time is needed).
                              Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                              Comment

                              Working...
                              X