 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
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.
|
|
|  |
 |
|
heardie
|
|
[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
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
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
|
|
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
|
|
thats a good ideas Alpha. when I get back on the 7th ill try and implement them. If its not done by then!
|
|
|  |
 |
|
skorpion59
|
|
Tulsa, Oklahoma, USA
May 1999 time: 23:14
|
|
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"
|
|
|  |
 |
|
wheathin
|
|
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.
|
|
|  |
 |
|
Cyrius
|
|
Minneapolis, MN, USA
Nov 2000 time: 05:14
|
|
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
|
|
Prince of the Barbarians
Feb 2001 time: 05: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.
|
|
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
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.
|
|
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
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.
|
|
|  |
 |
|
colorme
|
|
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?
|
|
|  |
 |
|
Radical_Manuvr
|
|
Maryland, USA
Dec 2000 time: 05:14
|
|
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
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
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
|
|
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!
|
|
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
Now I know why I'm leaving the SLIC coding to you guys. ZOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOMMMMMMMMMMMMMMMMM
MM
------------------
History is written by the victor.
|
|
|  |
 |
|
colorme
|
|
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.
|
|
|  |
All times are GMT. The time now is 05:14. Apolyton Time is 00:14. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|