ID:1665353
 
(See the best response by Kaiochao.)
Code:




Problem description:
So first off as long as no player is moving nothing should be happening so its very effficient that way. No healthbars, AI, and what not going through while loops or for loops, at least while they are not needed.

But for my AI to work i need to have 1 if statment for every tiled player step. will this if statment cause inefficencies. No loops just an if for every step. Will too many steps all at once cause a problem or is this too small to matter.




I don't think that'd be nice... Imagine a player is damaged and he doesn't get his bars updated, or he recovers and it isn't updated either. It shouldn't lag a lot if you use Stat() to keep them updated, to activate the AI you could use area procs. I think it'd be much better that way.
Best response
Anthonytyran wrote:
Will too many steps all at once cause a problem or is this too small to matter.

It wouldn't be "too many" if it wasn't causing issues, but we're talking potentially thousands of calls per frame.
In response to Kaiochao
so it would have to be thousands of these to cause issues? okay thats good i dont think i have to care then. As this is the only really thing that may happen when not needed.
In response to Kaiochao
i never said they never updated, just they dont get called unless activated, like they arent forever looping like ive seen some people do. Actually my healthbars dont even need loops or require any if statments to work, just some math. So i think they are efecient as possible
In response to Kaiochao
opps not you again but for enternal memories