Bool check cost?

It shouldn’t be a huge deal, but I would test it out. What is causing you to check 100 booleans every 10 ms?

How heavy does a bool check cost? Can I make hundreds of timers ticking every 10ms, and because of the bool check, it will only fire 10 of them at once?

I used to make a lot of “pause timer” nodes in my code, pausing the timers when I don’t need them, but I found out that it is hard to manage, so can I just set up the bool checks properly, and “let it go” ?

Well, I’m sure that I won’t use more than 100, I’m asking that just in case. But I did have plenty of them, I’m making an action game and needed to add movement to cameras in different situations. I also use timers to provide some animations. ( floating swords, swinging around… ) . And a bunch of linetraces, a load of functions that needed to be ticked every frame, in order to output values for the AI , animgraph. I stick to timers because they don’t have delta seconds issues timelines or event tick will cause.

perhaps rather than having a bool, have a function that enables/disabled the timer, which if you hold the reference, you can clear/restart whenever you want

I think the real cost is having that timer being active with no benefit of your game

all that said, it is pretty minimal, the only way to really know is to measure with the profiling tools, my biggest culprits have never been this tough

Try for loop, loop 1000 bool(that would be 1000 bool per frame 8.33ms) see if it has any difference in ms, it shouldn’t, use stat fps on console.

Bool don’t cost that much

Well I knew It’s pretty light-weighted, maybe a thousand sounds scary, but I guess modern CPUs take it as a breakfast. Great advice, I’ll give it a try when I can.

Hmm, I’d never though about writing the pause nodes into a function. Maybe it’ll be a good method when it turns out that I need to pause several timers at once, I usually get a spider web when keep duplicating “pause timer” nodes and attaching all the timer handle reference :confused:
Sounds like a plan, thanks for the advice.

Daniels11, did you ever test this out? I have a similar question and very curious what you found.

Clearly these forms are the blind leading the blind lol. Lean how event dispatchers work people, this is literally what they’re for. Checking a bool in a tick or timer of when to execute logic is a sure sign on a bad/new programmer. Raise an event VS tangling your tick in tons of bool checking. I promise it’ll add up over time and you’ll lose FPS. Make like an OnReady event and pass whatever you need through it. This is required for thread safe multithreading as well. Just like epic does with OnDestoryed, OnHit, OnOverlap, etc… Those are events.