Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Alternative Civs > Guns, Germs & Steel > Disease Model Programming
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread   
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
heardie is offline heardie
Prince

Aug 1999
time: 15:14
Post  Old Post 18-10-2000 14:45
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Disease Model Programming Tired of ads?

If I can do it any-one can!

Here is a little bit of a disease model demo that I am working on. I am aware that it is not needed, I was just bored.


Anyway, Amjayee or someone else with C++ experince, please critque, espically my use of Classes. It is not such much what the program does, but how the classes work. Is it all good? I am no sure how to add other modifiers now, ie. incubation, Deoendance od Environment, etc, but I will experiment.

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 18-10-2000 20:42
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Enter the AD-FREE zone

Ehh, where is it?

Sorry, for my ignorance, I would really like to see this demo, but I don't know where to find it........

------------------
"I chose not to choose life. I chose something else."
- Trainspotting

heardie is offline heardie
Prince

Aug 1999
time: 15:14
Post  Old Post 19-10-2000 06:12
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Got spare money?

http://members.xoom.com/acchiron/disease.zip

Sorry

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 20-10-2000 00:06
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Got spare money?

Thanks. I will check out the sourcecode as soon as possible.

------------------
"I chose not to choose life. I chose something else."
- Trainspotting

amjayee is offline amjayee
Prince
Jyväskylä, Finland
Oct 1999
time: 07:14
Post  Old Post 20-10-2000 20:56 Visit amjayee's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Inflate your Upload Space

It is not a bad class at all - especially for someone who hasn't worked with c++ for very long. Nice and working class! The only thing I have to complain is, that usually the classes should be kept in their own files, and you should make a .h file with the class definition. Then you would #include the .h file into the main program.

Anyway, please feel free to ask, if you don't know how to do certain thing!

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 21-10-2000 00:18
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

The sourcecode looks really cool, Heardie.

But how come the program closes itself automatically just after being opened, if you don't open it from inside the compiler? I tryed opening my pop model (it's done - check the pop model thread) outside the compiler and the same thing happened. What can we do to avoid this, Amjayee?

------------------
"I chose not to choose life. I chose something else."
- Trainspotting

heardie is offline heardie
Prince

Aug 1999
time: 15:14
Post  Old Post 21-10-2000 03:13
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Avatar Enlargement: We've got the solution

Ah, yes thanks for reminding me. The file is now almost complted. I wrote in the readme that it was completed but I forgot to do Dependance of Environment variable. Anyway, the file is updated at the address listed above.

Joker
--------------------
Well the program from a Dos window. it is because when the program finishes, it is done, and has no more info to display, but in DOS all the old info still shows.

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 22-10-2000 15:59
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Put an end to popups!

Is there a way to stop it? Keep the windows opened untill the user shuts it down?

------------------
"I chose not to choose life. I chose something else."
- Trainspotting

heardie is offline heardie
Prince

Aug 1999
time: 15:14
Post  Old Post 23-10-2000 14:39
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

not that i know

just view it is dos

amjayee is offline amjayee
Prince
Jyväskylä, Finland
Oct 1999
time: 07:14
Post  Old Post 24-10-2000 15:12 Visit amjayee's homepage!
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Lose 30 kilos (of popups)

Windows console closes when the program ends. I don't know of any way to prevent that, except adding a line to the end of the program that requests the user to press any key. This way, the program will wait until some key is pressed and ends then. Like this:

cout << "Press any key to end the program";
cin >> some_char_variable;

This should be the last line of the program.

amjayee is offline amjayee
Prince
Jyväskylä, Finland
Oct 1999
time: 07:14
Post  Old Post 24-10-2000 15:13 Visit amjayee's homepage!
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Full PM-box? Change here!

Look who's a prince! Wow!

Strange thing that happened with your status, Joker.

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 26-10-2000 19:26
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton or Terrorists Win

Thanks, Amjayee.

Anyway, it's not really a big deal with my post count. But I guess I should mail someone sooner or later.

------------------
"I chose not to choose life. I chose something else."
- Trainspotting

Ramo is offline Ramo
King
Austin, Texas, USA
Oct 1999
time: 23:14
Post  Old Post 04-11-2000 09:59 Visit Ramo's homepage!
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Lose 30 kilos (of popups)

Finally, I have some time to make some meaningful comments!

At the end of the program, put:
cin.ignore();

This means that it will wait till the user presses "enter" to continue...

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 06-11-2000 10:25
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Get a bigger avatar today!

Hi Ramo!

Great to see you here again. And thank you for that programming trick.

------------------
Vote Gore. For the sake of people, not god.

GGS Website

Ramo is offline Ramo
King
Austin, Texas, USA
Oct 1999
time: 23:14
Post  Old Post 06-11-2000 04:12 Visit Ramo's homepage!
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Support Apolyton

No problem, Joker.

BTW, I also have some suggestions for the model (sorry if I'm repeating comments from earlier ). Basically, an interesting pheonomenom happens when a city's population reaches a threshold of ~200,000 people. If this city comes in contact with a disease (that isn't too lethal), it will keep the disease in circulation forever. It eventually becomes a "child-hood disease" (think measles and small pox). That means infant/childhood mortality would significantly increase, but would not be disastrous to the civilization (besides the fact that kids have better immune systems than adults, kids play a much less significant role in keeping a society together and less resources are "wasted"). Besides, genetic resistances would be built up, and the disease would slowly lose effect.

On the other hand, if a smaller city or village has a run-in with a disease, it gets the majority of the population massacred, and keeps on getting massacred every time it connects with the disease. In addition, many of these people would be vital to holding the civ together, and the civ would subsequently collapse.

To go off on a related tangeant, religious values can affect the course of diseases (and vice-versa). For example, during the first and second centuries, a huge trading network was established between Rome, the Middle East, India, and China, for the first time. In Rome and China, the casualty rates from disease were horendous (Indians and the Middle Easterners, presumably, were more disease resiliant than the Romans and Chinese). In Rome, people were exposed to small pox and the measles for the first time (come the 6th century, it was exposed to the bubonic plague) - unfortunately, the disease info for China is a little more vague, but presumably, they were affected by the same diseases. Both times, the rates were around 1/3 of the population! In addition, Rome had the unlucky proposition of being all along the Mediteranean, and therefore exposed to trade. The smaller cities, therefore, were continually exposed to diesease, and their populations eroded. China faced a similar phenomenon. To go off in another tangeant, this, IMO, caused the collapse of Rome. The interesting thing (if that wasn't interesting enough ), is that both civs converted to a different religion during this era. At approximately the same time, China accepted Buddhism and Rome accepted Christianity. This was probably because these religions advocated helping the unfortunate, decreasing casualty rates greatly. In addition, these religions preached a benevolent God (relatively speaking, of course), reducing psychological agony over the fear of death and the death of relatives.

Errrmm.. uhh... that's all for now ...

amjayee is offline amjayee
Prince
Jyväskylä, Finland
Oct 1999
time: 07:14
Post  Old Post 06-11-2000 16:08 Visit amjayee's homepage!
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Support Apolyton buy from Amazon

Yes, I think I have heard the Romans were quite sick people in the beginning of the first millennia. That also was the case with Egyptians at the peak of their power. So it might be true that diseases play an important role in the rise and fall of empires. Many of these things are quite easy to model.

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 07-11-2000 03:57
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Get a bigger avatar today!

Ramo:

Yeah, I've read GGS (the book) too.

I think with Heardie's disease model (with slight adjustments, such as adding resistance to effect mortality and population per hex to effect infectousness, it should be possible to handle a scenario where a disease is just constantly in a hex.

------------------
Vote Gore. For the sake of people, not god.

GGS Website

heardie is offline heardie
Prince

Aug 1999
time: 15:14
Post  Old Post 11-11-2000 10:48
Edit/Delete Message Reply w/Quote
#18 Report this post to a moderator
Get a bigger avatar today!

http://members.xoom.com/acchiron/disease.zip

This filel contains teh better disiease model, which is now much more user friendly

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 12-11-2000 02:37
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Got spare money?

Cool demo, Heardie! But one thing: It crashes if you ask for the stats for HIV. Otherwise it's great.

But now for something completely different:

I have been thinking a lot about disease and population lately, and I think we should start working on excactly how to implement diseases in the game (and on the map in particular).

I think we should consider whether to have diseases modeled at a province or at a hex level. The latter is more realistic, and it has some very clear advantages. But on the other hand it has some large disadvantages. These are mainly the calculations required by the computer. There must be a lot of diseases in the game - possibly over 50 - to get it to work properly, and not just have diseases be an unfortunate random event. Diseases must be a completely integrated part of the game, and should have an important role right from the start to the end. And if each hex has 10 diseases on it, with 10 age groups and 1,000,000 hexes this will require 100,000,000 calculations each turn! I don't know if this is too much, but it sure seems like it. And it is not like it has a huge effect on gameplay that diseases and mortality is calculated on every hex.

Therefore I am thinking about what to do to reduce this.

I agree that handling diseases on a province level is pretty much unacceptable, since it means too much inaccuracy.

So what do we do?

I have been thinking about doing it something like this:

First diseases are handled hex by hex, but not including age groups. It would be done simply via Heardie's formula (although I have a few comments and suggestions for it, which I will post later on - first I think we should settle this). Then the total mortalities of all hexes in a region is found, and this gives a mortality percentage for the province. This is then put into some formula that depends on the medical tech level (and maybe a few other things), and this creates a mortality for each age group. The amount of dead people is now calculated in each age group, and the total amount is found. This, however, doesn't have to be the same as the amount found before, cause if there is more old people than there "should" be in the province then the amount will be higher. Finally the new mortality rate is divided with the old mortality rate, and this number is multiplied with the mortality in each hex, to find the actual mortality of each hex, and the new pop in each of them.

So, is this system any good? it should reduce calculations required drastically, and it includes both hex mortality and age group mortality. The downside of it is, that the age mortality is now only a "pro forma" mortality, since it only depends on total mortality and tech level, and is not calculated by it self.

And it might very well be really dificult to calculate the age group mortalities at different tech levels and make the result into a function that can be handled by a computer. But we have to do that anyway, so that shouldn't be an issue here.

So, is this any good?

(NOTE: Now that I think of it I am clear that this should in stead be in the pop model thread, but I'm just posting it here anyway)

------------------
"It would sharpen you up and make you ready for a bit of the old ultra-violence."
- A Clockwork Orange

GGS Website

heardie is offline heardie
Prince

Aug 1999
time: 15:14
Post  Old Post 12-11-2000 14:31
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Put an end to popups!

Okay, Jokre I'm thinbk about those ideas but I am not sure why your program crashed. Mine doesn't....

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 14-11-2000 17:34
Edit/Delete Message Reply w/Quote
#21 Report this post to a moderator
Full PM-box? Change here!

Hmm... Weird. But it doesn't really matter. What is important is, that we can have a disease model that works, not whether some demo crashes.

------------------
"It would sharpen you up and make you ready for a bit of the old ultra-violence."
- A Clockwork Orange

GGS Website

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 14-11-2000 20:50
Edit/Delete Message Reply w/Quote
#22 Report this post to a moderator
Support Apolyton buy from Amazon

Just a question it is pretty nice to know when thinking out functions for the game:

How many (simple) calculations is a modern computer capable of do per second?

------------------
"In America, first we take the sugar, then we take the power, then we take the women!"
- Homer J. Simpson

GGS Website

amjayee is offline amjayee
Prince
Jyväskylä, Finland
Oct 1999
time: 07:14
Post  Old Post 15-11-2000 15:54 Visit amjayee's homepage!
Edit/Delete Message Reply w/Quote
#23 Report this post to a moderator
Inflate your Upload Space

The computer's speed is measured in clock cycles, as you know all. 700 MHz means 700,000,000 clock cycles per second. On each clock cycle, it is possible to perform one simple macnine-languge instruction, but usually several clock cycles are needed. What this means with C language intructions, it depends. But anyway, I think the machines of today can make at least some 100,000,000 simple mathematical calculations per second. I think your concern is how long it will take to perform the calculations our models need. That's also my concern. I think we should at some point, when the models are ready, estimate how large situations they would need to handle, and then test how long it would take to make that amount of cycles.

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 16-11-2000 18:20
Edit/Delete Message Reply w/Quote
#24 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

Thanks. So basically we shouldn't worry too much about having too many calculations? Anyway, if we can have econ stuff take 1 second and have pop things take 1 second, then things wouldn't really take too long.

------------------
"In America, first we take the sugar, then we take the power, then we take the women."
- Homer J. Simpson

GGS Website

amjayee is offline amjayee
Prince
Jyväskylä, Finland
Oct 1999
time: 07:14
Post  Old Post 17-11-2000 17:23 Visit amjayee's homepage!
Edit/Delete Message Reply w/Quote
#25 Report this post to a moderator
Support Apolyton buy from Amazon

Well, I think memory usage will be a bigger problem than cpu usage, yes. I'm sure we can optimize the algorithms to make the response times sensible. About the speed of performance, the largest load will come from AI, but that we can fight by letting AI think during th human player's turn. 1 second might be good guess in average world for economy, don't know yet. Hopefully it will not be much longer. What do you think would be a sensible response-time when you hit end turn? 10 seconds maximum in all situations? I mean, there will be thousands of turns, so...

About memory; map will be quite a monster in hogging it. But we can handle that by reducing map size, if needed. And graphics in general will require quite much memory. But I'm sure we will handle that when that time comes.
[This message has been edited by amjayee (edited November 17, 2000).]

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 17-11-2000 20:55
Edit/Delete Message Reply w/Quote
#26 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

So we have to store all game informations in the RAM?

Then I supposted you're right. We decided to have map hexes be 50 kms across, right?

This means each hex has an area of some 1400 sq kms, and that means a little over 1,000,000 hexes on an earth map. We should keep the possibility to choose the size of a hex, and then have all other variables (unit movement, disease spread etc) be adjusted.

I don't know about the hex properties, but we will propably need 2 bytes or so for the terrain. But what are we going to do about pop in each hex? It should be possible to have pops of several million in each hex, and that would mean about 3 bytes to handle population. That would mean 5 MBs for the map alone, though. Is this too much?

Then comes all the province and civ data, but since the amount of provinces and civs is pretty limited this shouldn't be much of a problem.

And I agree, about 10 seconds per turn seems reasonable. But if the AI does it thing simultaneously with the player then maybe we wont even need that much.

------------------
"In America, first we take the sugar, then we take the power, then we take the women."
- Homer J. Simpson

GGS Website

amjayee is offline amjayee
Prince
Jyväskylä, Finland
Oct 1999
time: 07:14
Post  Old Post 20-11-2000 15:39 Visit amjayee's homepage!
Edit/Delete Message Reply w/Quote
#27 Report this post to a moderator
Tired of ads?

About map size; tile properties take 2 bytes. If we use unsigned long for population, we get some 4.3 billion people, which should be enough, and it would take four bytes (one dword). Diseases and such would rise that figure somewhat, I hope we can have less than 10 bytes all in all. And yes, the map will take the most memory, so we don't need to worry about the other things as much. Populations and regions will take quite much space, but since there will be only couple of hundred of them at maximum, that's not a problem, at least compared to the map.

Map drawing info will take much more space, but I hope I can make a system, where this info is stored only for the visible map area, which should decrease the amount.

I don't like much having a varying tile radius. But we will see. We perhaps should find out the reasonable map size and then decide the tile radius based on that.

Guildmaster is offline Guildmaster
Warlord
Up your butt and around the corner
Jun 2000
time: 05:14
Post  Old Post 20-11-2000 20:51
Edit/Delete Message Reply w/Quote
#28 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

I hope that doesn't mean we're limiting the world population to 4.3 billion...
I think that since we're going to take the game to at least as far as the current tech level of today's world which houses more than 6 billion, and we're taking that further... I think IF we put a limit on world population it should be upwards of 25-30 billion, that would be assuming we are limited to this world. I see no reason to limit population to even that, especially if we're going to be colonizing other worlds...

------------------
How will you make it if you never even try?
-Macy Gray

amjayee is offline amjayee
Prince
Jyväskylä, Finland
Oct 1999
time: 07:14
Post  Old Post 21-11-2000 15:30 Visit amjayee's homepage!
Edit/Delete Message Reply w/Quote
#29 Report this post to a moderator
Get a bigger avatar today!

No, I was talking about tile population. Well, perhaps we will have to create some custom system to store 3-byte integers, for one tile 4 billion just might be too much. With that, if we have 1,000,000 tiles we could have 4,200,000,000,000,000 people in the whole world! Well, of course not every tile would have that many people, and some of them would be ocean. But seriously, with 3 bytes, we get about 16 million per tile. For region, civ and world population we will also need special storage types so we will not reach the upper limit very easily. With 5 byte integers, we can have numbers up to about 1,100,000,000,000 which should prove enough even for the population of the whole Universe!
[This message has been edited by amjayee (edited November 21, 2000).]

The Joker is offline The Joker
Prince
Copenhagen, Denmark
Aug 1999
time: 06:14
Post  Old Post 21-11-2000 18:47
Edit/Delete Message Reply w/Quote
#30 Report this post to a moderator
Put an end to popups!

Isn't it possible to to have more than 3 and less than 4 bytes for hex pop?

Having 4 would be a waste of space, but 3 might be too little, especcially in sci fi scenarios with huge cities. So why not 3 bytes and 2 bit = 26 bit? That would give us 64 mio people per hex, which should be enough.

------------------
"In America, first we take the sugar, then we take the power, then we take the women."
- Homer J. Simpson

GGS Website

 
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:14.
Apolyton Time is 00:14.
    top of page
Rate This Thread:
Forum Jump:
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
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0617 seconds (92.67% PHP - 7.33% MySQL) with 30 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net