The Altera Centauri collection has been brought up to date by Darsnan. It comprises every decent scenario he's been able to find anywhere on the web, going back over 20 years.
25 themes/skins/styles are now available to members. Check the select drop-down at the bottom-left of each page.
Call To Power 2 Cradle 3+ mod in progress: https://apolyton.net/forum/other-games/call-to-power-2/ctp2-creation/9437883-making-cradle-3-fully-compatible-with-the-apolyton-edition
Another problem I encountered when programming the economy thing: what to do when the supply is smaller than demand? Who gets to buy and how much? In the eventual version we should perhaps allow "higher" classes to buy first, but in the demo we can of course divide the goods among the people willing to buy. But this needs some thought for the future.
Also, what happens to the demand when supply is insufficient? Does it get lower? I think it should not get lower very fast, but instead quite slowly. And the relation supply/demand should also affect the people's activity to create new businesses on that field. Earlier, the idea was to increase people working on that area depending on the demand; perhaps we should instead make it depend on the relation above, supply/demand? The smaller it is, the more the people will want to start producing that good.
Just thinking out loud. What do you think?
[This message has been edited by amjayee (edited October 25, 2000).]
FINALLY I have made a demand algorithm that I am truly satisfied with, in stead of the clumsy system I have suggested previously.
Actually this algorithm is not very complex at all. It was right underneath my nose, but still I couldn't see it. Untill now.
The major difference between this and the other attempts I have made is, that demand is now no longer a function of wealth (in money). In stead it is a function of the total supply of goods. This may sound a bit weird, but it works. A really cool aspect of this algorithm is, that the percentage of the people's income they spend on different goods is now completely independant of the amount of money in the province. Like in reality!
I am mailing the sourcecode with the demo to Amjayee, as he is programming the econ demo, and to Heardie, so he can blast it out to the world through the internet!
But now that I'm here, why not just post the sourcecode?
Code:
#include
typedef unsigned int uint;
int main()
{
uint income, pop, goodsperpu;
float efood, ehousing, eclothing, mfood, mhousing, mclothing;
uint dfood = 0, dhousing = 0, dclothing = 0;
uint sfood = 100, shousing = 20, sclothing = 10, sgoods;
float pfood, phousing, pclothing, incomeperpu, mgoods, pindex;
int dsfood, dshousing, dsclothing;
income = 3000;
pop = 100000;
incomeperpu = (income / (pop / 10000));
sgoods = sfood + shousing + sclothing;
goodsperpu = (sgoods / (pop / 10000));
pindex = (income / sgoods);
if (goodsperpu > 0)
dfood = dfood++;
if (goodsperpu > 1)
dfood = dfood++;
if (goodsperpu > 2)
dfood = dfood++;
if (goodsperpu > 3)
dfood = dfood++;
if (goodsperpu > 4)
dfood = dfood++;
if (goodsperpu > 5)
dhousing = dhousing++;
if (goodsperpu > 6)
dfood = dfood++;
if (goodsperpu > 7)
dfood = dfood++;
if (goodsperpu > 8)
dclothing = dclothing++;
if (goodsperpu > 9)
dfood = dfood++;
if (goodsperpu > 10)
dhousing = dhousing++;
if (goodsperpu > 11)
dfood = dfood++;
if (goodsperpu > 12)
dclothing = dclothing++;
if (goodsperpu > 13)
dfood = dfood++;
if (goodsperpu > 14)
dhousing = dhousing++;
if (goodsperpu > 15)
dhousing = dhousing++;
if (goodsperpu > 16)
dfood = dfood++;
if (goodsperpu > 17)
dclothing = dclothing++;
if (goodsperpu > 18)
dclothing = dclothing++;
if (goodsperpu > 19)
dhousing = dhousing++;
if (goodsperpu > 20)
dhousing = dhousing++;
if (goodsperpu > 21)
dhousing = dhousing++;
if (goodsperpu > 22)
dfood = dfood++;
if (goodsperpu > 23)
dclothing = dclothing++;
if (goodsperpu > 24)
dhousing = dhousing++;
if (goodsperpu > 25)
dhousing = dhousing++;
if (goodsperpu > 26)
dhousing = dhousing++;
if (goodsperpu > 27)
dhousing = dhousing++;
if (goodsperpu > 28)
dfood = dfood++;
if (goodsperpu > 29)
dclothing = dclothing++;
if (goodsperpu > 30)
dclothing = dclothing++;
if (goodsperpu > 31)
dclothing = dclothing++;
if (goodsperpu > 32)
dhousing = dhousing++;
if (goodsperpu > 33)
dhousing = dhousing++;
if (goodsperpu > 34)
dhousing = dhousing++;
if (goodsperpu > 35)
dhousing = dhousing++;
if (goodsperpu > 36)
dhousing = dhousing++;
if (goodsperpu > 37)
dhousing = dhousing++;
if (goodsperpu > 38)
dfood = dfood++;
if (goodsperpu > 39)
dfood = dfood++;
if (goodsperpu > 40)
dclothing = dclothing++;
if (goodsperpu > 41)
dclothing = dclothing++;
if (goodsperpu > 42)
dclothing = dclothing++;
if (goodsperpu > 43)
dhousing = dhousing++;
if (goodsperpu > 44)
dhousing = dhousing++;
if (goodsperpu > 45)
dhousing = dhousing++;
if (goodsperpu > 46)
dhousing = dhousing++;
if (goodsperpu > 47)
dhousing = dhousing++;
if (goodsperpu > 48)
dhousing = dhousing++;
if (goodsperpu > 49)
dhousing = dhousing++;
dfood = dfood * (pop / 10000);
dhousing = dhousing * (pop / 10000);
dclothing = dclothing * (pop / 10000);
dsfood = dfood - sfood;
dshousing = dhousing - shousing;
dsclothing = dclothing - sclothing;
efood = (dfood * 0.003 * pindex);
ehousing = (dhousing * 0.007 * pindex);
eclothing = (dclothing * 0.01 * pindex);
pfood = pindex + (dsfood / efood);
phousing = pindex + (dshousing / ehousing);
pclothing = pindex + (dsclothing / eclothing);
if (pfood < 0.1)
pfood = 0.1;
if (phousing < 0.1)
phousing = 0.1;
if (pclothing < 0.1)
pclothing = 0.1;
mfood = sfood * pfood;
mhousing = shousing * phousing;
mclothing = sclothing * pclothing;
mgoods = mfood + mhousing + mclothing;
mfood = (income / mgoods) * mfood;
mhousing = (income / mgoods) * mhousing;
mclothing = (income / mgoods) * mclothing;
pfood = mfood / sfood;
phousing = mhousing / shousing;
pclothing = mclothing / sclothing;
cout << "Income: " << income << endl;
cout << "Initial demand for food: " << dfood << endl;
cout << "Initial demand for housing: " << dhousing << endl;
cout << "Initial demand for clothing: " << dclothing << endl;
cout << "The price of food: " << pfood << endl;
cout << "The price of housing: " << phousing << endl;
cout << "The price of clothing: " << pclothing << endl;
cout << "Food consumed: " << sfood << endl;
cout << "Housing consumed: " << shousing << endl;
cout << "Clothing consumed: " << sclothing << endl;
cout << "Amount of money spent on food: " << mfood << endl;
cout << "Amount of money spent on housing: " << mhousing << endl;
cout << "Amount of money spent of clothing: " << mclothing << endl;
cout << "Amount of money spent: " << mfood + mhousing + mclothing << endl;
cout << "Percentage of income spent on food: " << (float) mfood / income << endl;
cout << "Percentage of income spent of housing: " << (float) mhousing / income << endl;
cout << "Percentage of income spent on clothing: " << (float) mclothing / income << endl;
return 0;
}
------------------
"I chose not to choose life. I chose something else."
- Trainspotting
[This message has been edited by The Joker (edited October 27, 2000).]
"It is not enough to be alive. Sunshine, freedom and a little flower you have got to have."
- Hans Christian Andersen
I think it would all be handled via the demand algorithm.
Supply and demand in the end situation (where the price is right) will always be the same. The real trick is to find a good way to calculate the price.
Later on, when we have several classes, I think that each class should just get the same percentage of the goods as the percentage of the total income that they earn.
But right now I am just looking forward to the demo. Then we can always figure out the more advanced features.
------------------
"I chose not to choose life. I chose something else."
- Trainspotting
"It is not enough to be alive. Sunshine, freedom and a little flower you have got to have."
- Hans Christian Andersen
Great, this will surely be of help for me! At least I've got the functions in one place so I don't need to use any time to comb the old threads for them. And once again, it seems to me that you have learnt the essentials of c++ quite quickly. That's remarkable.
About your algorithms I won't say this or that for now, I need to think about them for a moment. Many things will be done quite differently in the final version, but I think the essentials will remain.
Of cause we will. Along with other demand groups like health care and education.
But for this early demo the main goal is to get a:
- Demand algorithm that works and can be used throughout the game.
- Supply algorithm that also works like it should.
- Check if these two algorithms function well with each other, and if not, see what should be changed.
For doing that it is easier to see the big picture of the demo when we only have 3 goods to work with. That is the reason why only the very basic stuff is included for now. Later on, when we are adding more advanced features like capital, raw materials and labour market(s) we will also include more demand groups. And after that we will figure out a way to handle the individual goods in the demand groups, and implement graded goods etc.
------------------
"I chose not to choose life. I chose something else."
- Trainspotting
"It is not enough to be alive. Sunshine, freedom and a little flower you have got to have."
- Hans Christian Andersen
Hmm, weird that I didn't get that mail. It is my email adress allright. I guess they're just having some problems there.
The buying thing:
If you mean my long list of "if"'s with the following changes in goods demanded, then yeah, I know it's inefficient. We just need to figure out what goods people want to buy at different "income levels". But what I am most proud about in the newest version is, that the value of money is not constant. You can change the amount of money, and people will still spend the same percentages of their incomes on each good. Like in reality. It makes real inflation possible without any problems (if we want to implement it, that is). Therefore I have made "income" dependant on the total amount of goods, and I think it should be in the game, too. Again, low incomes means a large percentage of goods demanded are food. higher incomes means more diversity in the goods demanded. But as a programmer I am sure there are more efficient ways to do this that you can think of.
But whatever you do please don't change the rest of the program, at least not for now. I really, really like what it has become, with the price calculator and all. Also check out that the basic price of each good is no longer the clumsy constant 10 as it used to be. In stead it depends on the amount of money and the amount of goods, so the basic price is amount of money divided by amount of goods.
Looking forward to it!
------------------
Vote Gore. For the sake of people, not god.
[This message has been edited by The Joker (edited October 30, 2000).]
"It is not enough to be alive. Sunshine, freedom and a little flower you have got to have."
- Hans Christian Andersen
Joker, I tried to reply your latest email, but for some reason I couldn't send it. I got a "receiver unknown" message. Is the address correct? bjarkestaunolsen@ofir.dk Perhaps your email account provider had some problems. Here is the message, anyway. Sorry if you did get it after all.
> I just found out there was a smaller bug in the last version I mailed you.
> There was a place where I had multiplied with 10 in stead of dividing with it.
> This caused the price changes to be way smaller than they should be. I have
> corrected the error in the sourcecode I posted at Apolyton, and here I am
> mailing the new, corrected version to you.
Ok, good. Thanks.
Your algorithms looked good. The buying thing is of course quite ineffective and also not very well "extendable" for more goods. But we had some talk about that earlier, I have been thinking of a better way for doing this, and it starts to be ready.
Otherwise, the largest problems in making this demo have not been programming it, which is quite a trivial task, but rather understanding the model. It is hard to program something that you don't yet understand. Another large problem has of course been time. Lately, I have started to understand the model properly, and I do like it more and more the better I understand it. The time problem should be easier after this week; I have exams, and then my schedule is more flexible until Christmas. I hope the demo could be available soon.
My intention was to preserve the other formulas you used. I don't have anything to add to them, before we see how they work. But they should work well. I was just wondering, what is the meaning of pindex, which was declared as (income / sgoods)? Income was the total income of all people; am I correct with that it is actually the total amount of money on the move? Sgoods was the total supply of all goods, so the quotient would mean the "basic" price per good. I have a suspicion of how this would work, but perhaps you could explain it yourself. Has it something to do with that property of people using always the same percentage of their income for buying the goods?
Pindex is a price index. I included it to describe a "basic" price on all goods. Before the basic price of each good was 10, but that system was clumsy and gave some very inaccurate results, since the amount of money could vary. So I replaced it with pindex. The practical use of pindex could be described so: If initial demand and supply are the same the price on all goods will be pindex.
It makes it possible to change the amount of money in the demo/game, without this having any effect on the supply and on the percentages of the people's income they spend on each good. It makes sure that the "price of money" is only dependant on the supply and demand of gooods.
I hope this is answer enough. If not, please ask!
------------------
Vote Gore. For the sake of people, not god.
"It is not enough to be alive. Sunshine, freedom and a little flower you have got to have."
- Hans Christian Andersen
I'm happy to tell that most of the problems have been solved, and most of the code is done. Making this was much more complicated than I expected. I just need to "wrap it up" so it works together and make some rough debugging so the program will execute. Then we can start fixing the real problems; the workings of the system. I can't tell exact dates, but within days now the prototype should be available.
I have been wondering the elasticity system. Earlier it used to be a constant, which told how fast the prize of the good can change. Now it is a figure, that depends on demand, pindex and a constant. Could you explain how this system is meant to work?
Well, it used to be a constant multiplied with initial demand for the good - which as result would give a percentage of demand, so if price rised with 1 demand would decrease with 10% or something.
Now I have added the price index to this. I have done that to make sure that the elasticity depends on the total amount of money in the province. So if there is 10,000,000 credits in the province a rise in the price of 1 would have less effect than if there was just 100 credits in the province. That is pretty much it!
------------------
Vote Gore. For the sake of people, not god.
Comment