Announcement

Collapse
No announcement yet.

creating natural disasters via SLIC????

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

  • Well Radical, I had a look at your files but you sent me an obsolete version so I had to go with the stuff in this thread and fill in the blanks here and there. But my conclusion is unfortunately the same as yours: for some weird reason the local variable tmpCity seems to be behaving like a global variable. Before a value is assigned to it, it contains the value it had the turn before and (even weirder) if an invalid city is assigned to it, it will still contain this previous city. This is a very weird bug and I haven't got a clue as to what's causing it or how to solve it.

    Harlan, saw your post but don't have time to read or answer it, I'll look at it tomorrow.
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

    Comment


    • You pretty much described in much greater detail what I originally had envisioned. I just didnt distinquish between land based and water centered events.

      I would think things like "IMPROVE_BUILDING_CODE" would limit the damage from quakes and hospitals would limit plagues.

      I personally prefer all the events be totally random that can hit any civ or empty area.

      A drought alone wont kill people but should affect the food supply. If it lasts long ehough, it can cause starvation. Especially if you lower the # of turns that food buildings protect against famine.

      So many of the tile improvements wouldnt really be affected. Farms and nets would survive pretty intact and so would strip mines. By the time the most advanced (tile or city) improvements come about, those improvements by default would be quake resistant.

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

      Comment


      • Alpha,
        I'm a bit confused- you say "I personally prefer all the events be totally random that can hit any civ or empty area", but in your previous post you say: "it would be cool if we could somehow create fault lines and have the quakes concentrate there." Are these contradictory statements or am I missing something?

        Also, the way you describe famine happening would be preferrable, but can SLIC do that? I was under the impression that SLIC has virtually no control over food numbers. I hope that's wrong though.

        Comment


        • Harlan, pretty much all you describe is possible, though it doesn't even come close to what has beeen coded so far. The code in this thread could well be used as a basis for writing the final version but as it is, it's all a bit too simplistic and mainly intended to see if principles work. Making buildings lessen the damage is actually fairly simple, the CityHasBuilding function can be used for it. Yes, disaster can destroy Wonders too if you want too, the type of wonder shouldn't be much of a problem (just means more code). The going-back-a-turn thing is a good point, someone will have to test for that, but if it turns out to be a problem I don't think there's much that can be done about it.

          As I explained earlier in this thread (page 1 and/or 2), SLIC has indeed no control over food numbers, but it *does* have control over buildings, so in case of drought, a building Drought can be put into the city (that can't be sold of course) and that takes away food. This is the only solution that I know of for manipulating food/production numbers, but since you can only have 64 buildings in Improve.txt it has to be used sparsely. Examples of this can also be found earlier in this thread.
          Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

          Comment


          • Harlan,

            While it CAN be done, I am not sure it will be very efficient to script. I am speaking of the part of your idea where it 'finds' a hill or trench. There is no built in function i am aware of that can do that. One would have to search through the nearby tiles one by one in search of a hill or trench. If you have a search area of 10 by 10 thats 100 tiles to check through. If it doesn't find a hill you have to pick a new random spot and do it all over again. Late in a game this might slow down the game quite a bit.
            My idea would be to just pick a random tile and stick with it. Check what kind of tile it is, then base the disaster on the terrain type. If its plains and no hills (just check the surrounding 8 tiles) then make the disaster a 'Tornado' instead of an earthquake. If its mountain, then its a volcano... If its forrest then the disaster could be a forrest fire.
            As for the go-back-a-turn cheat I don't know of any workaround to prevent that. If Random() is truely random then I would assume you could go back a turn to avoid the disaster. The only way around it would be to pick random spots in advance by so many turns. That way you would have to save manually every turn and go back a ways to get around getting hit.

            Comment


            • whoops, posted 3 times. Sorry
              [This message has been edited by Jerk (edited February 05, 2001).]

              Comment


              • whoops, posted 3 times. Sorry
                [This message has been edited by Jerk (edited February 05, 2001).]

                Comment


                • Didnt mean to confuss you Harlan. What I was trying to say and the words werent coming to me, is that I wanted to make sure that these disasters did not only impact the human but also impact the other civs too. I like the idea of making tornados being that I've spent my entire life listening to tornado alarms. Never seen the actual spiral except in mini dust devil form, but have seen the starts of some and they aint pretty.

                  I was thinking about the fault line concept. What if at the beginning of the game, we save off 3 or 4 or more quakes areas based on geography, then 3 or 4 turns in advance, randomly pick one of these "faults" to experience the quake. By determining the fault lines only once at the beginning, it minimizes the the effect on game speed. By picking the location(s) 3 or 4 turns in advance, the player cant just reload the last turn.

                  loc_t FaultLine[6]; 6 fault lines (mountains/hills clusters)
                  loc_t TornadoAlley[4]; 4 tornado alleys (plains/grassland clusters)
                  loc_t HurricaneZone[4]; 4 hurricane/typhoon zones (coastal)

                  randomly pick a future turn and disaster type
                  randomly pick from the appropriate disaster array
                  randomly pick the epicater/eye say x # tiles from array location

                  HandleEvent(BeginTurn) pre
                  if year == disaster year
                  trigger disaster

                  Not great psuedocode here but hopefully you understand what I'm getting at. Could even save a strength factor for each array telling how often and severe that specific disaster is.

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

                  Comment


                  • Jerk, I agree on the finding a hill thing, it's too slow to be useful but if you keep the search limited to a 2x2 or 3x3 area, it could still be done. But I like your option of giving every terrain type it's own disaster type(s) as well.

                    Here's an email discussion Harlan, AW and I had the past few hours (AW couln'd log in at Apolyton so he had to resort to email). '>>' is AW, '>' is Harlan and the rest is yours truly...

                    AW, you can change your email address in your profile, that should solve the problems you're having. Odd how the script even accepts mail adresses with spaces in them, those are by definition invalid...

                    >
                    > > Didnt mean to confuss you Harlan. What I was trying
                    > > to say and the words werent coming to me, is that I
                    > > wanted to make sure that these disasters did not
                    > > only impact the human but also impact the other civs
                    > > too. I like the idea of making tornados being that
                    > > I've spent my entire life listening to tornado
                    > > alarms. Never seen the actual spiral except in mini
                    > > dust devil form, but have seen the starts of some
                    > > and they aint pretty.
                    >
                    > I also agree the disasters should hit the AI. Is
                    > there anyone who doesn't want that?
                    >
                    > > I was thinking about the fault line concept. What
                    > > if at the beginning of the game, we save off 3 or 4
                    > > or more quakes areas based on geography, then 3 or 4
                    > > turns in advance, randomly pick one of these
                    > > "faults" to experience the quake. By determining
                    > > the fault lines only once at the beginning, it
                    > > minimizes the the effect on game speed. By picking
                    > > the location(s) 3 or 4 turns in advance, the player
                    > > cant just reload the last turn.

                    The turns in advance thing occured to me as well, but I first wanted to check if it was needed: when I restart a game I get exactly the same stuff from goody-huts, which are supposed to be random as well (and I presume restart and reload work the same), so random may not be all that random after all. Activision may have thought of this already and took it into account so it might not even be necessary to do this (although giving a warning in advance is a nice idea...).

                    > > loc_t FaultLine[6]; 6 fault lines
                    > > (mountains/hills clusters)
                    > > loc_t TornadoAlley[4]; 4 tornado alleys
                    > > (plains/grassland clusters)
                    > > loc_t HurricaneZone[4]; 4 hurricane/typhoon zones
                    > > (coastal)
                    > >
                    > > randomly pick a future turn and disaster type
                    > > randomly pick from the appropriate disaster array
                    > > randomly pick the epicater/eye say x # tiles from
                    > > array location
                    > >
                    > > HandleEvent(BeginTurn) pre
                    > > if year == disaster year
                    > > trigger disaster
                    > >
                    > > Not great psuedocode here but hopefully you
                    > > understand what I'm getting at. Could even save
                    > > a strength factor for each array telling how often
                    > > and severe that specific disaster is.

                    Yeah, nice but you'll have to analyse the entire map at the beginning of the game, which is a very resource intensive process and will take quite some time (esp. on gigantic maps or larger and on slow computers). Not sure if that's worth it (though we'd have to try to see how slow exactly it is).

                    > I really like the idea of determining the disaster
                    > will strike a few turns in advance to prevent people
                    > from reloading the turn. It could lead to a really
                    > cool feature: with some tech, you'd be actually told a
                    > few turns that a disaster would strike, giving you
                    > time to build buildings that would reduce the effects.
                    >
                    > As for the faultine concept, it has merit. I guess
                    > its up to whomever actually writes the code to decide
                    > best how to do it.
                    >
                    > I'm not big on tornadoes and hurricanes though. While
                    > I'm sure they're very terrifying to be in, their
                    > damage isn't that great in the greater scheme of
                    > things. You don't ever get something like half of
                    > Miami or St. Louis competely destroyed, or half the
                    > population killed off. Hurricanes might cause a bit
                    > more damage, I dunno, correct me if I'm wrong on
                    > either of these. I am a bit more intruiged with the
                    > possibility of hurricanes/storms that destroy ships.
                    > Certainly countless ships have gone down over the
                    > years due to storms.
                    >
                    > Harlan
                    >
                    >
                    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                    Comment

                    Working...
                    X