wiki:AtomicActions

Version 1 (modified by jpawlick, 13 years ago) (diff)

--

Most of the base ProtocolZero commands are atomic - that is, they take zero time in the simulation. They execute completely within a single frame, and so cannot be interrupted. With the exception of sk, atomic operations also never cause actions they interrupt to stop. For example, you may imagine that if a quagent was running continuously and suddenly you issued a "n lc 0", it would pause running for a moment to figure out its location. This, however, is not the case - since lc is an atomic operation, it is executed, removed from the queue, and the next operation on the queue is immediately resumed, so that the quagent runs seamlessly.

Obviously, we're abusing the notion of time here - some commands can take quite a long time ( can take arbitrarily long, since the user can ask for an arbitrarily large amount of data). When we say "zero time" or "instantly", we mean in terms of simulation-time. In these cases, the simulation will actually freeze until the command is complete, so doing a lot of high-resolution batch-rangefinding is a great way to kill the framerate.