Under the hood: Gidmod Intel (or "...this world was being watched closely by intelligences greater than man's...") |
It has occured to me that it is rather unfair of me to change how intel defense works, and then not post details on the system. The following information is current as of 4.9.0-beta, with a game version of 1.58. Hopefully this helps you to better understand how intel defense success is calculated in my mod.
The first thing you should know is how intel and intel defense works.
Basically, an attack type is chosen. Then, the game accumulates points for that type (the ammount varies by type) until it has enough to launch the project. How much the attack project costs goes up by an ammount based on how many total attack points you are spending.
When defending, all your defense points are applied. The cost to defend against a particular attack is equal to one half the adjusted cost of the attack. So far, everything above here is the same as it is in stock. Though I did do one change, I changed how it calculates the cost modifier to the attack project.
Stock formula is:
if (atk_spending > 1000000) then
set this_cost := this_cost * 200
else
if (atk_spending > 500000) then
set this_cost := this_cost * 100
else
if (atk_spending > 100000) then
set this_cost := this_cost * 20
else
if (atk_spending > 50000) then
set this_cost := this_cost * 10
endif
endif
endif
endif
I have replaced it with:
set this_cost := this_cost * Sys_Max_Long(Sys_Min_Long(Sys_Trunc(atk_spending / 5000), 200), 1)
This allows the modifier from attack points to grow gradually rather than in abrupt jumps. The maximum and minimum modifiers are still the same.
Here is what happens in stock after this point:
If you have more defense spending than the cost to defend against an attack, the attack fails, and your defense points go down by an ammount equal to the cost to defend. Its a pretty straight forward system, but one that allows you to make yourself completely immune to enemy intel actions. Chance has no effect, as it is a pure game of who has the most numbers.
Now, here is where the real modifications come in. I'm not going to bore you with specific details, but I am going to give you a detailed idea of how each modifier works, how the chance to defend is calculated, and what the results on the defender's points are.
Firstly, some stats about the defending empire are accumulated. These are:
1 - The number of races in an empire. Each race BEYOND THE FIRST gives a defense chance modifier of -5%. I figured that the more diverse your population is, the more likely people can infiltrate un-noticed. NOTE: I am unsure this particular modifier works yet, as the game does not correctly report the number of races in an empire in the empire information screen in-game.
2 - The average happyness level of your empire. This is calculated by averaging the happyness of all your planets across your empire. This modifier ranges from -10% to +9%, depending on the outcome. Planets which are populated by an emotionless race are assumed to have a happyness level of 85% (agreeing all the time is actuallly NOT logical). This means an empire with an all emotionless population will have a modifier of +7%. All other planets provide a maximum happyness level of 95% (you can't make everyone happy all the time).
3 - The number of rioting planets. Riots are a major drag on intel defense. All the chaos makes it much easier for enemy agents to slip in your empire and do damage/steal information. Because of this, there is a modifier of -10% to defense for EACH RIOTING PLANET. This also means that if you can cause a few riots in a target empire, you can use that as cover to launch even more devistating attacks. The lesson: if you are defending against intel, make sure you have some sort of planetary garrison.
4 - The number of colonies you have. Your ability to secure your empire always decreases as the area it occupies increases. The modifier from this is -1% for every 20 colonies beyond the first. Domed colonies count as 2/3rds of a colony, not a whole colony. This is because a domed colony's enclosed environment is easier to secure than one that isn't domed.
5 - The density of population. It is generally easier to blend in with a crowd than when you are alone, and higher density population areas tend to have more sensitive information available due to the nature of communications. Every 10% of an empire's total population capacity gives a -1% modifier to defense, with a maximum modifier of -10% at 100% capacity filled.
All of these are totaled up, to give a modifier to your percent chance to defend. Now, we have to find the base chance to defend against an attack.
I use the same two base numbers that the stock game does (how much defense you are spending, and how much it costs to defend against a particular attack) but I used these numbers in very different ways. Firstly, the ammount of defense you are spending is modified by what kind of attack you are defending against. Defense spending is 125% effective against espionage attacks (which just gather info), but is 225% effective against sabotage attacks (which actually do damage, and so are riskier to pull off). It is assumed that performing intel against an empire involves bribing/coercing someone in that empire (usually several someones), and it is generally harder to get people to participate in inflicting damage than just giving up information. The bonus of 25% represents defensive systems which cannot, for whatever reason, be co-opted. Maybe its an unbreakable security algorythm, or maybe its a fanatical defending agent.
This modified defense spending ammount is then divided by the cost to defend against an attack. This gives a percentage from 0% on up to...well...to wherever it happens to stop. At this point, it could be well over a 100% chance to defend, or it could be less than 1%. Now, the modifier that was calculated off of our 5 empire statistics is added. This could very well push the defense number in to the negatives, or it could still be over 100%.
After the modified defense chance is calculated, it is constrained. There is a minimum defense success chance of 5%, as you could get lucky. Also, there is a maximum defense success chance of 95%, as failure is always an option. The game then generates a random number from 0 to 100, and compairs it to our defense success chance. If it comes in over our defense success chance, then the intel attack was successful, otherwise it fails.
After success or failure is determined, the other change I've made is to how your defense points are reduced. Unlike stock, there are many shades of grey here for how strong your defenses are.
If you succeed in defending, your total defense points go down by a percentage of the cost to defend against an attack. That percentage is equal to the random number that was generated against the defense success chance, with a maximum of 95%. An illustration would be, Empire A conducts a sabotage attack against Empire B. Empire B has an 85% chance to stop Empire A. Empire A's attack generated an 80, and so fails (85 is greater than 80). Empire B has its defense points go down by an ammount equal to 80% of the cost to stop the attack. In this example, if Empire B had succeeded in stopping the attack with a 25, then its points would have gone down by an ammount equal to 25% the cost to stop the attack. Because of this system, the more points you have sunk in to defense, the more you lose on successful defense, because it is more likely you will succeed at stopping attacks which a high chance to succeed.
Another change is that if you FAIL to stop an attack, your points STILL go down. In stock there is no change in defense points, however, I assume that your intel organization spent some sort of effort (represented by points) to stop the attack. Your defense points go down by an ammount equal to a percentage of the cost to defend against the attack (the percentage is the random number generated for success), divided by between 2 and 6 (an average of 4 is returned). Example: Empire B conducts a sabotage attack against Empire A. Empire A has a 70% chance to stop the attack. Empire B's attack generates a 75, and so succeeds (75 is greater than 70). In addition to suffering the effects of the attack, Empire A's defense points go down by an ammount equal to 75% of the cost to defend the attack, divided by 4. You lose less points on a failed defense, because it is assumed that your intel services stop spending resources to defend against a particular attack at the point that the attack succeeds.
Regardless of whether you succeed or fail in defense, your defense points cannot go below zero.
This is, of course, a work in progress. The values presented here may be tweaked at a later date. I would like to incorporate at least one other statistic, Population Loyalty, but there seems to be no way currently to look that up from inside the AI scripting language. Perhaps at a later date.
Anyways, I hope this helps you in dealing with Intel in my mod.
---Permission is granted to duplicate, whole or in part, and/or modify any of the code here for any purposes that does not violate Malfador Machination's intellectual property rights. Credit to the author of the specific code here is not required.---

Re: Under the hood: Gidmod Intel (or "...this world was being w
So what's to encourage small players from bothering with defense at all? You've effectively got offensive hammers and defensive eggshells - it quickly starts to get tempting to just not bother with defense at all, and thus really screw the other guy up. Afterall, if they're likely to punch through no matter what you do...




Re: Under the hood: Gidmod Intel (or "...this world was being w
Hmm. That's a fascinating system.
The only bit that makes me hesitate is the loss of points in the case of an unsuccessful bid - it means that while small amounts of attack have a chance to succeed, small amounts of defense are essentially worthless, because they'll be constantly sucked dry on failed operations. Is this intentional, to give the balance of power to agressive intel use?