OpenDream icon indicating copy to clipboard operation
OpenDream copied to clipboard

Fixes yield proc scheduling. Turns sleeps into an opcode

Open Cyberboss opened this issue 9 months ago • 5 comments

The behavior is now the same for either spawn or sleep:

  • delay < 0: Proc will continue immediately if nothing is scheduled in the same tick. Otherwise, same as delay == 0.
  • delay == 0: Proc scheduled on end of same tick.
  • delay > 0: Proc scheduled after n ticks.

This also fixes the ProcScheduler being able to still have queued procs when running multiple tests in serial.

Then, to fix perf issues I had to redo sleeping into an opcode:

  • Remove sleep from DMStandard.
  • Two new opcodes Sleep and BackgroundSleep (which is just sleep -1, much faster than popping a float off for background sleeps).
  • Create new lightweight async proc state for sleeping.
  • Compiler/runtime adjustments to handle new opcodes.
  • Added IOpenDreamGameTiming as a wrapper around IGameTiming that we can control in unit tests.

Closes #1262

Cyberboss avatar Nov 26 '23 23:11 Cyberboss