Community Patch for BNW

ABUT, given the inefficient way the Firaxis code is currently written, adding a few nanoseconds to check for on/off options even in thousands of places in the code will have no perceivable overhead
Of course, that'd be the next "big thing" for the DLL: making the Firaxis code more efficient, turn times a bit shorter. I remember that some people managed to gain some speed-ups in the CivIV code by caching more (the CAR mod) and other tweaks.

But I assume attempting something like this would be down the priority list a fair bit...
 
Of course, that'd be the next "big thing" for the DLL: making the Firaxis code more efficient, turn times a bit shorter. I remember that some people managed to gain some speed-ups in the CivIV code by caching more (the CAR mod) and other tweaks.

But I assume attempting something like this would be down the priority list a fair bit...

I'd rather effort was initially focused on adding what is needed in a form that is generically flexible than worrying about making what we don't have more efficient.

Someone will need to run a profiling tool over the DLL before any attempt to make the Firaxis code more efficient is undertaken - as it is almost always true that where you think the bottlenecks are is not actually where they are.
 
Lot's of good discussion here (you must all live in the part of the world that is awake while I sleep!). I'll update the front post with the preliminary goals and holy grail wishlist we've established. If I miss anything, let me know.

you could evaluate which changes could be applied to each difficulty, instead of it being a switch-on switch-off for all difficulties kind of thing. Just an idea.

We can offer individualized checks (truly granular checks) as well as broader, 'difficulty' checks. That's just a matter of setting a few defines and some SQL, honestly. As we introduce AI features/tweaks, we can categorize them, as a community, into 'core,' 'mygodwhydidn'tfiraxisdothat,' 'challenging' etc. categories. We can also offer additional means of making the AI more challenging aside from flat % boosts to their production. For example, we could give the AI additional spies at higher levels, or make their influence with CSs degrade more slowly. We could also give the AI unique combat promotions, or make their GPs more potent. There are many methods to increase the difficulty of the game without simply ramping up the 10-or-so 'variables' that Firaxis designed.

Code:
It fixes genuine bugs.
It improves the AI.
It opens more options so you can do a lot more with basic XML modding.
It's a replacement for whoward69's brilliant mega-DLL.
Stays compatible with current non-DLL mods.

Agreed here – as I've said, any changes made will need to be modular, granular, and designed to be extendable by the community, not within the mod itself. Even if we make sweeping changes to tall/wide mechanics, it'll be part of a module of the dll.

Code:
 A possible way to solve this would be to add AIBArbarianBonusOwnterritory in HandicapInfos table. By default it would be nill or -1 value and this would cause the existing AIBarbarianBonus to be used both inside and outside borders (compatibility requirement)...

Free buildings map-size dependent : On small maps gaining 4 free monuments is enough to fill all your cities, on huge maps not so. I know tradition isn't underpowered, but if someone was to mod it or other trees and mess with free buildings, it would be nice to have it map-size dependent.

the first seems easy enough (there is already a vs. barbarians promotion, and an inside own lands promotion – creating a hybrid function cannot be that hard), the second, however, would have to consider custom map sizes as well, which could be problematic. The function for free buildings is simply a <for> statement, the cap on which is the number of buildings the policy offers. We could have the dll read the mapsize, and scale that value above the XML minimum appropriately (if that's what you have in mind).

Code:
Actually I prefer to go tall and keep to myself. That was just a bit of a quick observation about wide play. 
If we want a tall option, then we need to give it the ability to stave off attack from the big civs. How, I don't know.

The tall v. wide debate is interesting. I agree that the current method of 'harassing' wide players is a bit limp. Something I've considered looking at is using the 'supply limit' method built in the game in a less arbitrarily-punishing way. Instead of having the 'over supply limit' function impact production, what if it simply prevented you from building additional units? Furthermore, what if puppet/occupied cities reduced your supply limit by the number of unhappiness they produce (essentially, an occupation army)? Just thoughts. Again, these would be modular! :)

I got distracted last night by the places in the dll where the Firaxis devs essentially comment 'eh, whatever, we'll deal with this later' and didn't, as well as the places where they actually wrote 'workaround/hack/good enough' etc. For example, I'm trying to make the AI smarter at settling strategically, something that will, I believe, have a big knock-on effect on AI performance generally.

Also, I'm not sure if I've made this clear, but I welcome any and all help on this. Whoward and I need not be the only members of this dll team. (Also, did I tell you that you are officially on the team, whoward? I probably should have.)

Even if you have 0 experience working with the dll, dive in and see what you can find! I took one programming class back in college, promptly forgot about it, and then harassed (continue to harass) whoward for 6+ months as I rebuilt my knowledge base. Once you begin to learn the existing functions, and you start following the zodiac code of the Firaxis functiion process, you'll be surprised how easy it is to a.) crash your game and (eventually) b.) manipulate the dll.

Cheers,
G
 
I'm in the process of pulling all the notes from several hundred hours of looking at yields into one document (when I can find them all!)

When I have that done, I think it'll be most productive to spawn the discussion off into a dedicated "unified yields" thread.

I missed this post, but yeah, I think if we are going to tackle this, it can't be done alone. The buddy-system is highly recommended when venturing into dark, dank, no-light-at-the-end tunnels. :)
G
 
Even if you have 0 experience working with the dll, dive in and see what you can find! I took one programming class back in college, promptly forgot about it, and then harassed (continue to harass) whoward for 6+ months as I rebuilt my knowledge base. Once you begin to learn the existing functions, and you start following the zodiac code of the Firaxis functiion process, you'll be surprised how easy it is to a.) crash your game and (eventually) b.) manipulate the dll.

But if you don't read these first, I do reserve the right to kill you slowly with a spoon.
 
But if you don't read these first, I do reserve the right to kill you slowly with a spoon.

It is a painful, slow, miserable death – trust me, I'm currently enduring it right now (the number of times I asked whoward a question, and he responded with a link to one of his tutorials, is far, far too high).

Also, whoward, any thoughts on the abomination of a settler strategic site check I sent you? Does plotdirection() function the way I think it does? I have a hard time wrapping my mind around the way they designed the plot functions – from what I can tell, they wrote every plot check function to be completed radially - not linearly – which, from my limited knowledge, seems like a good way to eat CPU cycles with wanton abandon.

G
 
Also, whoward, any thoughts on the abomination of a settler strategic site check I sent you?

One for later this evening
 
Lots of stuff has been said so sorry for long reply and multi quote.
While I'm against dummy stuff, I'm also against adding many new columns to tables <snip> Especially when a few new Lua events - PlayerCanXyz/CityCanXyz can handle all current and future possibilities.
You sure know better how to code properly than myself. I actually didn't even really thought about how to do this, it just poped in my head after reading other "unification" goals.
From your "hacky" comment, what is also obviously needed (in addition to any new events) is an improved Lua API to make writing the code, not necessarily easier, but more pleasant - pPlayer:HasTech(), pPlayer:HasPolicy(), pPlayer:HasBelief(), etc. And also some best practice working Lua samples.
That would sure help avoid confusion especially on group effort mods such as CEP (at least at some point it was a group effort) as sometimes understanding what someone has coded is harder than making one's own code.
The only thing I disagree with there is the "always on improved AI" - if you have all the other code switchable, there's no reason to not have that switchable as well.
Of course, whatever you can add as switchable code is great, especially as if it also makes it easier to add smarter behavior based on difficulty (but then, the switch must not be set through SQL/XML when the mod is loaded but rather through Lua when the game is created). However some parts of an improved AI are probably hard to switch on/off. You probably shouldn't worry too much about those being always on. Better have a smarter AI always on than never for me.
I did a search of all the Civ5*.xml files (the ones that create/update the core game database) and found the following candidates for "things" that can / could have pre-reqs
...
Did I miss anything from either list?
Diplomatic relations in both lists (player is at war with another Civ -> can build unit X / player can not make DoF if he has Social Policy "isolationism" ... )
Unfortunately I also think you'll be just as hard pushed to find modders capable of implementing it. If Firaxis are still making the AI smarter by adding cheats in CivV (and it's not as if they've not had a few previous attempts at it) it ain't gonna be easy!
Mhhh :rolleyes:
OTOH, nobody forces them to use the cheasiest cheats possible (add tons of starting stuff) apart from either laziness or lack of creativity. Any cheat is better than those as they are so obvious and easy to abuse for the player.
Some times ago, the CEO of Stardock, the company behind Galactic Civilization games posted something interesting about AI design (GalCiv had the reputation of having top notch AI for a TBS). Basically his point was that it's not an issue if AI cheats as long as it's not obvious, and AI doesn't need to "play to win" but rather "play to give the player a challenge". I think he was right on both and it's how you should approach the AI part of the mod. Creating an AI that plays like a human is simply impossible, so why should anyone try.
 
from what I can tell, they wrote every plot check function to be completed radially - not linearly – which, from my limited knowledge, seems like a good way to eat CPU cycles with wanton abandon.

Actually a lot of their plot check functions scan every plot on the map in order (L-to-R, B-to-T) and calculate the distance between that plot and the target plot/city/unit. If anyone is looking to speed up the between turns time, re-writing my plot iterators into C++ and replacing all that code would be as good a place to start as any
 
One for later this evening

Sounds good &#8211; I'm currently putting off a bit of writing I need to do, so all the more incentive for me to finish.

Actually a lot of their plot check functions scan every plot on the map in order (L-to-R, B-to-T) and calculate the distance between that plot and the target plot/city/unit. If anyone is looking to speed up the between turns time, re-writing my plot iterators into C++ and replacing all that code would be as good a place to start as any

It is even worse than I surmised...
Regarding knock-on effects, would such modifications allow for higher-quality pathfinding algorithms? The current trade off seems to be performance v. accuracy, so if we have more headroom on the former, the latter should be expandable, yes?

OTOH, nobody forces them to use the cheasiest cheats possible (add tons of starting stuff) apart from either laziness or lack of creativity. Any cheat is better than those as they are so obvious and easy to abuse for the player.

This is what I did in CSD &#8211; I took away starting tech bonuses in exchange for staggered bonuses every era. Isn't the best solution, but it is far less cheesy on the front end.
 
Split post as i'm now on something else.
On that note, I think we should do a bit of brainstorming on how to address a couple of the game's bigger balance issues. First, I'd like to talk about the rather-arbitrary nature of the 'tall v. wide' penalties that affect the latter party.
OK. Now this is a big one. While i agree the wide penalties are somewhat lame, i also think we need something to slow down the big ones. Snowball mechanisms have merits, but in a long game like CiV, if you know who has won after the first 1/4 of the game, it' bad. It's badder if this happens because he just had lots of space to expand while you were on small island. We need "rubber band mechanisms", something that slows down leaders and give challengers a chance.

Now, if you want another mechanic to slow down wide empires, an option would be to re-introduce something that used to be in previous Civ games : bureaucracy cost and corruption. An example :
Rather than have new cities increase culture/beaker cost and actually make your previous ones worse, each new city take a penalty everything (:c5science: :c5gold: :c5culture: :c5production:) based on how many cities you already have and how far from capital it is located (to punish those forward settlers). Eventually, those new cities would no longer help your :c5science: :c5gold: :c5culture:. They need to have some production thought. This would be the effect of corruption, govs in those far away cities will think about themselves rather than the empire.
SPs (in the liberty tree, possibly some oder tenets) would reduce those penalties, making those cities valuable to some extend. You could also build some government buildings to reduce those further, but they would have high upkeep cost : this would be the cost of bureaucracy and what you have to pay to keep a tight control on a vast empire.
From your coding pov, it means a way to calculate some penalties based on # cities and distance from capital and entries to mitigate those in SPs, buildings, beliefs ... For the modder, it would be lots of delicate balancing :p
 
AI doesn't need to "play to win" but rather "play to give the player a challenge".

Too true. What is often forgotten is that the player has to beat every AI civ to win, but only one AI civ has to achieve victory to beat the player.
 
Now, if you want another mechanic to slow down wide empires, an option would be to re-introduce something that used to be in previous Civ games : bureaucracy cost and corruption. An example :
Rather than have new cities increase culture/beaker cost and actually make your previous ones worse, each new city take a penalty everything (:c5science: :c5gold: :c5culture: :c5production:) based on how many cities you already have and how far from capital it is located (to punish those forward settlers). Eventually, those new cities would no longer help your :c5science: :c5gold: :c5culture:. They need to have some production thought. This would be the effect of corruption, govs in those far away cities will think about themselves rather than the empire.
SPs (in the liberty tree, possibly some oder tenets) would reduce those penalties, making those cities valuable to some extend. You could also build some government buildings to reduce those further, but they would have high upkeep cost : this would be the cost of bureaucracy and what you have to pay to keep a tight control on a vast empire.
From your coding pov, it means a way to calculate some penalties based on # cities and distance from capital and entries to mitigate those in SPs, buildings, beliefs ... For the modder, it would be lots of delicate balancing :p

Not a bad idea. I think I'll give corruption some thought for SovRev. Thanks :)
 
Regarding knock-on effects, would such modifications allow for higher-quality pathfinding algorithms?

Not really, the pathfinder is completely separate (and a different dark, dank tunnel)
 
Split post as i'm now on something else.

From your coding pov, it means a way to calculate some penalties based on # cities and distance from capital and entries to mitigate those in SPs, buildings, beliefs ... For the modder, it would be lots of delicate balancing :p

An easy way to achieve this, in a roundabout fashion, would be to scale the amount of unhappiness a new city causes based on distance from the capital, and to modify the penalty for unhappiness to be punishing in different, and more reasonable ways. This would tap into the game's existing 'maintenance' method (i.e. unhappiness = lower productivity, etc.), and be much easier to implement. For example, instead of killing off growth (because when did unhappiness led to less children being born??), it could reduce your gold income, culture income, etc. on a national scale.

We need "rubber band mechanisms", something that slows down leaders and give challengers a chance.

I hate to be 'that guy' who keeps plugging his own mod, but CSD has turned the Arts/Sciences funding WC resolutions into rubber-banding mechanisms, and it works pretty well. Essentially, when active, these resolutions calculate the score difference of each player to the highest-scoring player. Those on the bottom half of the score table get a % boost to multiple yields based on the difference in the two scores, divided by 50. So, for example, if Player A has a score of 1200, and Player B a score of 300, Player B would get a 18% boost to his/her yields in each city (depending on the active resolution). As this score changes, the boost goes up and down (minimum of 10%, maximum of 30%).
G
 
Rather than have new cities increase culture/beaker cost and actually make your previous ones worse, each new city take a penalty everything (:c5science: :c5gold: :c5culture: :c5production:) based on how many cities you already have and how far from capital it is located (to punish those forward settlers). Eventually, those new cities would no longer help your :c5science: :c5gold: :c5culture:.
Something I was actually thinking about when pondering the tall vs. wide conundrum is that new cities are really cheap in another sense: they're built instantly.

It might be interesting if you "stole" one of the ideas that seem to be in Civ:BE: that cities are not full cities instantly with their whole ring of times but are outposts first.

I think something interesting about this idea is also that it reduces the combat strength on founding a city (which is actually fairly decent in early eras). It'd be interesting if settlers built cities like work boats build improvements (plus some empire-wide resource drain - or just limit the number of city being founded at the same time) - it means they'd also tie up your military during the founding period. This might be a very stupid idea in general, though and end up more gimmicky than anything else.
 
Something I was actually thinking about when pondering the tall vs. wide conundrum is that new cities are really cheap in another sense: they're built instantly.

It might be interesting if you "stole" one of the ideas that seem to be in Civ:BE: that cities are not full cities instantly with their whole ring of times but are outposts first.

I think something interesting about this idea is also that it reduces the combat strength on founding a city (which is actually fairly decent in early eras). It'd be interesting if settlers built cities like work boats build improvements (plus some empire-wide resource drain - or just limit the number of city being founded at the same time) - it means they'd also tie up your military during the founding period. This might be a very stupid idea in general, though and end up more gimmicky than anything else.

The standard strength growth of cities, without defensive buildings, is somewhat absurd. You are correct, in that a 1-population city with no walls, and no defenders, should not have any strength, or at least very, very little. Increased city-strength should really only be a factor of defensive buildings, and perhaps era changes, but nothing else.

If I were to redesign siege mechanics, I'd make defensive buildings (like walls, or the palace) enable ranged-strike, and have that ranged-strike increase in range and potency with more advanced defensive buildings like castles and military bases. Second, I'd create a hierarchy of garrison strengths to incentivize proper garrisoning: Melee->Ranged->Siege. Melee would increase strength slightly, however they would also be at a penalty to attack units next to the city (as sorties were generally a risky move). Third, I'd reduce the strength of a city (or increase the strength of attacking melee units) based on the amount of damage the city has taken. This would simulate breaches in walls, etc. Lastly, I'd modify the strength of cities slightly based on happiness/unhappiness values. Empires which are unhappy, or hovering around 0-10 happiness, would have lower strength values for their cities than cities with high happiness or in golden ages. In short, the static nature of city defense values is not terribly exciting, and could be an interesting means of augmenting the discussion above regarding tall/wide penalties and corruption.

These changes could be offset by increasing the turns of resistance based on population size. Let cities change hands more readily &#8211; even if the original owner recaptures the city, the pillaging, and loss of population, will often be damage enough, and it will help players reverse a snowball more readily if the amount of military force required to take a city is a bit lower.

Edit: Also, Lord Tirian, if you are still interested in producing icons for CSD, I humbly offer to you the permission to alter/replace any and all of the remaining icons the mod uses. I'm not attached to any of them, so making icons for a miserable artist it is something you enjoy, feel free to take a crack at them. :)
 
I'd make defensive buildings (like walls, or the palace) enable ranged-strike, and have that ranged-strike increase in range and potency with more advanced defensive buildings like castles and military bases.

Already in (via events), see Global - City Bombard Range for the lua
 
Back
Top Bottom