ArcanePariah / Night-of-the-Dead

9 stars 14 forks source link

Event optimization -lot of minor ones. #217

Closed NiktosNOTD closed 6 years ago

NiktosNOTD commented 6 years ago

This is probably not going to affect much performance wise, but if it does it will be towards less strain and better performance.

If you ever watched a replay with trigdebug open you probably noticed some trigger events have really high rate of 'failed conditions' like pic related (it's a normal AC game) high fail rate events

This Commit was what gave me an idea that this can be prevented, and without much workload too.

This pull request optimizes 2 big culprits "InfestorAI" and "AmmoUsage" As well as 14 smaller ones listed below.

Full changes

Changing various event driven triggers (requiring marine pressence) to use dynamic event registration. Instead of "Any unit does 'x' in trigger itself" it now uses 'RegisterMarineWithEvents' to add event thus limiting how often the triggers run.This change also allows removing now redundant conditions checking if "EventUnit=Marine"

Triggers it changes:
1.'RegisterMarineWithEvents' - to add extra events to dynamically register.
2.'LevelUp'
3.'MineShaft'
4.'OM1EnterCommTower'
5.'OM6EnterCommTowerTransmission'
6.'OM2aOgilvyFound'
7.'OM2bIvanFound'
8.'OM3ArmoryTurrets'
9.'OM5RamirezsTaunts'
10.'OM8EnterBridgeTerminal'
11.'OM11Delta2'
12.'OM12EnterPrisonerHoldingArea'
13.'OM12Prisoner1JohnAnderton'
12.'OM12Prisoner2FaricaAugustin'
13.'ShopForceClose'

Changing triggers connected to specific units to use that specific unit as Event instead of 'any unit',also removed now redundant conditions. Biggest offender here was 'InfestorAI', 

Changed triggers :
1.'InfestorAI'
2.'MineBossKill'
3.'InfestorKilled' -just removing redundant condition, events were fine

Optimizing events used by 'AmmoUsage' trigger.
Before it used "Any unit started atack with any weapon" event, it caused it to run for zombies, minis, minions, on top of wanted marines.
Now it uses "Any unit started atack with 'x' weapon" where 'x' is weapon usable by marines.
Now it's a list of events specifying all guns instead of one very broad event. Also removed now not usefull conditions.
NiktosNOTD commented 6 years ago

This pull won't be getting extra commits. I'm investigating how to optimize events of "CriticalStrike" and "Backstab" triggers but if i find anything it will be in their own separate pulls as those require different aproach and testing changes related to them is harder.

ThunderRazor commented 6 years ago

I hope you're making sure that the event does not interfere with the existing stinger event.

NiktosNOTD commented 6 years ago

No they not interfere, one could say they have even less interaction than in live game as the suggested here events simply ignore any stinger related shots for exact reason of it having it's own trigger. Before my changes stinger shots caused both AmmoUsage and AmmoUsageStinger to run, AmmoUsage simply never passed conditions. Now it does not run for stinger at all. It's same for L3 which also has it's own ammo related trigger. New implementation also completely ignores Crowbar which earlier triggered it only to never pass conditions.