Announcement

Collapse
No announcement yet.

Natural Disasters

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

  • Natural Disasters

    This was first proposed here by Alpha Wolf, and Radical_Manuvr managed to get some code almost working. I mentioned starting it again in the Apolyton pack thread, and started looking at the code, but it was pointed out that a separate debate was needed.

    So:
    What natural disasters should be included?
    What effects should these have?
    How often should they occur?
    Should it affect the AI?

    ...and most importantly, (SLICers) why is the random function crashing the game wihtout an error message?

    I have re-written Radical's code, with some small refinements, but it still crashes the game every time an earthquake hits.

    Here is my file if anyone wants to take a look, it has included some of Harlan's comments about disasters.
    Concrete, Abstract, or Squoingy?
    "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

  • #2
    What would be great is if you could build something like "Fire Brigade" to prevent fires.

    Sheeps bladders to prevent Earthquakes, perhaps? Seriously, I'd like to see things that could be adjustable, based on the buildings.

    Natural disasters should destroy buildings. Plagues should reduce population by a good perentage.
    Bluevoss-

    Comment


    • #3
      Plagues will certainly be affected by buildings. Aqueducts, Hospitals, Drug stores will all reduce the chances of a major plague or reduce its affects if it does hit. These can be set into arrays to be easily changed depending on which mod you want to run it on.

      At the moment, nothing can predict earthquakes, and I don't want to add to the buildings just to have a solid-foundation or something to stop them doing so much damage. Maybe arcologies could act as a damage reducer for earthquakes.
      Concrete, Abstract, or Squoingy?
      "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

      Comment


      • #4
        IW,
        You forgot to attach your file. I wouldn't mind taking a look at it but I couldn't help last time so I don't know if I can help now. I do know that Random() isn't causing any problems, I tested it thoroughly back then and I used it lots of times since. It's probably Event:CutImprovement but I can't guarantee it.
        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

        Comment


        • #5
          Sorry, too busy zipping it to attach it

          I'm glad its not the random function, its very useful . If it is the Event:cutimprovement, could it be that there must be an tile improvement there else it crashes with an out-of-bounds error?

          I didn't run a checker line in the code, but there is a function in the above thread that would check very nicely.
          Concrete, Abstract, or Squoingy?
          "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

          Comment


          • #6
            WTF
            Attached Files
            Concrete, Abstract, or Squoingy?
            "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

            Comment


            • #7
              Ben,

              Has your code been tested yet????? (Sounds like it is still in process, judging from the above posts.)

              If so, you know it will have a place in Cradle - just have to clear out some space for it....

              I agree with Bluevoss - Plagues for pop. reduction and earthquakes for building destruction. I have mixed feelings whether it should affect the AI though.

              Can you set up the messages to specifically tell where the disaster happened? And if the AI is also affected, can you give a message to the human saying that an AI civ has had a disaster?

              After all, I may want to send some 'humanitarian aid' with my armies
              Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
              ...aisdhieort...dticcok...

              Comment


              • #8
                Ben,
                Has your code been tested yet????? (Sounds like it is still in process, judging from the above posts.)
                Nooooo, nonono. Well, yes, but it has failed the test quite spectacularly...
                If so, you know it will have a place in Cradle - just have to clear out some space for it....
                Cool.

                Plagues for pop. reduction and earthquakes for building destruction
                Yeah, both will also affect happiness, if the CutImprovement event works, I'll be using that too. And earthquakes also damage units in the area.
                Can you set up the messages to specifically tell where the disaster happened? And if the AI is also affected, can you give a message to the human saying that an AI civ has had a disaster?
                YES. That is one bit of the code I wrote that I think works very well. The human gets a message if the plague hits its city, or if the earthquake hits on or near their city. If it doesn't, but does hit near the AI, it messages the human which was the nearest AI city. I also made it check that the human only receives one message per disaster, so that if it has two cities within the affect quake zone, or a human city and an AI city in the quake zone, it just gets told of the nearest human city.

                After all, I may want to send some 'humanitarian aid' with my armies
                I don't blame you. Defending armies with only 50% hitpoints, and all infrastructure ruined and population halved, could make a city vulnerable. (and that is just Richter 6 )
                Concrete, Abstract, or Squoingy?
                "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                Comment


                • #9
                  Ben,

                  I've pretty well got the Quake_Event function working (no more crashes to desktop), it's just a matter of tidying up the details. But:

                  1) As things stand, only a quake with tmpRichter value of 7 or 8 will affect tiles outside it's epicenter (QuakeLoc). This doesn't seem all that good to me.

                  2) What about restricting earthquakes to locations that are near mountains? I've never been near an earthquake but it seems to me that's where they happen.

                  Comment


                  • #10
                    Originally posted by Peter Triggs

                    2) What about restricting earthquakes to locations that are near mountains? I've never been near an earthquake but it seems to me that's where they happen.
                    That would be more realistic, Since eathquakes usually happens when Tectonic Plates collide with one another that is also the case of mountains. But not only mountains but trenchs and submarine volcanoes. what would add more in strategy, since everybody build sea citys close from this tiles, now we are going to think twice before building in it.

                    And Tsunamis Should happen only on beach and coastal tiles. And destroy boats in shallow water.

                    And IW is right. There shouldnt be a way to control earthquakes until the future ages (arcologies would be nice).

                    Anyway, I dont want to intervein in your work, these are just some of my thoughts.
                    "Kill a man and you are a murder.
                    Kill thousands and you are a conquer.
                    Kill all and you are a God!"
                    -Jean Rostand

                    Comment


                    • #11
                      Ben,

                      I've pretty well got the Quake_Event function working (no more crashes to desktop), it's just a matter of tidying up the details.
                      Thanks very much!

                      1) As things stand, only a quake with tmpRichter value of 7 or 8 will affect tiles outside it's epicenter (QuakeLoc). This doesn't seem all that good to me.
                      As things stand, if a F7 or F8 earthquake hit where there is no city, they affect the surrounding tiles and the ones surrounding them. F1-F6 quakes affect the epicentre and the surroundings. If there is a city then it only affects the epicentre. I think removing the "else" on (my) line 172 will make the quake search the neighbours anyway. I think that was an error on my part. Thanks for pointing it out
                      2) What about restricting earthquakes to locations that are near mountains? I've never been near an earthquake but it seems to me that's where they happen.
                      Okay then, I have no pronlems with that. In my volcano function, I did pretty much the same thing. It only affects mountains, trenches, volcanoes and rifts. (and if there are two beach tiles nearby, it assumes it is a ocean nearby, an therefore the meeting of continental and oceanic plates at a detructive margin, causing stronger [volcanos] than otherwise). That code can be easily chucked into the earthquake function (at least when I last saw the code )
                      Again, thanks Peter . Can you email me the code please, or post it here? Thanks.

                      Pedrunn, I think that earthquakes, volcanoes and plagues need perfecting before we start on tsunamis, but they will go in

                      I dont know how much of Harlan's notes anyone read in the thread above, or that I left in NaturalDisasters.slc, but he mentions that an underwater earthquake should spark a number of tsunamis based on its strength, and affecting nearby shallow water.

                      And lastly, though this might be way premature, do we want hurricanes? I think this would be best implemented if it is possible to find the area of the map where they occur (ie. between 5o and 20o, North and South of the equator). This would add some more regional hazards
                      Concrete, Abstract, or Squoingy?
                      "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                      Comment


                      • #12
                        I thought the code you posted was some discarded stuff from Radical_Manuvr and I've really hacked it around a bit. I hope you don't mind.

                        1) I moved the Quake_Event function in with the rest of the functions. I don't know how the compiler works but I noticed that when I've tried having 'chains' of SLIC files it REALLY slows the game down in later stages. It also let me localize some of the variables; I just think it's easier to keep track of things that way.

                        2) I don't think the KillPop event is working, at least I couldn't see it doing anything. I've replaced them with some AddPops functions with a negative argument.

                        3) You were right about the CutImprovements event. I've got it cycling through the first 24 tile improvement indices. But this will wipe out any of them: it might be an idea to be more specific.

                        4) I recoded the way a quake affects it's neighbouring tiles. A force 3 quake will take out the adjoining N,S,E,W tiles; a force 4 quake will additionally take out the NE,SE,SW,NW tiles; and so on. The way I did this is not exactly elegent: if we had 2 dimensional arrays it would be easy. But we don't and I couldn't think of any other way of doing it than the way I did.

                        5) When I started, I cut out your messages and when I went to put them back in I ran into a few problems. I had trouble using Dale's GetNearestCity Function but as it happens I've got my own version of this sort of function, which I'm more familiar with, so I just plugged it in.

                        Code:
                        //find thePlayer's theNearestCity to theLocation, outside or equal to theDistance boundary
                        //     return the distance from theLocation to theNearestCity
                        //     return -1 if no such city exists
                        
                        int_f FindTheNearestCity( int_t thePlayer, location_t theLocation, int_t theDistance)
                        'theNearestCity' is a global city variable and the function will assign a city to it. It also returns the distance from theLocation to theNearestCity, or -1 if theNearestCity doesn't exist.

                        I also had a problem with the 'human' variable. I'm in the habit of reporting values of variables to the screen to make debugging easier and I've left in the message that reports 'human'. It always seems to be 0; I wonder if this is some background peculiarity of the Mod I'm running. See what you get.

                        For further debugging, there's also a message that gives some details about the quake.

                        I also left in some outcommented code that lets you set the location of the quake. You can then go into cheat mode, place down tile improvements or whatever, and see what the quake does to them.

                        ARGHH: It was the wrong file. This should be the right one.
                        Attached Files

                        Comment


                        • #13
                          Thanks Peter, that sounds great. Don't worry about hacking it around, I need the help

                          I think you attached the wrong file though, or one of the chain. I can't see the changes.
                          Concrete, Abstract, or Squoingy?
                          "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                          Comment


                          • #14
                            BUMP, just to let everyone know that Peter changes the file.

                            Thanks, it looks like it will work now...
                            Concrete, Abstract, or Squoingy?
                            "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                            Comment


                            • #15
                              It is the whole thing working or just the eathquake fuction.
                              If you think that the whole thing is working could you organize it to me. It will be huge pleasure to test it for you guys.
                              "Kill a man and you are a murder.
                              Kill thousands and you are a conquer.
                              Kill all and you are a God!"
                              -Jean Rostand

                              Comment

                              Working...
                              X