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 > Call To Power II > CtP2-Source Code Project > DESIGN: Hunger flags
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
CivGroups
CTP2 Source Code Project (59): Not a Member - Join

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:21
  Old Post 07-10-2004 02:48 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
DESIGN: Hunger flags Support Apolyton, buy Call to Power 2

What follows is traffic from this thread:

http://apolyton.net/forums/showthre...threadid=122697

It esentially addresses reimplementing the hungerfood flag, that is alread in the game but doesnt work (presumably because food is managed by city not empire like pw or gold). I also suggested adding a new flag: hungergold, that would make units cost gold per turn.


Martin made a good suggestion about hungerfood saying that the total should be added up then divided by cities and subtracted from each city...this would have to consider new cities and those with more surplus than others but thats to b e discussed.










_____________________________________

rfom gs/readiness.cpp


code:
void MilitaryReadiness::SupportUnit(const Unit &u, sint32 gov) { double unitCost = GetSupportCost(u); m_cost += unitCost; g_network.Block(m_owner); ENQUEUE(); g_network.Unblock(m_owner); } double MilitaryReadiness::GetSupportCost(const Unit &u) { if(u.GetIsProfessional()) return 0; if(u.GetNeedsNoSupport()) return 0; double unitCost; if(u.GetDBRec()->GetIsSpecialForces()) { unitCost = u.GetShieldHunger() * GetSpecialForcesSupportModifier(g_player[m_owner]->GetGovernmentType()); } else { unitCost = u.GetShieldHunger() * GetSupportModifier(g_player[m_owner]->GetGovernmentType()); } unitCost -= unitCost * double((double)wonderutil_GetReadinessCostReduct ion( g_player[m_owner]->GetBuiltWonders()) / 100.0); unitCost *= g_theGovernmentDB->Get(g_player[m_owner]->m_government_type)->GetSupportCoef(); return unitCost;



It looks like this code looks to see if a unit has the hungershield flag and then looks for the value after it and then subtracts that value from the players PW.

So it looks like that in order to fix hungerfood or add hungergold, we'd have to create the flag and then look for the number value after the flag...

Also the unit support code I listed previously doesnt mention hungerfood which may be why the flag appears unimplemented



code:
sint32 Unit::GetShieldHunger() const { return GetDBRec()->GetShieldHunger(); } sint32 Unit::GetFoodHunger() const { return GetDBRec()->GetFoodHunger();


Is there an empire-wide food variable? I thought it was city based. If so, where would you deduct the food from? -E


There is no such variable. That's why I said it would be a big job - you'd have to comprehensively rework the way food is handled. - J Bytheway


Would it be coprehensive to have the system look for the city with the highest excess food first and subrtract from it until it was no longer then subtract from the next highest one. - E

"Basically a function that checks for the city with highest bonus, subtracts, checks again, subtracts, etc until either all are supplied or there is no bonus food left...

This system reminds me of Civ2, a city based instead of a empire wide based system, however maybe that could achieved over the food coefficent from the government stuff, or somewhere a function that calls us how many food must be deducted from each city.

Something like:

Needed food by units / number of cities and then substract it from all cities."

-Martin


i think I like that idea for food better Martin. I think this highlights a bigger issue with food though, that there is no distribution system that models a real world situation. Like egypt was rome's bread basket and Rome grew based on food imports, likewise with the midwest. I guess a future issue, probably in governor.cpp, would be able to shift food (maybe also with the trade route system)

As for gold, its managed empire-wide so it shouldnt be as hard to implement right?


I think I hould open this up in a new thread, in the source code...

Last edited by E on 07-10-2004 at 20:59

Maquiladora is offline Maquiladora
Emperor

Jun 2001
time: 05:21
  Old Post 07-10-2004 12:25 Visit Maquiladora's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Get a bigger avatar today!

I don't think we need to accurately simulate food distribution in a civ game, but if someone wants to make a mod then I'm all for making it at least possbile. You could just have a simple trade route passing food to the buying city. But I am interested in units requiring empire support from food and/or commerce as well as production. Different governments and units would require different balances of each resource, this would not only weaken production quite some in the whole game, but it would really cripple a war monger in the long run.

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:21
  Old Post 07-10-2004 18:59 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Suffering from ads?

I would say that the cost in food support should be distributed to the cities in proportion to their excess food, or possible in proportion to their total food.

Flinx is offline Flinx
Prince
Toronto, ON CANADA
Nov 2001
time: 00:21
Thumbs down  Old Post 07-10-2004 20:08 Visit Flinx's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Food Hunger Increase Your PM Length

- Great idea (at least in theory)
- Distributing food hunger over all cities could starve those cities you place on poor quality land for strategic reasons. In Civ2 you just never built any units in those cities and used units from other cities instead
- Would we give different food costs to different units? Probably not for the most part

I say no to trying to implement unit food hunger at this point.

Flinx is offline Flinx
Prince
Toronto, ON CANADA
Nov 2001
time: 00:21
Thumbs up  Old Post 07-10-2004 20:09 Visit Flinx's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Gold Hunger Support Apolyton, buy Civilization: The Boardgame

Go for it!

Unspeakable Horror is offline Unspeakable Horror
Emperor

Oct 1999
time: 02:21
  Old Post 08-10-2004 01:53
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Increase the size of your Attachments

I´m not sure about the normal game, but for mods.. why not?
I like the idea

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:21
  Old Post 08-10-2004 02:18 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Avatar Enlargement: We've got the solution

code:
sint32 Strengths::GetTotalUnitCost() { sint32 i; sint32 c = 0; UnitDynamicArray *units = g_player[m_owner]->m_all_units; for(i = units->Num() - 1; i >= 0; i--) { c += units->Access(i).GetDBRec()->GetShieldCost(); } return c;


this is from strengths. So it looks like I have to update readiness.cpp, strengths.cpp, and unit.cpp. But I'm sure I gotta get into Gold.cpp...

I post propsed changes once I go through everything and follow how shields a added subtracted etc. but i'm going to need help correcting my errors and especially compiling and testing for hungergold

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:21
  Old Post 08-10-2004 03:24 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Suffering from ads?

I'm in favour of implementing the flag, just not of using it.
edit/ So it probably shouldn't be high on the list of priorities.

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:21
  Old Post 12-10-2004 04:12 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton buy from Amazon

unit.cpp

code:
sint32 Unit::GetStoredCityFood() const { return GetData()->GetStoredCityFood(); } sint32 Unit::GetNetCityFood() const { return GetData()->GetNetCityFood(); } sint32 Unit::GetGrossCityFood() const { return GetData()->GetGrossCityFood(); } sint32 Unit::GetNetCityGold() const { return GetData()->GetNetCityGold(); } sint32 Unit::GetGrossCityGold() const { return GetData()->GetGrossCityGold();


I'm thinking these may be useful esp. for the food calc

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:21
  Old Post 21-10-2004 20:55 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Avatar Enlargement: We've got the solution

I've been doing a lot of research in the code for hungergold and I'm opting to copy how upkeep works for cityimprovements to apply to units for hunger gold.

But this raises a new, interesting, question? How can we implement flags/traits associated with cityimprovements, units, and tileimprovements to affect each other?

as an example flags like terrainbonus for TIs apply to units...or just putting upkeep to aapply to units and TIs. Or PrerequisiteBuilding IMPROVE_BANK to maake units or TIs require certain buildings...


Meaning stuff located in the different text files can apply to other ones? Is this a matter of just linking the files that have the flags, or would it require a cut'n'paste job?


For the purists I'm recommending this for modding sake

Last edited by E on 21-10-2004 at 22:17

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:21
  Old Post 21-10-2004 22:17 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Support Apolyton buy from Amazon

I've been doing a lot of research in the code for this and I'm opting to copy how upkeep works for cityimprovements to apply to units for hunger gold.

But this raises a new, interesting, question? How can we implement flags/traits associated with cityimprovements, units, and tileimprovements to affect each other?

as an example flags like terrainbonus for TIs apply to units...or just putting upkeep to aapply to units and TIs. Or PrerequisiteBuilding IMPROVE_BANK to maake units or TIs require certain buildings...


Meaning stuff located in the different text files can apply to other ones? Is this a matter of just linking the files that have the flags, or would it require a cut'n'paste job?


For the purists I'm recommending this for modding sake

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:21
  Old Post 14-11-2004 00:27 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Full PM-box? Change here!

I think these changes need to be done to get a hunger gold for moders. But I'm looking for help on how to get it displayed. I think it wuld be good to see in a tab how much your military is costy you. I know flinx made a new tab before. Any one interested?

Attachment: upkeep.txt
This has been downloaded 4 time(s).

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:21.
Apolyton Time is 00:21.
    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.0505 seconds (88.86% PHP - 11.14% MySQL) with 36 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