Paladin1cd Posted April 7, 2024 Posted April 7, 2024 Assumption: Trigger zones monitor each second for a group to be in the zone. Assumption 2: Above can reduce multiplayer server performance over time or with many zones being monitored. Question: Can that be managed by having the zone only be monitored after a condition is set (say a flag)? Thus: No resources are necessary until event x happens, and then after event z the zone is deactivated and no longer using resources nor is it monitored?
rob10 Posted April 7, 2024 Posted April 7, 2024 In part, a "once" condition trigger likely does some of this - i.e. stops checking after the condition has been met once. And "switched condition" would only be checking for the overarching condition before checking all the conditions within the trigger (which is generally doing what you want). Going further with your suggestion is an interesting theory. My guess is that you would probably net out no better off simply because you're adding another layer of checks (to see if the flag is met and you should check all the other conditions) and it's going to have to continue happening while you ARE actively checking the other conditions to monitor when the flag turns off again (so more checks during the most intensive part of processing).
Pizzicato Posted April 7, 2024 Posted April 7, 2024 All of your assumptions are correct (with the caveat that trigger zone checks are actually really.cheap, and therefore have minimal performance impact anyway). If you wanted to control the trigger zone checks in the ME, you could just use a flag start/stop the checks. Setting the trigger type to Once would ensure that it's only checked until it becomes true and then stops checking. You can also use Time Since Flag conditions to control how often the check runs (e.g. Every 5/10/30/whatever seconds). If you're scripting, you can get more clever and use finite state machines to control when the checking process stops/starts, and coroutines to control how many zones are checked per frame. 1 i7-7700K @ 4.9Ghz | 16Gb DDR4 @ 3200Mhz | MSI Z270 Gaming M7 | MSI GeForce GTX 1080ti Gaming X | Win 10 Home | Thrustmaster Warthog | MFG Crosswind pedals | Oculus Rift S
cfrag Posted April 7, 2024 Posted April 7, 2024 4 hours ago, Paladin1cd said: Assumption 2: Above can reduce multiplayer server performance over time or with many zones being monitored. Your assumption IMHO could benefit from a bit more substantiation. First (aside only), I see no reason why this should be MP server performance, the impact should be the same for SP, but I don't think that this is your main point. I read your message as musing if trigger zone checking can degrade performance of a game sufficiently to be noticeable to players at a certain point. The answer to that is obviously "yes". What is not so clear would be the numbers involved (how many trigger zones T would be the limit to become noticeable when G number of groups are involved, if we want to check all groups within S seconds (you assume s = 1 - each zone is checked once per second). And the next point is, as @Pizzicato pointed out, the method in which zones are tested. If DCS is, for example, able to employ a binary space partition algorithm to smartly sort zones, if testing can be made sufficiently cheap, and if testing can be vectorized over multiple threads, we can get to very, very different limits for T and G before performance is impacted (NB: how (T,G) impact the algorithm's run time (linear, exponential, logarithmic) may also be a factor). But here's another thought: my feeling is that the number of trigger zones is near irrelevant wrt performance impact compared to the workload that units incur: because each unit requires AI and units must check for the proximity of nearby enemy units, a far more expensive check that can rise exponentially with the number of units in the mission. So trying to optimize how trigger zones work can amount to premature optimization - I hope that ED regularly run a profiler over their missions to identify the stretches of code that actually give the greatest return on their optimization efforts, and then focus on that. That may well be trigger zones, but at this point in time I think they are way down on the priority. 1
Paladin1cd Posted April 8, 2024 Author Posted April 8, 2024 Ok, so I blanked I guess and didn't realize it would check in a switched trigger. There are other reasons to do this as well and I was struggling with the trigger logic. I'll mess around with it and get my arms wrapped around it. Thanks guys.
Recommended Posts