Page 1 of 1

Code diving thread

Posted: Sat Aug 18, 2018 8:15 pm
by py01
I'm making this thread as a central place to write down stuff you've found while code diving that isn't marked on the CM wiki.

Here's what seems to be the xeno health regen code. It seems that regen is composed of a flat portion plus a percent of max health, plus another percent of max health if recovery pheremones are nearby. Fire damage also seems to heal quicker than brute.

Code: Select all

#define XENO_HEAL_WOUNDS(m) \
adjustBruteLoss(-((maxHealth / 70) + 0.5 + (maxHealth / 70) * recovery_aura/2)*(m)); \
adjustFireLoss(-(maxHealth / 60 + 0.5 + (maxHealth / 60) * recovery_aura/2)*(m)); \
adjustOxyLoss(-(maxHealth * 0.1 + 0.5 + (maxHealth * 0.1) * recovery_aura/2)*(m)); \
adjustToxLoss(-(maxHealth / 5 + 0.5 + (maxHealth / 5) * recovery_aura/2)*(m)); \
updatehealth()
Here's the population cap for evolution. It seems that if >50% of xenos are t2 or t3, you cannot evolve into a t2. If >25% of xenos are t3, you cannot evolve into a t3.

Code: Select all

if(tier == 1 && ((tierB + tierC) / max(totalXenos, 1))> 0.5 && castepick != "Queen")
		src << "<span class='warning'>The hive cannot support another Tier 2, wait for either more aliens to be born or someone to die.</span>"
		return
	else if(tier == 2 && (tierC / max(totalXenos, 1))> 0.25 && castepick != "Queen")
		src << "<span class='warning'>The hive cannot support another Tier 3, wait for either more aliens to be born or someone to die.</span>"
Chestburster code.
Cryo halts embryo growth. Stasis bags and dangerous cold levels slow embryo growth.

Carriers are considered t3, hivelords are t2 though

Xenos in crit take 2.5 damage a second off weeds, if affected by guarding this is subtracted by 1/2 of aura strength. (Ancient queen completely halts bleed out) If on weeds, warding gives a flat regen to crit xenos equal to half of the aura strength. Warding gives armor equal to triple aura strength, and damage reduction equal to aura strength*2.5%.

Todo:
Figure out how xeno's armor_deflection values work
Figure out how marine's armor values work
Find all bullet/weapon damages/accuracies/ect with all damage affecting attachments (spreadsheet)


Here's a link to my current data spreadsheet:
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Re: A thread for undocumented mechanics

Posted: Sat Aug 18, 2018 8:27 pm
by Tsaricide
Do the weapons first, I need to powergame.

Re: Code diving thread

Posted: Sat Aug 18, 2018 10:01 pm
by DemonFiren
back to your grave tsarishite

Re: Code diving thread

Posted: Sun Aug 19, 2018 1:24 am
by Tsaricide
Thanks

Re: Code diving thread

Posted: Tue Aug 21, 2018 6:43 am
by factoryman942
the xeno armour stuff happens here

It might just be that I'm bad at reading the code, but I found it hard to comprehend, so:

If you're a queen or crusher, you get a bonus to armour while charging dependent on current charge speed. I'm not sure queens can actually charge at all.
If you're a queen or crusher, and you're facing towards the bullet, your armour is multiplied by 1.5. If you're facing away from the bullet, it's instead multiplied by 0.5.

If the bullet has armour penetration it subtracts that from your armour.

If after that you have >0 armour, it determines if the hit's a crit or not. To do this it picks a % between 5 and 10, then rolls for that probability.
It also calculates armor_soak here, as 10*(armor/damage)
If it's a crit, the damage is not reduced at this point.
If it's not a crit, it subtracts armor_soak from the damage.
Either way, it subtracts half of armor_soak from your armour.

after this, if you still have armour makes a roll of prob(armour).
If it succeeds, damage is reduced by 50%. That amount is also subtracted from armour. It then makes a second roll to reduce it by 50% again.
If it fails on either roll no more damage reduction from armour occurs.

Finally, if the damage after all of this is less than 3 the shot's blocked completely, else it deals its damage.

tl;dr: if it's not a crit, big armour absorbs a bunch of damage. Then it tries to reduce damage by 50%, with better odds if you have good armour. It then tries to do it again. If the damage is now puny, congrats, you're completely fine

Re: Code diving thread

Posted: Tue Aug 21, 2018 1:40 pm
by Rohesie
factoryman942 wrote:I'm not sure queens can actually charge at all.
We used to have NASCAR queens who'd charge into and away from battle, delaying rounds for hours because nobody could catch them. It was a sad state of affairs.

On the rest of it, your understanding is correct.

To sum it up, damage is much more important than AP in general. Do high damage and see your foes despair.