ACR creatures scripts: VFX?
Posted: Wed Mar 12, 2008 5:13 pm
Cipher: I've had some reports of heavy and sudden lag in combat, roughly around the time the creatures first perceive the players (especially when there are multiple PCs on, and multiple creatures.)
In the creature OnPerception() event, I see this:
which calls this function in acr_vfx_i
So, at the moment of perception, each of the creatures is checking variables on each of the objects perceived, and trying to apply effects on all of them? I'm not sure what the intent was here- why should they be applying effects on everything they perceive?
There is also a similar check OnHeartbeat for creatures, to apply VFX to themselves- presumably that wouldn't need to be happening every heartbeat for every creature, would it?
I may be missing some of the intention of the VFX system here- hopefully you can clarify things somewhat. When I get a bit of time, I'll try some combat comparisons with and without the perception-based and heartbeat VFX to see if it's affecting performance.
In the creature OnPerception() event, I see this:
Code: Select all
305 void ACR_CreatureOnPerception()
306 {
307 object oPerceived = GetLastPerceived();
308
309 // apply any effects on the creature
310 ACR_VFXOnPerception(oPerceived, OBJECT_SELF);
311
312 // still call the Obsidian script for AI for now.
313 ExecuteScript("nw_c2_default2", OBJECT_SELF);
314 }
Code: Select all
446 void ACR_VFXOnPerception(object oPerceived, object oPerceiver)
447 {
448 // Load the effect strings
449 string sVisualEffect = GetLocalString(oPerceiver, ON_PERCEPTION_EVENT + EFFECT_VISUAL);
450 string sPhysicalEffect = GetLocalString(oPerceiver, ON_PERCEPTION_EVENT + EFFECT_PHYSICAL);
451 string sDamageEffect = GetLocalString(oPerceiver, ON_PERCEPTION_EVENT + EFFECT_DAMAGE);
452
453 // Apply the effects
454 _applyVisualEffect(sVisualEffect, oPerceived, _applyDamage(sDamageEffect, sPhysicalEffect, oPerceived));
455 }
There is also a similar check OnHeartbeat for creatures, to apply VFX to themselves- presumably that wouldn't need to be happening every heartbeat for every creature, would it?
I may be missing some of the intention of the VFX system here- hopefully you can clarify things somewhat. When I get a bit of time, I'll try some combat comparisons with and without the perception-based and heartbeat VFX to see if it's affecting performance.