Hey guys !
I have a problem with a power reserve system im trying to make.
I have an Int Variable “Power Reserve” that is going from 0 to 999.
-i have different electrical devices that drain power from the “Power Reserve”
-i also have a way to recharge the “Power Reserve”
Now my goal is the following, i want to check the “Power Reserve” Variable, and if its current value is between a set of ranges, trigger multiple Events.
Example :
Power : 0 = “Event Empty”
Power : 1-250 = “Event Power Low”
Power : 250-500 = “Event Power Medium”
Power : 500-999 = “Event Power OK”
The only way i figured how to do it is with a set of Branches, but its seems stupid…
But just to know, what could i do if i need ranges that would be more specific like :
1-15
16-250
250-450
and so on, would there be a good ption for that situation ?
will anyone ever notice? No, only you and your team.
is it worth focusing on? No.
does it matter here? Also NO, but with caps lock.
What matters more is making the script easy to read and find (for you and others).
From what I understand about Blueprints - the cost is somewhat linear - the more nodes to step through, the more computationally expensive things get. But it’s not really measurable in this case. You’d need to do it a thousand times per second, and even then the cost of the BP loop itself would be higher than that of calling some C++ functionality via a node.
adopt Event Driven approach
avoid unnecessary hard references
avoid 4k textures on tiny props
avoid looooong BP loops, especially on Tick
don’t Tick things that do not need to be updated every frame