|
Author
|
|
Topic: creating natural disasters via SLIC???? |  |
|
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted December 27, 2000 23:30
 |
 |
 |  |
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. |
Depp Prince Luleå, Sweden b.02-15-99
|
 |
posted December 28, 2000 19:24
  |
 |
 |  |
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. |
heardie GGS Co-Webmaster
Aug 1999
|
 |
posted December 28, 2000 19:50
  |
 |
 |  |
[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 |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted December 28, 2000 21:25
 |
 |
 |  |
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. |
heardie GGS Co-Webmaster
Aug 1999
|
 |
posted December 29, 2000 03:17
  |
 |
 |  |
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).] |
heardie GGS Co-Webmaster
Aug 1999
|
 |
posted December 29, 2000 03:41
  |
 |
 |  |
thats a good ideas Alpha. when I get back on the 7th ill try and implement them. If its not done by then! |
skorpion59 CTP Maps Webmaster Tulsa, Oklahoma, USA, (GMT -6) May 99
|
 |
posted December 29, 2000 05:12
  |
 |
 |  |
For the messagebox problem, this will do it.Scenario.slc:
code:
//just run once when the game startsHandleEvent(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"
|
wheathin Prince Charming Apr 99
|
 |
posted December 29, 2000 10:05
 |
 |
 |  |
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. |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted December 29, 2000 11:35
 |
 |
 |  |
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. |
Matthew Watson Settler Edinburgh, Scotland Dec 2000
|
 |
posted December 30, 2000 11:04
|
 |
 |  |
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.
|
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted December 30, 2000 12: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. |
Locutus Prince Apolyton Borg Hengelo/Enschede, The Netherlands Nov 1999
|
 |
posted December 31, 2000 14:19
  |
 |
 |  |
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).] |
Cyrius Chieftain Minneapolis, MN, USA Nov 2000
|
 |
posted December 31, 2000 16:03
|
 |
 |  |
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. |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted December 31, 2000 17:59
 |
 |
 |  |
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. |
Locutus Prince Apolyton Borg Hengelo/Enschede, The Netherlands Nov 1999
|
 |
posted January 01, 2001 13:55
  |
 |
 |  |
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). |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted January 01, 2001 14:20
 |
 |
 |  |
quote:
 Originally posted by Locutus on 01-01-2001 01:55 PM 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).
 |
Ah, now I understand. Yes, that would be more preferrable to bombardment. i had thought you meant that if there was a quake and the city has a bank then to destroy it. I didnt realize that you could cycle thru the buildings in a city and give it a percentage that it would be destroyed. We could have a building called IMPROVEMENT_BUILDING_CODE that would minimize the damage. ------------------ History is written by the victor. |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted January 04, 2001 12:43
 |
 |
 |  |
Have you had a chance to try any of the disaster coding? If you can get it started, I probably can test asd debug it. Its the initial how to set it up in SLIC that I'm not very good at.------------------ History is written by the victor. |
Locutus Prince Apolyton Borg Hengelo/Enschede, The Netherlands Nov 1999
|
 |
posted January 04, 2001 15:25
  |
 |
 |  |
Well, problem is that I'm already working almost full-time on Harlan's scenario and the code for the MedMod, so I don't have much time right now (it will get much worse when college starts again). And even if I had more time, I'm still working on some decent SLIC documentation as well, which has precedence over this, so I won't be able to do much about this for at least the next two-three weeks (probably longer). I was kind of hoping someone else would pick this up. (If you'd dig into the archives you'd find so many SLIC ideas it would take one guy several years to turn it all into code, even if he's working 8 hours a day, so we definately need more people going into SLIC.) |
Harlan ctpmaps.apolyton/harlan Berkeley, CA, USA b.02-15-99
|
 |
posted January 04, 2001 15:59
 |
 |
 |  |
Locutus, When you say there are a max of 64 buildings and wonders, is that something you know for sure or are you assuming that's how it was in CTP1 and its probably the same in CTP2? Also, do you know of any limits to the number of advances? |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted January 04, 2001 16:20
 |
 |
 |  |
Would I be safe in assuming that any file whose first line is the number of entries probably has a limit? Any cases where this isnt true?------------------ History is written by the victor. |
Locutus Prince Apolyton Borg Hengelo/Enschede, The Netherlands Nov 1999
|
 |
posted January 04, 2001 16:29
  |
 |
 |  |
Harlan,Unless Mr Ogre is a pathelogical lie-er(sp?) I'm fairly sure of that 64 limit on buildings and wonders AFAIK there's no limit on advances or units though (and IIRC Mr Ogre confirmed that). Alpha, I don't know, that might actually be the case, it never occured to me that there might actually be a system  |
colorme Warlord
Nov 2000
|
 |
posted January 04, 2001 19:07
|
 |
 |  |
Guys, this is great. But I hope the idea is to restrict all disasters to the human. We don't want to overload the AI's already weak brain do we? |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted January 04, 2001 19:32
 |
 |
 |  |
my AI's brain aint weak anymore. Disasters affect anyone. Whole cities have been wiped out by disasters, so if a civ is by chance hurt, it'll have to bounce back.------------------ History is written by the victor. |
Radical_Manuvr Chieftain Maryland, USA Dec 2000
|
 |
posted January 04, 2001 21:33
|
 |
 |  |
Great idea AW and additions from others. If I decide to "borrow" it for a scenario I'm working on, I'll be happy to post working code. I'm in the very early stages though, so hopefully someone will beat me to it. |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted January 04, 2001 22:27
 |
 |
 |  |
Thanks. i figured its doable but i've been spending so much time improving the AI that I havent had a chance to practise SLIC. I'm also hoping someone will have the time to try this.------------------ History is written by the victor. |
heardie GGS Co-Webmaster
Aug 1999
|
 |
posted January 06, 2001 06:05
  |
 |
 |  |
I'm back now, and ready to code. I hope you dont mind me asking 1 million questions though, eventually. That sucks if you cant change the cities food production, now I need to learn how to make a building. I thought I was so smart too:code:
for(m = 0; m <= player.cities; m = m + 1) { CityFoodDelta(city[m]) = .75 * CityFoodDelta(city[m]) }
Oh Well! |
Locutus Prince Apolyton Borg Hengelo/Enschede, The Netherlands Nov 1999
|
 |
posted January 06, 2001 08:54
  |
 |
 |  |
Heardie, Well, at least it's original Most people would try to use variables to change in-game values (something like city[0].netcitygold = 2 * city[0].netcitygold), never saw anyone using functions for it before  One other thing to be aware of is that SLIC only works with whole numbers, everything after the dot will simply be cut off, so even if your example trigger would have worked, it would have made the CityFoodDelta 0. If you want to say x = .75 * x, you'll have to say x = (x * 3) / 4, or something like that. |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted January 06, 2001 11:47
 |
 |
 |  |
Now I know why I'm leaving the SLIC coding to you guys. ZOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOMMMMMMMMMMMMMMMMMMM------------------ History is written by the victor. |
colorme Warlord
Nov 2000
|
 |
posted January 06, 2001 14:06
|
 |
 |  |
On Slic mathematics, my observation is that if something in a command is not an integer, Slic may simply ignore that command (it won't complain)! I don't know if that's a fact, but that was the effect I seemed to be getting. |
Harlan ctpmaps.apolyton/harlan Berkeley, CA, USA b.02-15-99
|
 |
posted January 06, 2001 16:31
 |
 |
 |  |
Alpha, If its like CTP1, any file that starts with a number can be changed, but you have to change that number too. So if it was the Units.txt, add three new units and then add three to that start number.Luckily, many files now no longer use that number, which is great, cos it was a real pain to keep that straight. |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted January 06, 2001 17:52
 |
 |
 |  |
quote:
 Originally posted by Harlan on 01-06-2001 04:31 PM Alpha, If its like CTP1, any file that starts with a number can be changed, but you have to change that number too. So if it was the Units.txt, add three new units and then add three to that start number.Luckily, many files now no longer use that number, which is great, cos it was a real pain to keep that straight.
 |
I was just making a joke If I had more time, I'd have sat down with the SLIC doc and be doing it myself. But since coding and analyzing crappy code is what I do all day, I mostly just want to have fun when I play. unfortunately, I just cant turn off all those "what if" thoughts 
I really wish they had gotten rid of all the size limitations. Most have really bogged their computers down when they had unlimited everything. Of course, definitions of more of the fields would be helpful. Been playing with the Ai to see if I can maximize its aggressiveness without being reckless. ------------------ History is written by the victor. [This message has been edited by Alpha Wolf (edited January 06, 2001).] |
heardie GGS Co-Webmaster
Aug 1999
|
 |
posted January 06, 2001 19:16
  |
 |
 |  |
Now I am embaressed. I did that in a hurry before I left on holiday. I am aware (now) that this is simply a function that return the cities food prod.  Anyway today I will see what I can learn, cause I have 12 hours and onthing planned. |
Bluevoss Warlord Orlando, Florida Dec 2000
|
 |
posted January 06, 2001 20:06
 |
 |
 |  |
What I would like to see (outside of normal disasters) are some disasters political in nature. Say that your happyness drops 5-10 points in every city, and any city that drops into unrest has a good chance of going barbarian. This might be considered a civil war, the death of a powerful ruler, or something.I think this would be good, since it would give us a reason to keep building all those theaters and stuff that dont seem to make a differnce. Outside of that, does anyone know how to increase the unhappyness due to overcrowding? Thanks, ------------------ Bluevoss- |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted January 06, 2001 20:59
 |
 |
 |  |
quote:
 Originally posted by Bluevoss on 01-06-2001 08:06 PM What I would like to see (outside of normal disasters) are some disasters political in nature. Say that your happyness drops 5-10 points in every city, and any city that drops into unrest has a good chance of going barbarian. This might be considered a civil war, the death of a powerful ruler, or something.I think this would be good, since it would give us a reason to keep building all those theaters and stuff that dont seem to make a differnce. Outside of that, does anyone know how to increase the unhappyness due to overcrowding? Thanks,

|
in const.txt, REVOLUTION_LEVEL 60. By increasing this number you can make cities revolt more often. I suspect from your questions that you are playing on the easier levels. The more difficult levels require some attention to happines. You might also avoid building happiness wonders. ------------------ History is written by the victor. |
Radical_Manuvr Chieftain Maryland, USA Dec 2000
|
 |
posted January 06, 2001 22:37
|
 |
 |  |
AW,Looking at the 4th post on this thread it appears you want an 80% chance of some type of natural disaster to occur every turn. Is that correct? I suppose that is the easy part anyway and could be modified by anyone to have x% chance of the disaster routine on each turn once the other code is written. I'm pretty sure I can get a randomly placed bombardment for the earthquakes. The drought/great weather part seems as though it may be more complicated, but I'll give it a shot. I doubt I could do the tidal wave thing and honestly won't even try. I remember reading something about changing terrain could have unpredictable or undesirable results so I'm not going to mess with that. |
heardie GGS Co-Webmaster
Aug 1999
|
 |
posted January 07, 2001 00:23
  |
 |
 |  |
Radical_Manuvr that would be good if you got to work on the bombardemnt functioons. I will create some simplle framework, like messageboxes and the like, adn determing what disaster occurs. Then you/we can simply insert the functions into the code and get it running.And if i get that all done, I'll also have a go at bombarding but i doubt that i will. Good Luck! |
heardie GGS Co-Webmaster
Aug 1999
|
 |
posted January 07, 2001 00:29
  |
 |
 |  |
RE: To do food production Drought: Create a building that decrease food by 25% IMPROVE_DROUGHT { DefaultIcon ICON_IMPROVE_GRANARY Description DESCRIPTION_IMPROVE_GRANARY EnableAdvance ADVANCE_AGRICULTURE ProductionCost 0 Upkeep 0 FoodPercent -0.25 } Surplus: Create building increase by 25% IMPROVE_SURPLUS { DefaultIcon ICON_IMPROVE_GRANARY Description DESCRIPTION_IMPROVE_GRANARY EnableAdvance ADVANCE_AGRICULTURE ProductionCost 0 Upkeep 0 FoodPercent 0.25 }Can that work? Then all we do is create them, and then after x amount of turns remove them. Is that right? |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted January 07, 2001 00:42
 |
 |
 |  |
quote:
 Originally posted by Radical_Manuvr on 01-06-2001 10:37 PM AW,Looking at the 4th post on this thread it appears you want an 80% chance of some type of natural disaster to occur every turn. Is that correct? I suppose that is the easy part anyway and could be modified by anyone to have x% chance of the disaster routine on each turn once the other code is written. I'm pretty sure I can get a randomly placed bombardment for the earthquakes. The drought/great weather part seems as though it may be more complicated, but I'll give it a shot. I doubt I could do the tidal wave thing and honestly won't even try. I remember reading something about changing terrain could have unpredictable or undesirable results so I'm not going to mess with that.
 |
being that turns represent so many years, I figure theres a reasonable chance that somewhere in the world a disaster would happen almost every turn. alot of them will be in unpopulated areas or quakes so small that they dont do much damage. Would it be easy just to do weather every turn and to put out a message only when its really bad/good? Just randomly increase/decrease food levels worldwide since from one year to the next crop outputs vary, sometimes drastically. ------------------ History is written by the victor. |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted January 07, 2001 00:45
 |
 |
 |  |
quote:
 Originally posted by heardie on 01-07-2001 12:29 AM RE: To do food production Drought: Create a building that decrease food by 25% IMPROVE_DROUGHT { DefaultIcon ICON_IMPROVE_GRANARY Description DESCRIPTION_IMPROVE_GRANARY EnableAdvance ADVANCE_AGRICULTURE ProductionCost 0 Upkeep 0 FoodPercent -0.25 } Surplus: Create building increase by 25% IMPROVE_SURPLUS { DefaultIcon ICON_IMPROVE_GRANARY Description DESCRIPTION_IMPROVE_GRANARY EnableAdvance ADVANCE_AGRICULTURE ProductionCost 0 Upkeep 0 FoodPercent 0.25 }Can that work? Then all we do is create them, and then after x amount of turns remove them. Is that right?
 |
That sure sounds like it could work. Then all SLIC would have to do is go thru the cities and add droughts occasionally. But can we auctually track what turn an improvement was built so we know when to kill it? ------------------ History is written by the victor. |
Alpha Wolf Settler Chicago Illinois Feb 2001
|
 |
posted January 07, 2001 00:47
 |
 |
 |  |
In case I forget, thanks for all the help guys  ------------------ History is written by the victor. |