I recently noticed that for each combatant that I add to a scene, it somehow adds 1.0 - 1.5ms to the main thread, and slowdown becomes apparent. The strange thing is, I don't know what could have caused this, as the scenes that have 10-20 combatants were running silky smooth as of a few days ago and never above the 2-3ms mark.
The only changes I've recently made have been to the status effects and GUI, adding about 20-25 status effects to the database.
For the interested: All of those 20-25 status effects are using multiple auto-apply and auto-remove requirements.
The problem is that this means that I have 20 Enemies in one scene, all checking for, applying and removing status effects that should only apply for the player.
GiL, is there a way to make Apply/Remove checks for a Status Effect only apply to specific combatants? Otherwise we run into some pretty heavy lag having enemies doing wasteful checks that should only apply to the player.
In addition for further performance optimization: do you think we could add an additional option for Auto-Remove and Auto-Apply to use ORK Requirements as well? This way we could make it so the game only checks for the Apply/Remove criteria while the game is in certain states (In Menu, etc)
I guess this is Revenge of the Auto Apply/Remove Week. xD I botched things up pretty royally myself by having 27 status effects with one Apply and Remove requirement each and another 40+ with multiples.
For the past few days I've been turning over in my mind what the best solution would be... I haven't come up with much unless Status Effect checks are constantly updating in real time right now. If that's the case, then maybe they should be more like Combined Status Values formulas, which are only triggered to update by specific types of changes in the game. I'm also wondering whether Auto Remove makes its checks even when the status effect isn't applied. These are the kinds of times when I'd like to be a little more knowledgeable on the coding side so I could try digging up answers myself.
Anyway, your ideas sound good with having effects only apply to specific combatants and using ORK Requirements. =) Mostly I'm just glad I'm not the only one really pushing the status effect system. :P It didn't even occur to me until now that my status effects also don't need to check enemies and don't need to check outside menus...
Actually, the status effect auto apply/remove checks are only done when the actual status that is checked changes on the combatant, so it's not constantly checked. This is done with pretty much any requirement checks that would otherwise need constant checking (e.g. HUDs) - to prevent those performance issues :)
I'll do some tests, can send me your ORK project?
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Good to know, I should have expected that you'd already thought of this beforehand!
I changed all enemies' Status Values to have neutral affinities (So no Status Effects would be auto-applied or removed); and that seems to have gotten rid of the lag.
Otherwise, every combatant would have been getting 8~ Status Effect changes immediately upon loading the scene; so I suppose all the status effects immediately occurring on so many combatants must have been the source of the lag. Deleting combatants one by one gradually reduced the overhead.
I'll toss you the fixed project file right now in case you'd still like a look.
Edit: Searching for a way to prevent Combatants being immune to specific status effects, is it possible aside from Auto-removing on the combatant? I feel pretty sure that it was possible but I'm drawing a blank;
I think there are still definitely some status effects that you might want on the player but not enemies, (or vice versa) even when they should technically have it due to status values; and I think using Auto-Remove would result in a loop.
Of course, the auto apply/remove will be checked when a combatant is first created, so there'll be some things going on upon that event, but not permanently (unless you have some add/remove cycle in there ...).
Status effect immunity (and also auto effects) can be given through the Status Effect Settings found right below the Bonus Settings of your combatant. Selecting Remove for an effect will give immunity.
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Found the bottleneck - wasn't auto apply/remove, but other status effect checks (conditions) which caused unnecessary other checks when nothing changed.
Small change and now 100 combatants run as good as 1 - even 1000 combatants are working quite good (1/100 combatants ~15ms, 1000 ~30ms) :D Will be in the next udpate!
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
For the interested: All of those 20-25 status effects are using multiple auto-apply and auto-remove requirements.
The problem is that this means that I have 20 Enemies in one scene, all checking for, applying and removing status effects that should only apply for the player.
GiL, is there a way to make Apply/Remove checks for a Status Effect only apply to specific combatants? Otherwise we run into some pretty heavy lag having enemies doing wasteful checks that should only apply to the player.
In addition for further performance optimization: do you think we could add an additional option for Auto-Remove and Auto-Apply to use ORK Requirements as well? This way we could make it so the game only checks for the Apply/Remove criteria while the game is in certain states (In Menu, etc)
---------------------------------------
Personal Twitter: https://twitter.com/AMO_Crate
I make RFI! https://twitter.com/NootboxGames
For the past few days I've been turning over in my mind what the best solution would be... I haven't come up with much unless Status Effect checks are constantly updating in real time right now. If that's the case, then maybe they should be more like Combined Status Values formulas, which are only triggered to update by specific types of changes in the game. I'm also wondering whether Auto Remove makes its checks even when the status effect isn't applied. These are the kinds of times when I'd like to be a little more knowledgeable on the coding side so I could try digging up answers myself.
Anyway, your ideas sound good with having effects only apply to specific combatants and using ORK Requirements. =) Mostly I'm just glad I'm not the only one really pushing the status effect system. :P It didn't even occur to me until now that my status effects also don't need to check enemies and don't need to check outside menus...
This is done with pretty much any requirement checks that would otherwise need constant checking (e.g. HUDs) - to prevent those performance issues :)
I'll do some tests, can send me your ORK project?
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Good to know, I should have expected that you'd already thought of this beforehand!
I changed all enemies' Status Values to have neutral affinities (So no Status Effects would be auto-applied or removed); and that seems to have gotten rid of the lag.
Otherwise, every combatant would have been getting 8~ Status Effect changes immediately upon loading the scene; so I suppose all the status effects immediately occurring on so many combatants must have been the source of the lag. Deleting combatants one by one gradually reduced the overhead.
I'll toss you the fixed project file right now in case you'd still like a look.
Edit: Searching for a way to prevent Combatants being immune to specific status effects, is it possible aside from Auto-removing on the combatant? I feel pretty sure that it was possible but I'm drawing a blank;
I think there are still definitely some status effects that you might want on the player but not enemies, (or vice versa) even when they should technically have it due to status values; and I think using Auto-Remove would result in a loop.
---------------------------------------
Personal Twitter: https://twitter.com/AMO_Crate
I make RFI! https://twitter.com/NootboxGames
Status effect immunity (and also auto effects) can be given through the Status Effect Settings found right below the Bonus Settings of your combatant. Selecting Remove for an effect will give immunity.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Small change and now 100 combatants run as good as 1 - even 1000 combatants are working quite good (1/100 combatants ~15ms, 1000 ~30ms) :D
Will be in the next udpate!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
---------------------------------------
Personal Twitter: https://twitter.com/AMO_Crate
I make RFI! https://twitter.com/NootboxGames