#React to component enabled state changed.

1 messages · Page 1 of 1 (latest)

scenic kestrel
#

Is there a way to run a system for components active state change? not all ticks but a single time on change

thorn nymph
#

not without some complex solution

scenic kestrel
#

Do this complex solutions needs structural changes?

thorn nymph
#

either field in your comp

#

or separate comp

#

which tracks whether reaction happened or not

#

after state changed

#

which you'll have to manage on your own (aspect will help with this)

scenic kestrel
#

but then it will run every tick? the check

#

it is a tradeoff between a check every tick vs structural changes. Right?

thorn nymph
#

why do you need it in the first place?

#

why can't you just manage doing reaction during state change?

#

without involving this overcomplications

scenic kestrel
#

i have a spatial hashing system and i need to remove the entity from the spatial hash when it is disabled

#

(on my server, a MOB is disabled when it dies until it respawns)

#

Maybe this is the problem

thorn nymph
scenic kestrel
#

every time a mob die

#

My game can handle like 7500 players (i have tested on 12 core server and it works outputting nearly 1gbps of bandwidth)

#

And they will kill a lot of mobs

#

But i dont think a lot is a lot for structural changes. Im just avoiding it at all costs rn

#

i don`t want to bottleneck game server on main thread

thorn nymph
#

so it's a lot

#

I suggest to just keep it stateless then

#

recreate every tick

scenic kestrel
#

like physics?

thorn nymph
#

yep