Memory footprint of 3.5 damage on doors & placeables

Scripted ALFA systems & related tech discussions (ACR)

Moderators: ALFA Administrators, Staff - Technical

Locked
Ronan
Dungeon Master
Posts: 4611
Joined: Sun Feb 20, 2005 9:48 am

Memory footprint of 3.5 damage on doors & placeables

Post by Ronan »

I had been doing 3.5's damage rules on non-plot, non-static doors and placeables in the following manner:

Code: Select all

void ALFA_InitializePhysicalObject(object oObject) {
    int nHardness = GetHardness(oObject);
    effect eEffects = EffectDamageResistance(DAMAGE_TYPE_ACID, nHardness);
    eEffects = EffectLinkEffects(eEffects, EffectDamageResistance(DAMAGE_TYPE_ACID, nHardness) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageResistance(DAMAGE_TYPE_COLD, nHardness) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageResistance(DAMAGE_TYPE_DIVINE, nHardness) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageResistance(DAMAGE_TYPE_ELECTRICAL, nHardness) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageResistance(DAMAGE_TYPE_FIRE, nHardness) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageResistance(DAMAGE_TYPE_MAGICAL, nHardness) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageResistance(DAMAGE_TYPE_NEGATIVE, nHardness) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageResistance(DAMAGE_TYPE_POSITIVE, nHardness) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageResistance(DAMAGE_TYPE_SONIC, nHardness) );

    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_ACID, 0) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_BLUDGEONING, 0) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_COLD, 75) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_DIVINE, 0) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_FIRE, 50) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_ELECTRICAL, 50) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_MAGICAL, 0) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_NEGATIVE, 0) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_PIERCING, 100) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_POSITIVE, 0) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_SLASHING, 0) );
    eEffects = EffectLinkEffects(eEffects, EffectDamageImmunityIncrease(DAMAGE_TYPE_SONIC, 50) );
    eEffects = EffectLinkEffects(eEffects, EffectImmunity(IMMUNITY_TYPE_CRITICAL_HIT) );
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(eEffects), oObject);
}
Mostly I dislike those low energy damage weapons being able to bust down metal doors. I knew this would increase the memory footprint of each door, but I didn't think it would increase it much compared to the footprint of the door itself. However, in testing with 1,536 placeables, I found out the opposite was true.

The following are the states of the mod I tested with, and the memory footprint of a running nwserver:
1,536 placeables, 43,940k with full 3.5 damage rules.
1,536 placeables, 23,944k with no damage rules.
0 placeables (cut their area from the mod), 20,344k
Thats 13k of RAM for those effects per placeable, while the placeables themselves only take up 2.3k each. Needless to say we'll have to apply these damage rules OnDamaged, or modify them a bit :?
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

Where's Creslyn?

When we were working on Sticky Fingers of Death, Cres found a way to ensure that the check to see if a PC required a True Rez would only occur if the hit took them below 0HPs, effectively minimising the impact of the check.

Probably won't help in this instance.

Is it possible to have the door check for an umbrella condition which contains a subset of all of the properties listed?

And if not, by far the most sensible option is simply to stick with object hardness and disregard magical properties of any type. Lag is going to be such a killer, one suspects, that any of the rules which don't play a critical function should be flexible. We're not going to lose too much if your weapon type doesn't obey the rules when hitting inanimate objects. Far more important they do their job againt the animate kind.

Sterling job though old chap. Interesting experiment, and important that we start scrimping and saving on the footprint wherer we can.
Image
User avatar
Fionn
Ancient Red Dragon
Posts: 2942
Joined: Sun Jan 04, 2004 7:07 am
Location: Seattle, WA

Post by Fionn »

You'll have to show me how you are checking the footprints sometime.

Metal/magic doors should be pretty rare. We can also put a check onAreaEnter to find them and apply these effects. This would mitigate your findings, though builders would need to be aware.

Is there a way to fire an onSpellCastAt check and just heal the damage before it's applied? I would expect Cres just hooked into the existing Death scripts to fire from the same method that starts the bleeding.
PC: Bot (WD)

Code: Select all

     -----          -----          -----          -----
    /     \        /     \        /     \        /     \
   /  RIP  \      /  RIP  \      /  RIP  \      /  RIP  \      /
   |       |      |       |      |       |      |       |      |
  *| *  *  |*    *| *  *  |*    *| *  *  |*    *| *  *  |*    *|
_)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_(
Ronan
Dungeon Master
Posts: 4611
Joined: Sun Feb 20, 2005 9:48 am

Post by Ronan »

Fionn wrote:You'll have to show me how you are checking the footprints sometime.
Windows task manager. It seemed consistant enough, uncomment a line and 20mb more VM gets used.

You can actually enforce these rules in script on OnDamaged (not OnSpellCastAt) pretty well as the effects do it. Since damaging inanimate objects is a relative rarity, this may work fine. If not, we can always turn it off. The beauty of having all events everywhere in the module call the same scripts is that its easy to make changes all across ALFA.

I removed the DR (hoping hardness applies to all damage types in NWN2) and removed the immunities of 0%, and it dropped down to 29,132k (3.4k per), which could be acceptable. I'll leave it like that and see how NWN2 changes things.
User avatar
Fionn
Ancient Red Dragon
Posts: 2942
Joined: Sun Jan 04, 2004 7:07 am
Location: Seattle, WA

Post by Fionn »

lol - here all this time I thought you were attaching to the process or some such.
PC: Bot (WD)

Code: Select all

     -----          -----          -----          -----
    /     \        /     \        /     \        /     \
   /  RIP  \      /  RIP  \      /  RIP  \      /  RIP  \      /
   |       |      |       |      |       |      |       |      |
  *| *  *  |*    *| *  *  |*    *| *  *  |*    *| *  *  |*    *|
_)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_(
Locked