Code diving thread

Post Reply
py01
Joined: Mon Mar 26, 2018 8:27 pm
Byond Username: Py01

Code diving thread

Post by py01 » #433603

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
Last edited by py01 on Sun Aug 19, 2018 5:59 pm, edited 9 times in total.
Tsaricide
Joined: Wed Dec 10, 2014 1:55 am
Byond Username: Tsaricide

Re: A thread for undocumented mechanics

Post by Tsaricide » #433604

Do the weapons first, I need to powergame.
User avatar
DemonFiren
Joined: Sat Dec 13, 2014 9:15 pm
Byond Username: DemonFiren

Re: Code diving thread

Post by DemonFiren » #433620

back to your grave tsarishite
Image
Image
Image
ImageImageImageImageImage

non-lizard things:
Spoiler:
Image
Tsaricide
Joined: Wed Dec 10, 2014 1:55 am
Byond Username: Tsaricide

Re: Code diving thread

Post by Tsaricide » #433644

Thanks
factoryman942
Joined: Sat Jun 25, 2016 8:38 pm
Byond Username: Factoryman942

Re: Code diving thread

Post by factoryman942 » #434130

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
User avatar
Rohesie
Joined: Sat Aug 04, 2018 9:07 pm
Byond Username: Rohesie

Re: Code diving thread

Post by Rohesie » #434191

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.
Post Reply

Who is online

Users browsing this forum: No registered users