Question about WatchedEntity/EntitySet updating


Is it ok if I update an EntitySet or WatchedEntity in longer intervals (e.g. every minute or so) and not per frame base?

I may use them in AI script that occasionally checks an EntitySet or WatchedEntity for changes.

It’s ok to do it as long as you remember that it’s internally building up a queue of events to apply.

There may not be a good reason to delay, though. Updating them is almost free so presumably it’s what you’re doing because of the update that you would rather delay… and sometimes that’s better to handle with an ‘invalid’ flag or a ‘version’ like VersionedObject/VersionedReference. Without knowing more detail, I cannot say.

…but one boolean on an object saying it’s dirty and should check its set again soon is going to be a lot cheaper than some unknown about of change events queued up x however many objects are doing this.

1 Like


I asked because I am using a behavior tree for AI and a sub-branch down in the tree may not run while the tree is running a different branch until its turn come.

Is it a good idea to use SiO2 AbstractGameSystem (not as a real system though but more like an anonymous thing as part of a AI system) for watching and updating entity set and setting the flag or VersionedObject on game objects which is going to be checked later on in AI scripts?

Only you can say if that’s best. I don’t know what prevents your AI system from updating the state of the ‘brains’.

Edit: and if it’s something the runs only occasionally then you could also just query the stuff as needed instead of keeping an entity set around.

1 Like