We-the-People-civ4col-mod / Mod

This is the repository where the mod resides.
89 stars 37 forks source link

Refactor CvCityAI::AI_doNative #218

Open Nightinggale opened 5 years ago

Nightinggale commented 5 years ago

CvCityAI::AI_doNative() is poorly coded and we can do better for xml friendliness, code readability and performance.

LibSpit commented 5 years ago

Something like a native behaviour xml would be quite interesting to have, A bit like the leaderhead file.

It could set things like: preferred trades sale price of 'hidden sales' preferred production 'Fake Production' Quotas

So that you can set the personality of a native to buy and sell certain content and make certain natives, like Aztecs producing gold, to be the go to for certain substances. Or in something like 2071 a species imbued with atomic energy making atomic power cells. Or whatever.

It could also be tied to per population, so feeding and helping certain natives prosper can be beneficial to you in the long run.

Nightinggale commented 5 years ago

So you are essentially saying we should figure out how to place this feature in CivEffects?

We could make two arrays of min and max consumption in CivEffect, make it default to 0 and then add the min/max to CIV_EFFECT_DEFAULT_NATIVE. Other CivEffects can then modify this and even disable it entirely, like making a civilized era for natives, allowing them to start acting European or something.

We can also add price modifiers, which defaults at 100. You can then do say +25 and it will gain 25% more. This in turn should also be used for best profession, meaning the AI prefers to produce what it will gain the most from. It can also be used in trading, meaning not all native players will pay the same for European goods.

The real question with this approach is if it is worth it? I mean it's a lot to code and set up in xml. It's also more complex at runtime, though most likely not enough to cause performance havoc.

Perhaps we should take one step back and forget about what we have. Instead we should rethink what we really want. How should natives treat the yield production and storage?

LibSpit commented 5 years ago

Yeah I am not saying it is a priority, I am saying it would be nice, purely from the perspective that you would be able to make natives more interesting, unique from each other and potentially strategically more valuable, as they could be producing a 'good' resource in high quantities for you if you help them out trading food for growth and such.

orlanth commented 5 years ago

I think the suggestion to use the already existing Domestic Markets system to enable modding demand/consumption however you like is a good one; it’s more understandable and avoids the need to add a kludge-y separate system for natives. If you want to add consumption or production differences between civs, could add a civeffects tag letting you add a % modifier in demand or production for yieldtypes (or mod special building/unittype demands however you want).

By letting fulfilled/unfulfilled demands affect local city prices like in MC, this would create diversity among cities and Yield types for trading purposes, and also act as a natural balancing mechanism so Domestic Markets won’t become too easy of an automatic cash cow regardless of Yield type, instead encouraging you to want to seek out good markets for your particular goods.

Overall in 2071 I just wanted to let “natives” be able to eventually develop and behave more like regular civs and disabled their vanilla “native Yield destruction” function - it would be cool to let a few more vanilla native features (e.g. gift giving, no hard borders) be turned on/off by Civeffects xml, so you could eventually enable tech development to progress past an initial pastoral state.

alexandr- commented 5 years ago

Yes, please do more improvements on the natives!

The real question with this approach is if it is worth it? I mean it's a lot to code and set up in xml. It's also more complex at runtime, though most likely not enough to cause performance havoc.

Could an overhaul of these mechanics also help with other native behaviour like in #130 or #13?